Warning, file /frameworks/kwidgetsaddons/tests/kmessageboxwidtest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2013 Aurélien Gâteau <agateau@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 #include <iostream> 0008 0009 #include <kmessagebox.h> 0010 0011 #include <QApplication> 0012 0013 int main(int argc, char **argv) 0014 { 0015 QApplication::setApplicationName(QStringLiteral("kmessageboxwidtest")); 0016 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); 0017 QApplication app(argc, argv); 0018 if (argc != 2) { 0019 std::cerr << "Usage: " << qPrintable(QApplication::applicationName()) << " <window id>\n"; 0020 std::cerr << '\n'; 0021 std::cerr << "You can get a window id using a tool like `xwininfo`.\n"; 0022 return 1; 0023 } 0024 0025 bool ok; 0026 int winId = QByteArray(argv[1]).toInt(&ok, 0); 0027 if (!ok) { 0028 std::cerr << '"' << argv[1] << "\" is not a number\n"; 0029 return 1; 0030 } 0031 0032 int ret = KMessageBox::warningContinueCancelWId(winId, QStringLiteral("Are you sure you want to continue?"), QStringLiteral("Dangerous stuff")); 0033 0034 std::cout << "Returned " << ret << '\n'; 0035 return ret; 0036 }