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 int main(int argc, char** argv)
15 {
16  QApplication app(argc, argv);
17  QLabel lbl;
18 
19  lbl.setPixmap(QPixmap(":/happyos.png"));
20 
21  QGraphicsColorizeEffect effect;
22  lbl.setGraphicsEffect(&effect);
23 
24  QPropertyAnimation anim(&effect, "color");
25  anim.setStartValue(QColor(Qt::gray));
26  anim.setKeyValueAt(0.25f, QColor(Qt::green));
27  anim.setKeyValueAt(0.5f, QColor(Qt::blue));
28  anim.setKeyValueAt(0.75f, QColor(Qt::red));
29  anim.setEndValue(QColor(Qt::black));
30  anim.setDuration(3000);
31  anim.setLoopCount(-1);
32  anim.start();
33 
34  lbl.show();
35 
36  return app.exec();
37 }
38 
QLabel * lbl(const QPainter::CompositionMode &mode)
Definition: main.cpp:14
int main(int argc, char **argv)
Definition: main.cpp:15