1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

move buttons to bottom

This commit is contained in:
bill 2014-09-14 13:42:27 -05:00 committed by Tux3 / Mlkj / !Lev.uXFMLA
parent e4e36dc946
commit e55f15725e
2 changed files with 48 additions and 38 deletions

View File

@ -19,9 +19,35 @@
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
SettingsWidget::SettingsWidget() SettingsWidget::SettingsWidget()
: QObject() : QWidget()
{ {
_main = new 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 // this crap is copied from ui_mainwindow.h... there's no easy way around
// just straight up copying it like this... oh well // just straight up copying it like this... oh well
// the layout/icons obviously need to be improved, but it's a working model, // 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); QSizePolicy sizePolicy3(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
sizePolicy3.setHorizontalStretch(0); sizePolicy3.setHorizontalStretch(0);
sizePolicy3.setVerticalStretch(0); sizePolicy3.setVerticalStretch(0);
head = new QWidget(); foot->setObjectName(QStringLiteral("foot"));
head->setObjectName(QStringLiteral("head")); foot->setEnabled(true);
head->setEnabled(true); foot->setSizePolicy(sizePolicy3);
sizePolicy3.setHeightForWidth(head->sizePolicy().hasHeightForWidth());
head->setSizePolicy(sizePolicy3);
QPalette palette5; QPalette palette5;
QBrush brush(QColor(255, 255, 255, 255)); QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern); brush.setStyle(Qt::SolidPattern);
@ -96,14 +120,15 @@ SettingsWidget::SettingsWidget()
palette5.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1); palette5.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush1);
palette5.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush7); palette5.setBrush(QPalette::Disabled, QPalette::ToolTipBase, brush7);
palette5.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush6); palette5.setBrush(QPalette::Disabled, QPalette::ToolTipText, brush6);
head->setPalette(palette5); foot->setPalette(palette5);
head->setAutoFillBackground(true); foot->setAutoFillBackground(true);
iconsLayout = new QHBoxLayout(head);
iconsLayout = new QHBoxLayout(foot);
iconsLayout->setSpacing(0); iconsLayout->setSpacing(0);
iconsLayout->setObjectName(QStringLiteral("iconsLayout")); iconsLayout->setObjectName(QStringLiteral("iconsLayout"));
iconsLayout->setContentsMargins(0, 0, 0, 0); iconsLayout->setContentsMargins(0, 0, 0, 0);
generalButton = new QPushButton(head); generalButton = new QPushButton(foot);
generalButton->setObjectName(QStringLiteral("generalButton")); generalButton->setObjectName(QStringLiteral("generalButton"));
generalButton->setMinimumSize(QSize(55, 35)); generalButton->setMinimumSize(QSize(55, 35));
generalButton->setMaximumSize(QSize(55, 35)); generalButton->setMaximumSize(QSize(55, 35));
@ -114,7 +139,7 @@ SettingsWidget::SettingsWidget()
generalButton->setFlat(true); generalButton->setFlat(true);
iconsLayout->addWidget(generalButton); iconsLayout->addWidget(generalButton);
identityButton = new QPushButton(head); identityButton = new QPushButton(foot);
identityButton->setObjectName(QStringLiteral("identityButton")); identityButton->setObjectName(QStringLiteral("identityButton"));
identityButton->setMinimumSize(QSize(55, 35)); identityButton->setMinimumSize(QSize(55, 35));
identityButton->setMaximumSize(QSize(55, 35)); identityButton->setMaximumSize(QSize(55, 35));
@ -125,7 +150,7 @@ SettingsWidget::SettingsWidget()
identityButton->setFlat(true); identityButton->setFlat(true);
iconsLayout->addWidget(identityButton); iconsLayout->addWidget(identityButton);
privacyButton = new QPushButton(head); privacyButton = new QPushButton(foot);
privacyButton->setObjectName(QStringLiteral("privacyButton")); privacyButton->setObjectName(QStringLiteral("privacyButton"));
privacyButton->setMinimumSize(QSize(55, 35)); privacyButton->setMinimumSize(QSize(55, 35));
privacyButton->setMaximumSize(QSize(55, 35)); privacyButton->setMaximumSize(QSize(55, 35));
@ -136,7 +161,7 @@ SettingsWidget::SettingsWidget()
privacyButton->setFlat(true); privacyButton->setFlat(true);
iconsLayout->addWidget(privacyButton); iconsLayout->addWidget(privacyButton);
avButton = new QPushButton(head); avButton = new QPushButton(foot);
avButton->setObjectName(QStringLiteral("avButton")); avButton->setObjectName(QStringLiteral("avButton"));
avButton->setMinimumSize(QSize(55, 35)); avButton->setMinimumSize(QSize(55, 35));
avButton->setMaximumSize(QSize(55, 35)); avButton->setMaximumSize(QSize(55, 35));
@ -146,19 +171,4 @@ SettingsWidget::SettingsWidget()
avButton->setIcon(icon4); avButton->setIcon(icon4);
avButton->setFlat(true); avButton->setFlat(true);
iconsLayout->addWidget(avButton); 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();
} }

View File

@ -17,21 +17,15 @@
#ifndef SETTINGSWIDGET_H #ifndef SETTINGSWIDGET_H
#define SETTINGSWIDGET_H #define SETTINGSWIDGET_H
#include <QVBoxLayout> #include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QObject>
#include <QCheckBox>
#include <QPushButton> #include <QPushButton>
#include <QTextEdit> #include <QObject>
#include <QComboBox>
#include "widget/croppinglabel.h" #include "widget/croppinglabel.h"
namespace Ui {class MainWindow;} namespace Ui {class MainWindow;}
class QString; class QString;
class SettingsWidget : public QObject class SettingsWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -46,7 +40,9 @@ public slots:
private slots: private slots:
private: 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 // the code pertaining to the icons is mostly copied from ui_mainwindow.h
QHBoxLayout *iconsLayout; QHBoxLayout *iconsLayout;
QPushButton *generalButton; QPushButton *generalButton;
@ -56,6 +52,10 @@ private:
// now the actual pages and stuff // now the actual pages and stuff
// ... // ...
void prepButtons(); // just so I can move the crap to the bottom of the file
public: public:
}; };