File: createpixmapfromhandletest.cpp

package info (click to toggle)
kf6-kwindowsystem 6.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,292 kB
  • sloc: cpp: 18,421; ansic: 35; makefile: 11; sh: 1
file content (26 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
    This file is part of the KDE libraries
    SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>

    SPDX-License-Identifier: LGPL-2.1-or-later
*/

#include <QApplication>
#include <QCommandLineParser>
#include <QLabel>
#include <kx11extras.h>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QCommandLineParser parser;
    parser.addPositionalArgument(QStringLiteral("WId"), QStringLiteral("window id for the window to take the icon from"), QStringLiteral("[WId]"));
    parser.addHelpOption();
    parser.process(app);
    QLabel label;
    label.setMinimumSize(250, 250);
    label.show();
    QString wId = parser.positionalArguments().first();
    label.setPixmap(KX11Extras::icon(wId.toULongLong(nullptr, 0), 250, 250, false, KX11Extras::WMHints));
    return app.exec();
}