Unsolved Can't move and resize QDialog
-
I have a BaseClass derived from QDialog and a ChildClass derived from BaseClass.
I create an instance of ChildClass und call child.exec();
In the BaseClass I override the showEvent. There I call:
this->setGeometry(QRect(20, 20, 200, 200)); QDialog::showEvent(event);
I can do what ever I want, the Dialog shows always maximized.
I'm completely stumped.
What is wrong with the code? -
Hi,
What version of Qt ?
On what platform ?
Why are you setting the geometry inshowEvent
?
What else are you doing with that dialog ? -
Qt Creator 4.6.2
Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)
From revision 1ddfb443b6
Built on Jun 18 2018 11:52:18
LibGL Vendor: Intel Inc.
Renderer: Intel Iris Pro OpenGL Engine
Version: 2.1 INTEL-12.4.7
Shading language: 1.20
Format: Version: 2.1 Profile: 0 Swap behavior: 2 Buffer size (RGB): 8,8,8 Depth buffer: -1 Stencil buffer: -1
Profile: None (QOpenGLFunctions_214771104_1)
Qt 5.11.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 8.1.0 (clang-802.0.42) (Apple)) on "cocoa"
OS: macOS 10.14 [darwin version 18.2.0]
Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2
Features: QT_NO_EXCEPTIONS QT_NO_OPENSSLThe App is running at iOS 12.1.4 (16D57)
@SGaist said in Can't move and resize QDialog:
Why are you setting the geometry in
showEvent
?What do you mean, is this no good idea to do it there?
What else are you doing with that dialog ?
It is a simply information dialog for the user, such like a message box. It is not necessary to show it as a maximized (full screen) window
-
@peter-70 said in Can't move and resize QDialog:
Qt Creator 4.6.2
Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)That's the version of Qt used to build Qt Creator not the one you are using to build your application.
While the QtWidgets module can be used on iOS, it's not designed for it. You will have better results with QtQuick.
That said, why are you setting the geometry of the dialog ? They usually handle their size pretty well.