File indexing completed on 2024-04-14 03:57:04

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #include <QApplication>
0009 #include <QCommandLineParser>
0010 #include <QLabel>
0011 #include <kx11extras.h>
0012 
0013 int main(int argc, char **argv)
0014 {
0015     QApplication app(argc, argv);
0016     QCommandLineParser parser;
0017     parser.addPositionalArgument(QStringLiteral("WId"), QStringLiteral("window id for the window to take the icon from"), QStringLiteral("[WId]"));
0018     parser.addHelpOption();
0019     parser.process(app);
0020     QLabel label;
0021     label.setMinimumSize(250, 250);
0022     label.show();
0023     QString wId = parser.positionalArguments().first();
0024     label.setPixmap(KX11Extras::icon(wId.toULongLong(nullptr, 0), 250, 250, false, KX11Extras::WMHints));
0025     return app.exec();
0026 }