Qt 5.10 Book Examples
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 QLabel* lbl(QGraphicsEffect* pge)
15 {
16  QLabel* plbl = new QLabel;
17  plbl->setPixmap(QPixmap(":/happyos.png"));
18 
19  if (pge) {
20  plbl->setGraphicsEffect(pge);
21  }
22  return plbl;
23 }
24 
25 // ----------------------------------------------------------------------
26 int main(int argc, char** argv)
27 {
28  QApplication app(argc, argv);
29  QWidget wgt;
30  QGraphicsBlurEffect* pBlur = new QGraphicsBlurEffect;
31  QGraphicsDropShadowEffect* pShadow = new QGraphicsDropShadowEffect;
32  QGraphicsColorizeEffect* pColorize = new QGraphicsColorizeEffect;
33 
34  //Layout Setup
35  QFormLayout* pform = new QFormLayout;
36  pform->addRow("No Effects", lbl(0));
37  pform->addRow("Blur", lbl(pBlur));
38  pform->addRow("Drop Shadow", lbl(pShadow));
39  pform->addRow("Colorize", lbl(pColorize));
40  wgt.setLayout(pform);
41 
42  wgt.show();
43 
44  return app.exec();
45 }
QLabel * lbl(const QPainter::CompositionMode &mode)
Definition: main.cpp:14
int main(int argc, char **argv)
Definition: main.cpp:15