From e55f15725ec9558bdca588c8a2cfe80f40fef5b7 Mon Sep 17 00:00:00 2001 From: bill Date: Sun, 14 Sep 2014 13:42:27 -0500 Subject: [PATCH] move buttons to bottom --- widget/form/settingswidget.cpp | 66 +++++++++++++++++++--------------- widget/form/settingswidget.h | 20 +++++------ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/widget/form/settingswidget.cpp b/widget/form/settingswidget.cpp index 6e2778de8..fcbd2a981 100644 --- a/widget/form/settingswidget.cpp +++ b/widget/form/settingswidget.cpp @@ -19,9 +19,35 @@ #include "ui_mainwindow.h" SettingsWidget::SettingsWidget() - : QObject() + : QWidget() { + _main = new QWidget(); main = new QWidget(); + head = new QWidget(); + foot = new QWidget(); + prepButtons(); + foot->setLayout(iconsLayout); + _mainLayout = new QVBoxLayout(_main); + _mainLayout->addWidget(main); + _mainLayout->addWidget(foot); + // something something foot size + _main->setLayout(_mainLayout); +} + +SettingsWidget::~SettingsWidget() +{ +} + +void SettingsWidget::show(Ui::MainWindow& ui) +{ + ui.mainContent->layout()->addWidget(_main); + ui.mainHead->layout()->addWidget(head); + _main->show(); + head->show(); +} + +void SettingsWidget::prepButtons() +{ // this crap is copied from ui_mainwindow.h... there's no easy way around // just straight up copying it like this... oh well // the layout/icons obviously need to be improved, but it's a working model, @@ -29,11 +55,9 @@ SettingsWidget::SettingsWidget() QSizePolicy sizePolicy3(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); - head = new QWidget(); - head->setObjectName(QStringLiteral("head")); - head->setEnabled(true); - sizePolicy3.setHeightForWidth(head->sizePolicy().hasHeightForWidth()); - head->setSizePolicy(sizePolicy3); + foot->setObjectName(QStringLiteral("foot")); + foot->setEnabled(true); + foot->setSizePolicy(sizePolicy3); QPalette palette5; QBrush brush(QColor(255, 255, 255, 255)); brush.setStyle(Qt::SolidPattern); @@ -96,14 +120,15 @@ SettingsWidget::SettingsWidget() palette5.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1); palette5.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush7); palette5.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush6); - head->setPalette(palette5); - head->setAutoFillBackground(true); - iconsLayout = new QHBoxLayout(head); + foot->setPalette(palette5); + foot->setAutoFillBackground(true); + + iconsLayout = new QHBoxLayout(foot); iconsLayout->setSpacing(0); iconsLayout->setObjectName(QStringLiteral("iconsLayout")); iconsLayout->setContentsMargins(0, 0, 0, 0); - generalButton = new QPushButton(head); + generalButton = new QPushButton(foot); generalButton->setObjectName(QStringLiteral("generalButton")); generalButton->setMinimumSize(QSize(55, 35)); generalButton->setMaximumSize(QSize(55, 35)); @@ -114,7 +139,7 @@ SettingsWidget::SettingsWidget() generalButton->setFlat(true); iconsLayout->addWidget(generalButton); - identityButton = new QPushButton(head); + identityButton = new QPushButton(foot); identityButton->setObjectName(QStringLiteral("identityButton")); identityButton->setMinimumSize(QSize(55, 35)); identityButton->setMaximumSize(QSize(55, 35)); @@ -125,7 +150,7 @@ SettingsWidget::SettingsWidget() identityButton->setFlat(true); iconsLayout->addWidget(identityButton); - privacyButton = new QPushButton(head); + privacyButton = new QPushButton(foot); privacyButton->setObjectName(QStringLiteral("privacyButton")); privacyButton->setMinimumSize(QSize(55, 35)); privacyButton->setMaximumSize(QSize(55, 35)); @@ -136,7 +161,7 @@ SettingsWidget::SettingsWidget() privacyButton->setFlat(true); iconsLayout->addWidget(privacyButton); - avButton = new QPushButton(head); + avButton = new QPushButton(foot); avButton->setObjectName(QStringLiteral("avButton")); avButton->setMinimumSize(QSize(55, 35)); avButton->setMaximumSize(QSize(55, 35)); @@ -146,19 +171,4 @@ SettingsWidget::SettingsWidget() avButton->setIcon(icon4); avButton->setFlat(true); iconsLayout->addWidget(avButton); - - head->setLayout(iconsLayout); - -} - -SettingsWidget::~SettingsWidget() -{ -} - -void SettingsWidget::show(Ui::MainWindow& ui) -{ - ui.mainContent->layout()->addWidget(main); - ui.mainHead->layout()->addWidget(head); - main->show(); - head->show(); } diff --git a/widget/form/settingswidget.h b/widget/form/settingswidget.h index a1cee909f..c901ce906 100644 --- a/widget/form/settingswidget.h +++ b/widget/form/settingswidget.h @@ -17,21 +17,15 @@ #ifndef SETTINGSWIDGET_H #define SETTINGSWIDGET_H -#include -#include -#include -#include -#include +#include #include -#include -#include - +#include #include "widget/croppinglabel.h" namespace Ui {class MainWindow;} class QString; -class SettingsWidget : public QObject +class SettingsWidget : public QWidget { Q_OBJECT public: @@ -46,7 +40,9 @@ public slots: private slots: private: - QWidget *main, *head; + QWidget *_main, *main, *head, *foot; + // _main consists of main+foot + QVBoxLayout *_mainLayout; // the code pertaining to the icons is mostly copied from ui_mainwindow.h QHBoxLayout *iconsLayout; QPushButton *generalButton; @@ -56,6 +52,10 @@ private: // now the actual pages and stuff // ... + + + + void prepButtons(); // just so I can move the crap to the bottom of the file public: };