mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Layout issues: Remove auto layout management from mainwindow.cpp
While this worked for a bit, it was very error prone as it relied in layout having specific names, and layouts in the .ui files are treated as substandard items. Every time a 'break layout' command is issues (and it's issued quite a lot when trying to reorganize the items on the widget) all layout items are removed and new ones are added later, without any of the names. Since the new layout can be different the old names are not usefull anymore - and a clean compilation won't trigger a single warning either: the name resolution is done at runtime and not at compile time, so it would just fail silently. Instead of brute-forcing each layout to have 0,0 or 5,5 margins, we should put the correct values on the .ui files. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0fdb87b011
commit
7d1df992fa
1 changed files with 0 additions and 29 deletions
|
@ -163,36 +163,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
memset(©PasteDive, 0, sizeof(copyPasteDive));
|
||||
memset(&what, 0, sizeof(what));
|
||||
|
||||
|
||||
// and now for some layout hackery
|
||||
// this gets us consistent margins everywhere and a much more balanced look
|
||||
QMargins margins(5, 5, 5, 5);
|
||||
QMargins zeroMargins(0, 0, 0, 0);
|
||||
QList<QString> noMarginList;
|
||||
noMarginList << "notesAndSocialNetworksLayout" <<
|
||||
"coordinatesDiveTypeLayout" <<
|
||||
"mainTabOuterLayout" <<
|
||||
"ratingVisibilityWidgets" <<
|
||||
"temperatureLabels" <<
|
||||
"airWaterTempLayout" <<
|
||||
"fullWindowLayout" <<
|
||||
"profileOuterLayout";
|
||||
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 (noMarginList.contains(layout->objectName()))
|
||||
layout->setContentsMargins(zeroMargins);
|
||||
else
|
||||
layout->setContentsMargins(margins);
|
||||
}
|
||||
toolBar->setContentsMargins(zeroMargins);
|
||||
|
||||
updateManager = new UpdateManager(this);
|
||||
|
||||
undoStack = new QUndoStack(this);
|
||||
QAction *undoAction = undoStack->createUndoAction(this, tr("&Undo"));
|
||||
QAction *redoAction = undoStack->createRedoAction(this, tr("&Redo"));
|
||||
|
|
Loading…
Add table
Reference in a new issue