Enygma
30th August 2007, 15:55
Me again :p
I`m just trying to find out if this is a bug or not :)
Ok, here it goes:
I have QPushButtons on a QFrame and a stylesheet for the buttons for the normal state and the :hover state, the last adding a border-image to the button.
QPushButton {
image: url(:/images/userLocation.png);
image-position: center center;
border-image: url();
}
QPushButton:hover {
border-image: url(:/images/button_active.png);
}
All goes well untill I add a popup as a CustomContextMenu to the buttons, called with the customContextMenuRequested( const QPoint & ) signal.
When the popup is called, it shows correctly but if I right-click on another one of these buttons, the popup goes away as it should, the second button gets hovered and the border-image is applied to it, but the first button never gets to unset it's border-image, and come back to it's display it should have when not hovered.
In other words, i end up with two hovered-looking buttons.
If I repeat the process and right click on the QFrame this time, it's the same thing, they both remain hovered, menu is gone.
If I leave the QFrame with the mouse, the buttons get reset and go back to their normal look.
After trying different approaches I tried giving the QPushButton that requested a context menu a repaint right when the popup is aboutToHide().
It worked! Now when the popup hides, the old right-clicked QPushButton looks normal.
Is this normal? Shouldn't this repaint get called automatically? That would sound logical to me.
P.S.: I use a QPushButton* to remember which button requested a context menu, maybe qt doesn't and there for, does not know where to call repaint? :confused:
Cheers!
I`m just trying to find out if this is a bug or not :)
Ok, here it goes:
I have QPushButtons on a QFrame and a stylesheet for the buttons for the normal state and the :hover state, the last adding a border-image to the button.
QPushButton {
image: url(:/images/userLocation.png);
image-position: center center;
border-image: url();
}
QPushButton:hover {
border-image: url(:/images/button_active.png);
}
All goes well untill I add a popup as a CustomContextMenu to the buttons, called with the customContextMenuRequested( const QPoint & ) signal.
When the popup is called, it shows correctly but if I right-click on another one of these buttons, the popup goes away as it should, the second button gets hovered and the border-image is applied to it, but the first button never gets to unset it's border-image, and come back to it's display it should have when not hovered.
In other words, i end up with two hovered-looking buttons.
If I repeat the process and right click on the QFrame this time, it's the same thing, they both remain hovered, menu is gone.
If I leave the QFrame with the mouse, the buttons get reset and go back to their normal look.
After trying different approaches I tried giving the QPushButton that requested a context menu a repaint right when the popup is aboutToHide().
It worked! Now when the popup hides, the old right-clicked QPushButton looks normal.
Is this normal? Shouldn't this repaint get called automatically? That would sound logical to me.
P.S.: I use a QPushButton* to remember which button requested a context menu, maybe qt doesn't and there for, does not know where to call repaint? :confused:
Cheers!