File: kpixmapregionselectordialogtest.cpp

package info (click to toggle)
kwidgetsaddons 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,836 kB
  • sloc: cpp: 32,526; python: 677; sh: 14; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (2)
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
27
28
29
30
/*
    This file is part of the KDE libraries
    SPDX-FileCopyrightText: 2004 Antonio Larrosa <larrosa@kde.org>

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

#include "kpixmapregionselectordialog.h"
#include <QApplication>
#include <QFile>
#include <QImage>
#include <QPixmap>
#include <iostream>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    if (argc <= 1) {
        std::cerr << "Usage: kpixmapregionselectordialogtest <imageFile>" << std::endl;
        return 1;
    }

    QPixmap pix(QFile::decodeName(argv[1]));
    QImage image = KPixmapRegionSelectorDialog::getSelectedImage(pix, 100, 100);
    image.save(QStringLiteral("output.png"), "PNG");

    return 0;
}