PDA

View Full Version : How to put a checkbox or a widget into a QTableWidget header?



Dangelo
14th August 2013, 22:09
Hi guys, my objective is to put a checkbox in the header. To be more clear and easy to the User do the "SelectionAll" function

So I have this Widget, and I need to put a checkbox (or a widget with a checkbox) inside the red circle on the image.

9418

Thanxs.

ChrisW67
15th August 2013, 03:33
The corner button does "select all" and is enabled by default: QTableView::setCornerButtonEnabled().

Dangelo
16th August 2013, 20:26
The corner button does "select all" and is enabled by default: QTableView::setCornerButtonEnabled().
But I need to put a checkbox there to the User...I found that using the QTableView::setCornerWidget would solve my problem, but I don't know why, when I set the widget with the checkbox (like in the other lines of the table), nothing changes, the corner still remain blank :(

ChrisW67
16th August 2013, 21:06
The QAbstractScrollArea::setCornerWidget() call puts a widget in the corner between the scroll bars ( bottom right) and this is only visible if one or both scroll bars are. AFAICT there is no way to substitute your own widget for the select all button in the top left. The button already has the function of selecting everything and the items are highlighted when selected so there is feed back to the user. I don't see what adding a checkbox to control the same function will get you.

Dangelo
16th August 2013, 21:40
The QAbstractScrollArea::setCornerWidget() call puts a widget in the corner between the scroll bars ( bottom right) and this is only visible if one or both scroll bars are. AFAICT there is no way to substitute your own widget for the select all button in the top left. The button already has the function of selecting everything and the items are highlighted when selected so there is feed back to the user. I don't see what adding a checkbox to control the same function will get you.

Now I saw what ConerWidget() does...>:(.
My objective is (or was..) a look matter, several common programs here have a checkbox in the top left where the user can interact to do the selectAll function. So it's nice to present in a way which the user is familiar with, that makes the software be more intuitive.
Anyway thanxs for the support (:!

Dangelo
30th September 2013, 23:03
Hi, I found a solution to the problem, if anyone else is interested
96569657