diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-01-02 12:39:56 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-02 22:24:50 -0800 |
commit | 66c2d3d9daab5d073dcc65d4a6279ea55ac6b6b0 (patch) | |
tree | 428316c05cacaf8a1851f6c6f133d1081db01b66 /qt-ui | |
parent | a6a76fbffdc7352bac26585a9f6fa96fd8b7119c (diff) | |
download | subsurface-66c2d3d9daab5d073dcc65d4a6279ea55ac6b6b0.tar.gz |
Set up consistent margins in the various layouts
The hard coded margins were random and inconsistent and generally ended up
with a rather unbalanced look. This was worse on Mac than on other
platforms, as there the margins get exaggerated for some reason.
This code is a bit of a hack and a bit brute force, but it seems to work
to create a much more pleasing appearance. It may need some fine tuning
(depending on OS or DE (under Linux)), but it definitely seems like a
massive improvement.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 8703fc38a..03f93a64d 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -135,6 +135,26 @@ MainWindow::MainWindow() : QMainWindow(), QLayoutItem *p = ui.gridLayout->takeAt(0); ui.gridLayout->addWidget(toolBar, 0, 0); ui.gridLayout->addItem(p, 0, 1); + + // and now for some layout hackery + // this gets us consistent margins everywhere and a much more balanced look + QMargins margins(5, 5, 5, 5); + QList<QString> dontChange; + dontChange << "notesAndSocialNetworksLayout" << ui.gridLayout->objectName(); + Q_FOREACH (QLayout *layout, findChildren<QLayout *>()) { + // lots of internally used layouts by Qt have no names + // don't mess with those (or scroll bars look terrible, among other things + if (layout->objectName().isEmpty()) + continue; + // this allows us to exclude specific layouts where the one size fits all + // doesn't fit + if (dontChange.contains(layout->objectName())) + continue; + layout->setContentsMargins(margins); + } + margins = QMargins(0, 5, 5, 5); + ui.gridLayout->setContentsMargins(margins); + updateManager = new UpdateManager(this); } |