Multiple column headers
-
wrote on 7 Mar 2022, 19:34 last edited by
Hi everyone,
I'm trying to recreate this table in PyQt5 using both QDesigner and handcoding:
Could anyone share any direction on how to get multiple columns into 'one'?
Looking specifically at Created/Expiry date. Not sure how to recreate this, I'm using a Table View widget and pulling from my sqlite database/table.Kind regards,
Jude -
Hi,
Possibly with QStyledItemDelegate or maybe a proxy model.
Is it just to visualize the data or also edit it ?
-
Hi,
Possibly with QStyledItemDelegate or maybe a proxy model.
Is it just to visualize the data or also edit it ?
wrote on 7 Mar 2022, 20:42 last edited by@SGaist thanks, I'll read up on that documentation, appreciate the response!
The data is to be edited via line edits and buttons, sort of leads me to another question if you don't mind.
I've been pulling from my model to populate my field edits like this:
Which has been working fine, however not sure if I'm inserting to my model in the best way:
I noticed looking through the documentation of QSqlRecord, not sure if I should be building QSqlRecords and then inserting into the table?So I guess my question is, is there a better way to tie line edit's directly to a model field? As in, explicitly?
Either way, I appreciate your response and I'll look through that documentation for sure.
-
If you have a custom widget to edit your entries, then QDataWidgetMapper is your friend.
-
If you have a custom widget to edit your entries, then QDataWidgetMapper is your friend.
wrote on 7 Mar 2022, 20:56 last edited by@SGaist that looks like exactly what I'm after, thanks again!
-
wrote on 8 Mar 2022, 03:24 last edited by
The effect can be achieved by directly overwriting the widget on the header。More complex interactions can also be implemented。I refer to this page:
https://www.qt.io/blog/2012/09/28/qt-support-weekly-27-widgets-on-a-header
1/6