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
parent 55437df210
commit 741824c019
2 changed files with 48 additions and 38 deletions

View File

@ -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();
}

View File

@ -17,21 +17,15 @@
#ifndef SETTINGSWIDGET_H
#define SETTINGSWIDGET_H
#include <QVBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QObject>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QPushButton>
#include <QTextEdit>
#include <QComboBox>
#include <QObject>
#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:
};