Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_gui_kernel_qaction.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 <QApplication>
5#include <QAction>
6#include <QIcon>
7
8int main(int argc, char **argv)
9{
10 QIcon SomeIcon(":/path/to/icon.png");
11
12 //! [0]
13 QApplication app(argc, argv);
14 app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are *no longer shown* in menus
15 // ...
16 QAction *myAction = new QAction();
17 // ...
18 myAction->setIcon(SomeIcon);
19 myAction->setIconVisibleInMenu(true); // Icon *will* be shown in menus for *this* action.
20 //! [0]
21}
int main(int argc, char *argv[])
[ctor_close]