-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colored rows #5163
Comments
I just curious - wouldn't it be easier for you just to create a very simple Qt application for this "data only" operations? I mean Qt has very simple framework for dealing with databases (i.e. https://doc.qt.io/qt-6/qsqltablemodel.html and it's "friends"). Writing simple grid for table data editing would be very easy and you are free to manipulate your grid as you like. In SQLiteStudio you will be limited in several ways, because - as already discussed - SQLiteStudio must maintain its primary target use case. You are basically trying to take a Jet Plane, remove its jet engines, remove wings, make it shorter, change its wheels, add bigger windows, add diesel engine and to start using it as a urban car. With huge effort it's possible, but... why? I can already tell it will be much harder for you to achieve all your goals by trying to alter behavior of SQLiteStudio, instead of creating simple Qt app for that (btw. I can guide you with that too - as I wrote in my bio I received a lot of help from Open Source community back in the days and I can help others, who show constructive attitude). To be clear - I really appreciate all the input and contribution you've done to the project so far and I will still guide you if you continue going this path. I'm just giving you an advise, because I can see where this is going and how many problems you will face - instead of going the easier path. |
Thanks very much for this advice. Developing a specific app was and still is an option but I can't evaluate like you what is the good choice. I will look this framework :-) |
If you want to give it a try, start with QtCreator "new project" wizard, create some basic UI project with |
I will reply ina day or two. I cought flu and it's peeking now...
czw., 12 gru 2024, 22:11 użytkownik marcpley ***@***.***>
napisał:
… I create the project and add QTableView but I don't find QSqlTableModel in
the list:
Capture.d.ecran.du.2024-12-12.22-06-09.png (view on web)
<https://github.com/user-attachments/assets/8410cf6e-66af-4bed-aee6-92d9c3232f20>
Something is messing in my Qt ? Or do I have to declare manually and where
?
—
Reply to this email directly, view it on GitHub
<#5163 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADVUNVSOTNB5T7YSHOUM732FH3WVAVCNFSM6AAAAABTMDFBTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBQGAZDAMRYGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The model will not be in the palette. Palette is all about what you can see, while Q*Model is what data and how to pull form database and provide it to the view. If you go to https://doc.qt.io/qt-6/qsqltablemodel.html and scroll to like 15-20% of the page you will see example. |
I will add here few more hints:
This sets global "default" connection, which you can later get anywhere in the app by calling:
Generally, once you |
Thanks for that. I got the error : |
Oh, you need to open the *.pro file and there add:
Or if there is already a "CONFIG" line, then just append |
Do you need to execute this DDL from your application, or you just need a database with this view already created? It's actually the essential role of apps like SQLiteStudio to prepare database tables/views, which then are used by the end-user applications - like yours and that's why I'm asking, whether you should maybe create this view in SQLiteStudio and in your app you will just operate on existing view? Or maybe I misunderstand your intentions? |
I create all DB in SQLiteStudio and I create my app for the end-user.
|
Okay, so I guess your app needs to create database using SQL/DDL statements embedded in your app. Basically to execute arbitrary SQL you can use:
Now, to detect what version is user's database you can leverage the user_version PRAGMA: https://sqlite.org/pragma.html#pragma_user_version (by default it's 0 and you can detect and increment it as you upgrade your database version). |
At top of your file, just below
(note, that You can put this static QString in a separate *.h file and use This "VERSION_1_DDL" becomes a global QString variable. If you want to keep the DDL in external *.sql file and load it dynamically, you can do:
|
Thanks, I will try that :-) I access data with QTableView and QSqlTableModel. |
For foreign keys there is a |
Each of your indications save me time :-) I create class QPotaWidget derived from QWidget
I dynamically create QPotaWidget tabs in TabWidget:
My problem is here: currentWidget give a QWidget and don't know tv and model. |
The Btw. Maybe you want to setup your own GitHub repo and continue discussion there? I can tell you how to do it and we can transfer this issue (entire discussion) to your repo. |
I'm annoyed squatting your repo. |
It won't be longer nor more complex than trying to adapt SQLiteStudio to do things you need. Regarding git repo:
This is procedure for initial creation. Later you will do only 3 steps:
Optionally you can always use |
For the data-only-mode, ability to color rows according to the row's data
Priority to set cell color
1 selected cell -> selected cell color
2 same row of selected cell -> selected row color (#5078)
3 according to row's data and plugin parameters -> plugin parametred color
4 otherwise -> color depending of the column data type (#5078)
The row's colors parameter could be : if there is a field named XXX (ex: "Color") in the table/view, use the color code stored in (ex: #BF4040) to set the color of the row and hide the XXX column.
The text was updated successfully, but these errors were encountered: