Qt 5.10 Book Examples
chapter26
CSSStyle
main.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// main.cpp
3
// ======================================================================
4
// This file is a part of the book
5
// "Qt 5.10 Professional programming with C++"
6
// http://qt-book.com
7
// ======================================================================
8
// Copyright (c) 2017 by Max Schlee
9
// ======================================================================
10
11
#include <QtWidgets>
12
13
// ----------------------------------------------------------------------
14
int
main
(
int
argc,
char
** argv)
15
{
16
QApplication app(argc, argv);
17
QWidget wgt;
18
19
QPushButton* pcmdA =
new
QPushButton(
"Button1"
);
20
QPushButton* pcmdB =
new
QPushButton(
"Button2"
);
21
QPushButton* pcmdC =
new
QPushButton(
"Button3"
);
22
23
//Layout setup
24
QVBoxLayout* pvbxLayout =
new
QVBoxLayout;
25
pvbxLayout->addWidget(pcmdA);
26
pvbxLayout->addWidget(pcmdB);
27
pvbxLayout->addWidget(pcmdC);
28
wgt.setLayout(pvbxLayout);
29
30
QFile file(
":/style/simple.qss"
);
31
file.open(QFile::ReadOnly);
32
QString strCSS = QLatin1String(file.readAll());
33
34
qApp->setStyleSheet(strCSS);
35
wgt.show();
36
37
return
app.exec();
38
}
main
int main(int argc, char **argv)
Definition:
main.cpp:15
Generated by
1.8.14