blob: 23f30b9524c5a312776ef5c191e5791d7f475173 (
plain)
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
|
//-------------------------------------------------
// Created by q5sys (JT)
// Released under MIT License 2017-03-08
// A Simple GUI Dialog Program
//-------------------------------------------------
#include <QApplication>
#include <QMessageBox>
#include <QDebug>
#include <QTextStream>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
int answer;
QMessageBox *messageBox = new QMessageBox;
messageBox->setText(argv[1]);
QPushButton *pushButtonOk = messageBox->addButton(argv[2], QMessageBox::AcceptRole);
QPushButton *pushButtonNo = messageBox->addButton(argv[3], QMessageBox::RejectRole);
messageBox->QDialog::setWindowTitle(argv[4]);
messageBox->show();
if(messageBox->exec() == QMessageBox::AcceptRole){ answer = 0; QTextStream cout(stdout); cout << answer;}
else { answer = 1; QTextStream cout(stdout); cout << answer;}
}
|