Hey there,
I'm specifiying a mask using setMask on my main Widget.
Graphicaly It's working fine.
The only problem is the fact that I loose the window control for resizing.
Is it possible to enable it back?
Thanks.
Printable View
Hey there,
I'm specifiying a mask using setMask on my main Widget.
Graphicaly It's working fine.
The only problem is the fact that I loose the window control for resizing.
Is it possible to enable it back?
Thanks.
Could you explain? What do you mean you lose control for resizing? You mask out the corner?
Yes,
I've masked the borders and the corners.
I guess the behaviour I'd like to optain is : even if the borders and corners are hidden, still process the user's event like stretching and resizing.
Resizing by dragging from window decoration is provided by the underlying window system, not by Qt. So unfortunately, if you mask the decoration out, you're on your own. You can try to make use of QSizeGrip.
Are you sure there is no simpler way ?
Anybody reimplemented the resize window algorithm on a QWidget ?
What's more simple than placing a QSizeGrip into each corner (possibly with help of QGridLayout) and voilá? Optionally you can subclass QSizeGrip and reimplement its paintEvent() handler to draw nothing. I mean, QSizeGrip provides resizing functionality into each direction out of the box.
Give it a try:
Code:
// main.cpp #include <QtGui> { public: MaskWindow() { grid->setSpacing(0); grid->setMargin(0); } protected: { setMask(rect()); } }; int main(int argc, char *argv[]) { MaskWindow w; w.show(); return a.exec(); }
That's exactly what I just coded :).
But,
It's only working for the corners of the widget, not for the sides.
So there is more work to do to completely emulate the window's behaviour.
That's right. You might want to take a peek into QSizeGrip sources for implementation tips. ;)