qt-material-widgets/mainwindow.cpp

77 lines
1.9 KiB
C++
Raw Normal View History

2016-03-18 14:21:45 +00:00
#include <QVBoxLayout>
#include <QPushButton>
2016-03-19 10:48:17 +00:00
#include <QMenu>
#include <QMenuBar>
2016-03-19 08:27:32 +00:00
#include <QLabel>
2016-03-18 14:21:45 +00:00
#include "mainwindow.h"
2016-03-19 11:07:25 +00:00
#include "components/flatbutton.h"
#include "components/iconbutton.h"
#include "components/appbar.h"
2016-03-18 14:21:45 +00:00
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
2016-03-19 10:48:17 +00:00
QMenu *components = new QMenu("Components");
components->addAction("AppBar");
QMenu *buttons = new QMenu("Buttons");
components->addMenu(buttons);
buttons->addAction("FlatButton");
buttons->addAction("IconButton");
2016-03-19 10:57:05 +00:00
components->addAction("Tabs");
2016-03-19 10:48:17 +00:00
menuBar()->addMenu(components);
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2016-03-18 14:21:45 +00:00
QVBoxLayout *layout = new QVBoxLayout;
QWidget *widget = new QWidget;
widget->setLayout(layout);
setCentralWidget(widget);
2016-03-19 08:53:49 +00:00
AppBar *appBar = new AppBar;
layout->addWidget(appBar);
2016-03-18 14:21:45 +00:00
QPushButton *button1 = new QPushButton("Test #1");
layout->addWidget(button1);
FlatButton *flatButton = new FlatButton;
flatButton->setText("My button");
2016-03-18 19:44:23 +00:00
2016-03-19 07:54:00 +00:00
QIcon icon("../qt-material-widgets/face.svg");
flatButton->setIcon(icon);
flatButton->setIconSize(QSize(64, 64));
2016-03-18 14:21:45 +00:00
layout->addWidget(flatButton);
2016-03-19 07:54:00 +00:00
2016-03-19 08:27:32 +00:00
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
QHBoxLayout *hLayout = new QHBoxLayout;
QLabel *label = new QLabel("Hello");
label->setMaximumHeight(32);
2016-03-19 07:54:00 +00:00
IconButton *iconButton = new IconButton(icon);
iconButton->setText("My button sis afdadsfadsf adsfasdf");
iconButton->setIconSize(QSize(32, 32));
2016-03-19 08:27:32 +00:00
hLayout->addWidget(iconButton);
hLayout->addWidget(label);
layout->addLayout(hLayout);
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2016-03-18 14:21:45 +00:00
QPushButton *button2 = new QPushButton("Test #2");
layout->addWidget(button2);
2016-03-19 07:54:00 +00:00
button2->setIcon(icon);
2016-03-19 10:48:17 +00:00
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2016-03-18 14:21:45 +00:00
}
MainWindow::~MainWindow()
{
}