aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-05-25 13:58:48 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-25 17:42:35 -0700
commit7d1df992fae41241266dc068cefb1f2c2670c745 (patch)
treebcc163002bddba554448ae440fd01e81dedfd8ea
parent0fdb87b011c4980bd403bb6b224e328b279f002e (diff)
downloadsubsurface-7d1df992fae41241266dc068cefb1f2c2670c745.tar.gz
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>
-rw-r--r--qt-ui/mainwindow.cpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1e3a89dbc..3ba79ef94 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -163,36 +163,7 @@ MainWindow::MainWindow() : QMainWindow(),
memset(&copyPasteDive, 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"));