Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtGui>
5
6int main(int argc, char *argv[])
7{
8 QApplication app(argc, argv);
10 QLabel topLevelLabel;
11 QPixmap pixmap(":/images/tux.png");
12 topLevelLabel.setPixmap(pixmap);
13 topLevelLabel.setMask(pixmap.mask());
15 topLevelLabel.show();
16 return app.exec();
17}
The QApplication class manages the GUI application's control flow and main settings.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
The QLabel widget provides a text or image display.
Definition qlabel.h:20
void setPixmap(const QPixmap &)
Definition qlabel.cpp:339
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
QBitmap mask() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false.
void setMask(const QBitmap &)
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible.
void show()
Shows the widget and its child widgets.
Definition qwidget.cpp:7956
int main()
[0]
QPixmap pixmap(":/splash.png")
QApplication app(argc, argv)
[0]