mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
a6a76fbffd
commit
66c2d3d9da
1 changed files with 20 additions and 0 deletions
|
@ -135,6 +135,26 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
QLayoutItem *p = ui.gridLayout->takeAt(0);
|
QLayoutItem *p = ui.gridLayout->takeAt(0);
|
||||||
ui.gridLayout->addWidget(toolBar, 0, 0);
|
ui.gridLayout->addWidget(toolBar, 0, 0);
|
||||||
ui.gridLayout->addItem(p, 0, 1);
|
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);
|
updateManager = new UpdateManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue