From 37ce7cff650a0928a904f1a3ef5578f519e9dfae Mon Sep 17 00:00:00 2001 From: Andrew Mustun Date: Wed, 31 Aug 2016 15:09:26 +0200 Subject: [PATCH] fix FS#1466 - Toolbars on second screen cannot be accessed if second screen is detached --- src/core/RMainWindow.cpp | 11 ----------- src/gui/RMainWindowQt.cpp | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/core/RMainWindow.cpp b/src/core/RMainWindow.cpp index 03e49eb4b7..636ef2059a 100644 --- a/src/core/RMainWindow.cpp +++ b/src/core/RMainWindow.cpp @@ -717,17 +717,6 @@ bool RMainWindow::readSettings() { ret = true; } - // get total available width on all screens: - int totalWidth = 0; - for (int i=0; iscreenCount(); i++) { - totalWidth+=QApplication::desktop()->availableGeometry(0).width(); - } - - // sanity check for x: - if (x>totalWidth-100) { - move(100, y); - } - resize(width, height); return ret; } diff --git a/src/gui/RMainWindowQt.cpp b/src/gui/RMainWindowQt.cpp index b9e16d7be0..0e95d7ce7f 100644 --- a/src/gui/RMainWindowQt.cpp +++ b/src/gui/RMainWindowQt.cpp @@ -17,6 +17,7 @@ * along with QCAD. */ #include +#include #include #include #include @@ -482,6 +483,26 @@ bool RMainWindowQt::readSettings() { statusBar()->hide(); } + // get total available width on all screens: + int totalWidth = 0; + for (int i=0; iscreenCount(); i++) { + totalWidth+=QApplication::desktop()->availableGeometry(i).width(); + } + + // sanity check for x: + if (x()>totalWidth-100) { + move(totalWidth-width(), y()); + } + + // make sure all tool bars are visible: + QList tbs = findChildren(); + for (int i=0; ix()>totalWidth-50) { + tb->move(totalWidth - tb->width(), tb->y()); + } + } + return ret; }