movable columns for customheaderview
-
hi,
I have a customheader class that I created by subclassing QHeaderview as above.
I made this view inspired by the link below, I'm sure you know this link.
linkHow can I change the order of the columns by dragging the labels in the table that looks like the picture above?
I know that I need to use events such as drop event, drag for these. But which class should I apply these events to exactly?
For example, if I apply it in the HeaderView class, the drop event function on the labels does not seem to work. -
Hi,
Do you mean that QHeaderView::setSectionsMovable does not work for you ?
-
I would try setting the transparent for mouse property on the label.
That said, wouldn't it have been lighter to implement a custom header view rather than use labels ?
-
@SGaist said in movable columns for customheaderview:
I would try setting the transparent for mouse property on the label.
This seems to work partially. but still not very convenient. because the labels don't move while dragging and the title names seem to be dragged in the background. and the first column title never moves.
@SGaist said in movable columns for customheaderview:
That said, wouldn't it have been lighter to implement a custom header view rather than use labels ?
I already did this by creating a custom customheaderview.
I can share the code if you want.
In the form of setheader(myheaderview)...How can I get a signal from labels in an array with connect?
example: QMap<int , QLabel> labelsmap. // it has 10 labels -
@Nevez said in movable columns for customheaderview:
How can I get a signal from labels in an array with connect?
Just connect them? Not sure what your issue us.
example: QMap<int , QLabel> labelsmap. // it has 10 labels
You will want
QLabel *
, notQLabel
.QWidget
s only live where you actually place them in the UI. You can't (and would not want to) copy them, so you can only deal in pointers to the actual widget.