Skip to content

Commit

Permalink
fix FS#1466 - Toolbars on second screen cannot be accessed if second
Browse files Browse the repository at this point in the history
screen is detached
  • Loading branch information
qcad committed Aug 31, 2016
1 parent 080429e commit 37ce7cf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/core/RMainWindow.cpp
Expand Up @@ -717,17 +717,6 @@ bool RMainWindow::readSettings() {
ret = true;
}

// get total available width on all screens:
int totalWidth = 0;
for (int i=0; i<QApplication::desktop()->screenCount(); i++) {
totalWidth+=QApplication::desktop()->availableGeometry(0).width();
}

// sanity check for x:
if (x>totalWidth-100) {
move(100, y);
}

resize(width, height);
return ret;
}
Expand Down
21 changes: 21 additions & 0 deletions src/gui/RMainWindowQt.cpp
Expand Up @@ -17,6 +17,7 @@
* along with QCAD.
*/
#include <QtGui>
#include <QDesktopWidget>
#include <QLabel>
#include <QMenu>
#include <QMdiArea>
Expand Down Expand Up @@ -482,6 +483,26 @@ bool RMainWindowQt::readSettings() {
statusBar()->hide();
}

// get total available width on all screens:
int totalWidth = 0;
for (int i=0; i<QApplication::desktop()->screenCount(); 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<QToolBar*> tbs = findChildren<QToolBar*>();
for (int i=0; i<tbs.length(); i++) {
QToolBar* tb = tbs[i];
if (tb->x()>totalWidth-50) {
tb->move(totalWidth - tb->width(), tb->y());
}
}

return ret;
}

Expand Down

0 comments on commit 37ce7cf

Please sign in to comment.