diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-01-05 16:47:57 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-01-05 15:57:06 +0000 |
commit | b5fe909571aff02bbd3d6cba8865c8eef36de9c7 (patch) | |
tree | f9b0b4ca795c5b9fd003d0e6ce717df214d46953 | |
parent | e19cea07c1b98eeff3d77cf13abe3a6a482f2cf3 (diff) |
testcon: Better adapt to High DPI screens.
Resize main window and select dialog according to
available screen size.
Task-number: QTBUG-50206
Change-Id: I66fa527dceb19fab87ac84ee3063f5b84e487fb4
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | src/activeqt/container/qaxselect.cpp | 4 | ||||
-rw-r--r-- | src/activeqt/container/qaxselect.ui | 8 | ||||
-rw-r--r-- | tools/testcon/main.cpp | 4 | ||||
-rw-r--r-- | tools/testcon/mainwindow.ui | 8 |
4 files changed, 8 insertions, 16 deletions
diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp index ff56dc3..b091b1c 100644 --- a/src/activeqt/container/qaxselect.cpp +++ b/src/activeqt/container/qaxselect.cpp @@ -47,6 +47,7 @@ #include <QtCore/QSysInfo> #include <QtCore/QTextStream> #include <QtCore/QRegExp> +#include <QtWidgets/QDesktopWidget> #include <QtWidgets/QPushButton> #include <qt_windows.h> @@ -289,6 +290,9 @@ QAxSelect::QAxSelect(QWidget *parent, Qt::WindowFlags flags) d->selectUi.setupUi(this); d->setOkButtonEnabled(false); + const QRect availableGeometry = QApplication::desktop()->availableGeometry(this); + resize(availableGeometry.width() / 4, availableGeometry.height() * 2 / 3); + #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif diff --git a/src/activeqt/container/qaxselect.ui b/src/activeqt/container/qaxselect.ui index 25b8490..0ec11c1 100644 --- a/src/activeqt/container/qaxselect.ui +++ b/src/activeqt/container/qaxselect.ui @@ -41,14 +41,6 @@ *********************************************************************</comment> <class>QAxSelect</class> <widget class="QDialog" name="QAxSelect"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>439</width> - <height>326</height> - </rect> - </property> <property name="windowTitle"> <string>Select ActiveX Control</string> </property> diff --git a/tools/testcon/main.cpp b/tools/testcon/main.cpp index dd6dc82..863a9e4 100644 --- a/tools/testcon/main.cpp +++ b/tools/testcon/main.cpp @@ -38,6 +38,7 @@ #include <QCommandLineParser> #include <QCommandLineOption> #include <QDebug> +#include <QDesktopWidget> QAXFACTORY_DEFAULT(MainWindow, QLatin1String("{5f5ce700-48a8-47b1-9b06-3b7f79e41d7c}"), @@ -87,6 +88,9 @@ int main( int argc, char **argv ) } if (parser.isSet(scriptOption)) mw.loadScript(parser.value(scriptOption)); + + const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mw); + mw.resize(availableGeometry.size() * 2 / 3); mw.show(); return app.exec();; diff --git a/tools/testcon/mainwindow.ui b/tools/testcon/mainwindow.ui index da39df5..979092d 100644 --- a/tools/testcon/mainwindow.ui +++ b/tools/testcon/mainwindow.ui @@ -38,14 +38,6 @@ <property name="objectName" > <string notr="true" >MainWindow</string> </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>929</width> - <height>620</height> - </rect> - </property> <property name="windowTitle" > <string>ActiveX Control Test Container</string> </property> |