Currently I've made a subclass of labels called "clickLabels" that has clicks pass through it.
-This is because I have labels "covering" my buttons
-Which is because the button seems to push an icon image out of it's way if you also have text for the button
Now that I'm done with my first iteration of this design (or close enough); I'm reflecting on what I may have missed as I get up to speed on all things Qt.
My question is "is this functionality redundant?" I could see it being either way. I went this direction because labels seemed to "absorb" clicks no matter what properties I applied to them; so to make them "transparent" (so the button is clicked) I did this:
{
//stop tracking the mouse so it's free to grab. Might be unnecessary.
releaseMouse();
//tell others we've been pressed and hand off the MouseEvent
emit pressed(e);
}
void clickLabel::mousePressEvent(QMouseEvent *e)
{
//stop tracking the mouse so it's free to grab. Might be unnecessary.
releaseMouse();
//tell others we've been pressed and hand off the MouseEvent
emit pressed(e);
}
To copy to clipboard, switch view to plain text mode
and implemented:
{
//track the mouse cursor
grabMouse();
//deliver the mouse press to ourselves as if it were ours to begin with
mousePressEvent(e);
}
void aniButton::stealMousePress(QMouseEvent *e)
{
//track the mouse cursor
grabMouse();
//deliver the mouse press to ourselves as if it were ours to begin with
mousePressEvent(e);
}
To copy to clipboard, switch view to plain text mode
(I grab the mouse for other reasons.) The idea should be obvious by now; and now i"m just curious if it was done in error because the functionality already exists. I.E. did I go reinvent the wheel?
Bookmarks