mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-29 18:37:41 +08:00
test QtFiber demo
This commit is contained in:
parent
baa76b07d9
commit
c29d1bd199
@ -1,6 +1,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "inputdialog.h"
|
||||
|
||||
InputDialog::InputDialog(QWidget *parent) : QDialog(parent)
|
||||
InputDialog::InputDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Http Options: ");
|
||||
setGeometry(200, 200, 600, 400);
|
||||
|
@ -11,7 +11,7 @@ class InputDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InputDialog(QWidget *parent = nullptr);
|
||||
explicit InputDialog(QWidget *parentr);
|
||||
|
||||
signals:
|
||||
void dialogAccepted(const QString &text);
|
||||
|
@ -237,14 +237,22 @@ void MainWindow::onStopSchedule()
|
||||
|
||||
void MainWindow::onHttpOptions()
|
||||
{
|
||||
InputDialog dialog(this);
|
||||
QRect mainWindowGeometry = this->frameGeometry();
|
||||
QPoint mainWindowPos = this->pos();
|
||||
int x = mainWindowPos.x() + (mainWindowGeometry.width() - dialog.width()) / 2;
|
||||
int y = mainWindowPos.y() + (mainWindowGeometry.height() - dialog.height()) / 2;
|
||||
dialog.move(x, y);
|
||||
connect(&dialog, &InputDialog::dialogAccepted, this, &MainWindow::onDialogAccepted);
|
||||
dialog.exec();
|
||||
go[this] {
|
||||
qDebug() << "Sleep 5 seconds before starting http options dialog";
|
||||
acl::fiber::delay(5000);
|
||||
|
||||
InputDialog dialog(this);
|
||||
QRect mainWindowGeometry = this->frameGeometry();
|
||||
QPoint mainWindowPos = this->pos();
|
||||
int x = mainWindowPos.x() + (mainWindowGeometry.width() - dialog.width()) / 2;
|
||||
int y = mainWindowPos.y() + (mainWindowGeometry.height() - dialog.height()) / 2;
|
||||
dialog.move(x, y);
|
||||
connect(&dialog, &InputDialog::dialogAccepted, this, &MainWindow::onDialogAccepted);
|
||||
qDebug() << "Start the http options dialog!";
|
||||
dialog.exec();
|
||||
qDebug() << "Http options dialog stopped!";
|
||||
};
|
||||
qDebug() << "Waiting for the results of http options";
|
||||
}
|
||||
|
||||
void MainWindow::onDialogAccepted(const QString &text)
|
||||
|
Loading…
Reference in New Issue
Block a user