From 44f48755200c7185fcae53e9e944e3a50e8806a5 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 31 May 2015 20:14:49 +0200 Subject: Remove magic number and fix QtVCardWidget::sizeHint This adds layout margin and spacing to the calculation of the correct size hint. Test-Information: Tested on OS X 10.9.5 with Qt 5.4.1. Change-Id: I7036f64a6621f5ce6603e77da26a887e28c663ca diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp index 71d4281..06d602a 100644 --- a/Swift/QtUI/QtProfileWindow.cpp +++ b/Swift/QtUI/QtProfileWindow.cpp @@ -116,7 +116,7 @@ void QtProfileWindow::hide() { } QSize QtProfileWindow::sizeHint() const { - return QWidget::sizeHint() + QSize(0, 15); + return QWidget::sizeHint(); } void QtProfileWindow::updateTitle() { diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index e202de5..79360d8 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -84,6 +84,12 @@ QSize QtVCardWidget::sizeHint() const { newSizeHint = QSize(std::max(newSizeHint.width(), fieldsWidgetSize.width()), newSizeHint.height() + fieldsWidgetSize.height()); + // add layout margin + newSizeHint += QSize(layout()->contentsMargins().left() + layout()->contentsMargins().right(), layout()->contentsMargins().top() + layout()->contentsMargins().bottom()); + + // the spaceing before and after the line between the profile header and its fields + newSizeHint += QSize(0, layout()->spacing() * 2); + return newSizeHint; } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui b/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui index 4fc8605..3a2997b 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui @@ -6,14 +6,17 @@ 0 0 - 535 - 126 + 239 + 102 Form - + + + 2 + 5 @@ -26,102 +29,99 @@ 5 - - - - 2 + + + + + 0 + 0 + - - QLayout::SetDefaultConstraint + + + + + + Qt::Horizontal - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - QFrame::NoFrame + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 229 + 77 + + + + + 0 + 0 + + + + + QLayout::SetMinAndMaxSize - - QFrame::Plain + + 0 - - Qt::ScrollBarAlwaysOff + + 0 - - true + + 0 - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + 0 - - - - 0 - 0 - 523 - 110 - - - - - 0 - 0 - - - - - QLayout::SetMinAndMaxSize - - - 0 - - - 0 + + + + + + + Qt::Vertical - - 0 + + QSizePolicy::Expanding - - 0 + + + 0 + 0 + - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 1000 - - - - - - - - - + + + + + -- cgit v0.10.2-6-g49f6