summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAdasauce <adasauce@with.parts>2020-02-20 12:31:07 -0400
committerAdasauce <adasauce@with.parts>2020-02-20 12:31:07 -0400
commit8aaf7e9e5d80bf54395793bab9218261419bd0ed (patch)
tree85084384c742a3100804648b88351556ae6579b8 /src
parentClean up variable format (diff)
downloadnheko-8aaf7e9e5d80bf54395793bab9218261419bd0ed.tar.xz
Remove constant width, that was wrong.
Use Nico's suggestion to just leverage the width of the field, and leave
a comment.
Diffstat (limited to 'src')
-rw-r--r--src/UserSettingsPage.cpp10
-rw-r--r--src/UserSettingsPage.h5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp

index 73da0169..63dcffbd 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp
@@ -437,10 +437,16 @@ UserSettingsPage::resizeEvent(QResizeEvent *event) { auto preWidth = width(); - if (preWidth * 0.5 > LayoutMinWidth) + // based on the width of the widest item currently in the layout + // deviceFingerprintValue_ used for recalculating the margins of + // the formLayout_ on resize to help with small screens and mobile devices. + + double minFormWidth = deviceFingerprintValue_->width(); + + if (preWidth * 0.5 > minFormWidth) sideMargin_ = preWidth * 0.25; else - sideMargin_ = static_cast<double>(preWidth - LayoutMinWidth) / 2.; + sideMargin_ = static_cast<double>(preWidth - minFormWidth) / 2.; if (sideMargin_ < 60) sideMargin_ = 0; diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h
index 2b588412..ef8258b6 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h
@@ -33,11 +33,6 @@ constexpr int OptionMargin = 6; constexpr int LayoutTopMargin = 50; constexpr int LayoutBottomMargin = LayoutTopMargin; -// based on the width of the widest item currently in the layout (deviceFingerprintValue_) -// used for recalculating the margins of the formLayout_ on resize to help with small screens and -// mobile devices. -constexpr int LayoutMinWidth = 385; - class UserSettings : public QObject { Q_OBJECT