Unsolved How to auto resize widget height when dragged to a smaller monitor ?
-
@QtVik Do you use layouts?
-
This post is deleted! -
This post is deleted! -
@jsulm
Basically I have created several QWidget/QGLWidget as plugins in my Qt application.
It is possible to dock/undock these widgets.
When I undock any of these widgets I can move it to another screen individually.Note: I do not use Qt designer here.
-
@QtVik ,
Hi, you can try like this,void Widget::moveEvent(QMoveEvent * e)
{
m_newScreenSize = qApp->desktop()->screenGeometry(this);
}
void Widget::mouseReleaseEvent(QMouseEvent * e)
{
this->resize(m_newScreenSize);
} -
@Vinod-Kuntoji
I tried it but the issue still persists.
Mouse release event gets invoked only when you mouse click in widget area but not in title bar of the widget.
I am trying to move the widget holding on widget's title bar area.Above changes doesn't make any difference in behavior(still the window height is too tall for the smaller screen).
Thanks
-
@QtVik ,
Have you given any fixed sizes to widgets? -
@Vinod-Kuntoji
No.. I haven't set any fixed size widget! -
@QtVik ,
Please show the sample code..
-
The title bar is not the region of the
QWidget
. Because it is a Window's region, it can not be implemented usingQEvent
.
UsenativeEvent ()
. If you are on Windows, you can use messages likeWM_NCLBUTTONDOWN
. -
Thank you guys!
It worked for me. Actually i was handling mousePress event in the titleBar class which i had to update in my main class through widgetFocusEvent.
@Vinod-Kuntoji: Your input helped me a lot.Thank you.
-
@Devopia53 @Vinod-Kuntoji :
Sorry the problem is still not solved :( thats why i marked it as unsolved again !As I move the widget to smaller monitor the title bar is getting hidden.
How to reset the position of the widget while moving to second screen ?
Example: The top border of my widget that i am moving from bigger monitor should align with top border of the smaller monitor. Now it is getting hidden unfortunately.
-
@QtVik
Please show your code so we can see
what you did with nativeEvent()Also what titleBar class ??
Are you using custom border and caption ? -
@mrjj I haven't done anything using nativeEvent() yet. Will try it and update.