Den 29 jan 2016 4:47 fm skrev "Nicolas Jäger" <[email protected]>: > > Hi > I have a `QTreeView`, I control the background colors of items trough a css. When the pointer is > over an item his background is greyed. > > I use the signal `entered` to detect which item, aka `QModelIndex`, aka row, is hovered. If I use > that signal, is because I have to show a `QPushButton` over a part of the row, the position of the > button is at the very right of the row though. > > If no row is hovered, then the button is hidden. > > The click event is related trough the actual hovered row. > > so far so good, all is working but one thing, the background color. When I move the pointer over > the button, the treeview set the row behind the button to "not hovered". I used the paint function > in the past, but because of some narrow minded people forcing me to set the background in the > css stylesheet, I'm facing that issue... > > using the attribute `WA_TransparentForMouseEvents` can't help since I need to click on the button. > > so any idea, is welcome.
This is just a random guess, and would probably be a hacky solution, but maybe you can override mouseMoveEvent on your button (subclass QPushButton), and in the event handler also send a mouseMoveEvent to the item under the button (using QcoreApplication::sendEvent? , before calling the base class implementation? On the phone now so haven't checked if this is at all doable, just an idea. Elvis > > I don't know if it can be helpful, but the `QTreeView` is inherited to MyTreeView, and this class > contains the `QPushButton` > > > regards, > Nicolas > _______________________________________________ > Interest mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
