Qt MSSQL check box
-
I am using MSSQL and have a field for if the record is currently active or not that is bit data type. How can I make this show up as a check box instead of it wanting the user to type in a number?
Also, I am using QSqlTableModel and QTableView if that matters.
-
Use a proxy model. There are examples on the wiki on how to build proxy models that do similar things.
-
Do you know anywhere that has an example of it and explains it? Becuase everything I've found explains what the class can do and has some generic code but I don't know where I'd put it in my code or anything like that.
Thanks for your help
-
Well, the code for my own "checkable proxy model":/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox contains a complete example on how to use it. Did you take a look at that? It will show you where to put what piece of code. Using the "CheckableSortFilterProxyModel":/wiki/QSortFilterProxyModel_subclass_for_readonly_columns_columns_with_checkboxes_and_password_columns isn't all that different.
On using a bitfield instead of a boolean: if you only need a single bit from that bitfield (integer, I guess) to display a single checkbox, then that would be a simple change. Creating several columns of checkboxes (one for each bit in the field) is going to be more involved... Which do you need?
-
I need a single feild for each row just to show if the record is active or not, then it will be filtered on that, where only the checked/actives ones are shown unless a checkbox on my window is checked then all the records will be shown.
-
I had seen your code but only that 1st page I just now found the sample project. I dont have a tree though I am just pulling in a database from SQL so hopefully that will make it simpler and I currently have the field I need to be the checkbox set as a bit type.