Hello,
Any know how to move a Frameless QDialog?
And can you please post a example code..
Note:
the QDialog i have is filled with Qwidgets.so mouse click event will set the focus on to Qwidget. not the Qdialog..
Thank you..
Hello,
Any know how to move a Frameless QDialog?
And can you please post a example code..
Note:
the QDialog i have is filled with Qwidgets.so mouse click event will set the focus on to Qwidget. not the Qdialog..
Thank you..
Last edited by deepal_de; 25th May 2011 at 09:09.
Use this to move the dialog around:
Qt Code:
To copy to clipboard, switch view to plain text mode
deepal_de (25th May 2011)
use an even filter.the QDialog i have is filled with Qwidgets.so mouse click event will set the focus on to Qwidget. not the Qdialog..
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
deepal_de (25th May 2011)
thanks for the reply...
this not the kind of example i had in mind, but thanks anywayvoid QWidget::move ( int x, int y )
here i have to calculate the mouse point offset know??
that means if the user click middle of the dialog,
i have to get the point of the mouse click and and mapToGloble,
get the difference between the mouse click point and the form location..
and do the math and then move the dialog...
for this i have to catch the mouse press event and release event know..
i was wondering if there is some other simple way to do this..
any built-in mechanism to help move frame-less dialogs??
You welcome, simple answer (for me) to a simple question.
Yes, I'm afraid that if you remove the borders and title bar you have to implement everything by yourself.
Easiest might be to create your own title bar as a widget and then reimplement the mouse event handlers of that widget. Or use the event filter instead of reimplementing.
deepal_de (26th May 2011)
No, you will have to implement it your self, and frame less windows, by definition are not meant to be moved (usually used for splash screens), since there is no way to "hold" them, since they don't have a frame.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
deepal_de (26th May 2011)
Thanks for the reply's.....
Qt Code:
int iXdeffarace = -1; int iYdeffarance = -1; bool b_mousePressed; { b_mousePressed = true; iXdeffarace = qpMousePressedPoint.x() - qpApploc.x(); iYdeffarance = qpMousePressedPoint.y() - qpApploc.y(); } //******************************************************** { b_mousePressed = false; } //******************************************************** { if(b_mousePressed) { this->setProperty("pos", qpAppNewLoc); } }To copy to clipboard, switch view to plain text mode
Bookmarks