Qt 5.10 Book Examples
chapter08
Buttons
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
18
QWidget wgt;
19
QPushButton* pcmdNormal =
new
QPushButton(
"&Normal Button"
);
20
21
QPushButton* pcmdToggle =
new
QPushButton(
"&Toggle Button"
);
22
pcmdToggle->setCheckable(
true
);
23
pcmdToggle->setChecked(
true
);
24
25
QPushButton* pcmdFlat =
new
QPushButton(
"&Flat Button"
);
26
pcmdFlat->setFlat(
true
);
27
28
QPixmap pix(
":/ChordsMaestro.png"
);
29
QPushButton* pcmdPix =
new
QPushButton (
"&Pixmap Button"
);
30
pcmdPix->setIcon(pix);
31
pcmdPix->setIconSize(pix.size());
32
33
//Layout setup
34
QVBoxLayout* pvbxLayout =
new
QVBoxLayout;
35
pvbxLayout->addWidget(pcmdNormal);
36
pvbxLayout->addWidget(pcmdToggle);
37
pvbxLayout->addWidget(pcmdFlat);
38
pvbxLayout->addWidget(pcmdPix);
39
wgt.setLayout(pvbxLayout);
40
41
wgt.show();
42
43
return
app.exec();
44
}
main
int main(int argc, char **argv)
Definition:
main.cpp:15
Generated by
1.8.14