Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.2.1
-
None
-
OSX 10.9.1
Qt5.2.1
Description
When in the shorter of two monitors laid side by side, the vertical coordinate system seems to be counting from the top of the larger screen, with the smaller one positioned as linked to the bottom of the larger screen. This leads to widgets being shifted upwards from where they ought to be.
Example, modified main.cpp from new QtCreator QtQuick Application based project:
#include <QtGui/QGuiApplication> #include "qtquick2applicationviewer.h" #include <QScreen> #include <QDir> QString adjustPath(const QString &path) { #if defined(Q_OS_IOS) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("%1/%2") .arg(QCoreApplication::applicationDirPath(), path); #elif defined(Q_OS_MAC) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("%1/../Resources/%2") .arg(QCoreApplication::applicationDirPath(), path); #elif defined(Q_OS_BLACKBERRY) if (!QDir::isAbsolutePath(path)) return QString::fromLatin1("app/native/%1").arg(path); #elif !defined(Q_OS_ANDROID) QString pathInInstallDir = QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); if (QFileInfo(pathInInstallDir).exists()) return pathInInstallDir; pathInInstallDir = QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); if (QFileInfo(pathInInstallDir).exists()) return pathInInstallDir; #elif defined(Q_OS_ANDROID_NO_SDK) return QLatin1String("/data/user/qt/") + path; #endif return path; } int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); /** QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/Test/main.qml")); viewer.showExpanded(); **/ QQuickView* mainWindow = new QQuickView(); mainWindow->setSource(QUrl(adjustPath("qml/Test/main.qml"))); QRect a = mainWindow->screen()->availableGeometry(); QRect r = mainWindow->frameGeometry(); // r.moveCenter(a.center()); // this positions the window higher than center in the smaller screen r.moveCenter(a.center() - QPoint(0, mainWindow->screen()->availableGeometry().height() - mainWindow->screen()->virtualGeometry().height())); // this positions the window correctly in the center of the smaller screen mainWindow->setPosition(r.topLeft()); mainWindow->show(); return app.exec(); }
Attachments
Issue Links
- is replaced by
-
QTBUG-36672 Mac OS: Regression: Dialog positions are much farther up than expected when multiple monitors are used
- Closed