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 31 32 33 34 35 36
|
/*
This file is part of the KDE libraries
SPDX-FileCopyrightText: 2013 Aurélien Gâteau <agateau@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include <iostream>
#include <kmessagebox.h>
#include <QApplication>
int main(int argc, char **argv)
{
QApplication::setApplicationName(QStringLiteral("kmessageboxwidtest"));
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QApplication app(argc, argv);
if (argc != 2) {
std::cerr << "Usage: " << qPrintable(QApplication::applicationName()) << " <window id>\n";
std::cerr << '\n';
std::cerr << "You can get a window id using a tool like `xwininfo`.\n";
return 1;
}
bool ok;
int winId = QByteArray(argv[1]).toInt(&ok, 0);
if (!ok) {
std::cerr << '"' << argv[1] << "\" is not a number\n";
return 1;
}
int ret = KMessageBox::warningContinueCancelWId(winId, QStringLiteral("Are you sure you want to continue?"), QStringLiteral("Dangerous stuff"));
std::cout << "Returned " << ret << '\n';
return ret;
}
|