h-4nd-h
4 years ago
7 changed files with 167 additions and 6 deletions
@ -1,11 +1,21 @@ |
|||
#include "mainwindow.h" |
|||
|
|||
#include <QApplication> |
|||
#include <QStyle> |
|||
#include <QDesktopWidget> |
|||
|
|||
int main(int argc, char *argv[]) |
|||
{ |
|||
QApplication a(argc, argv); |
|||
MainWindow w; |
|||
w.setGeometry( |
|||
QStyle::alignedRect( |
|||
Qt::LeftToRight, |
|||
Qt::AlignCenter, |
|||
w.size(), |
|||
qApp->desktop()->availableGeometry() |
|||
) |
|||
); |
|||
w.show(); |
|||
return a.exec(); |
|||
} |
|||
|
@ -0,0 +1,50 @@ |
|||
#include "waitdialog.h" |
|||
#include "ui_waitdialog.h" |
|||
|
|||
#include <QTimer> |
|||
#include <QDebug> |
|||
|
|||
WaitDialog::WaitDialog(QWidget *parent) : |
|||
QDialog(parent), |
|||
ui(new Ui::WaitDialog) |
|||
{ |
|||
ui->setupUi(this); |
|||
|
|||
_timer = new QTimer(); |
|||
|
|||
connect(_timer, &QTimer::timeout, this, &WaitDialog::timeout); |
|||
|
|||
_timer->start(250); |
|||
|
|||
setText(); |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
WaitDialog::~WaitDialog() |
|||
{ |
|||
delete ui; |
|||
|
|||
delete _timer; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
void WaitDialog::timeout() |
|||
{ |
|||
setText(); |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
void WaitDialog::setText() |
|||
{ |
|||
QString str = "Please wait"; |
|||
|
|||
for(auto i = 0; i < _state; i++) |
|||
str += "."; |
|||
|
|||
_state++; |
|||
|
|||
if(_state > 3) |
|||
_state = 0; |
|||
|
|||
ui->l_text->setText(str); |
|||
} |
@ -0,0 +1,30 @@ |
|||
#ifndef WAITDIALOG_H |
|||
#define WAITDIALOG_H |
|||
|
|||
#include <QDialog> |
|||
|
|||
namespace Ui { |
|||
class WaitDialog; |
|||
} |
|||
|
|||
class WaitDialog : public QDialog |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit WaitDialog(QWidget *parent = nullptr); |
|||
~WaitDialog(); |
|||
|
|||
private slots: |
|||
void timeout(); |
|||
|
|||
private: |
|||
Ui::WaitDialog *ui; |
|||
QTimer* _timer; |
|||
|
|||
int _state; |
|||
|
|||
void setText(); |
|||
}; |
|||
|
|||
#endif // WAITDIALOG_H
|
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>WaitDialog</class> |
|||
<widget class="QDialog" name="WaitDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>219</width> |
|||
<height>102</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Dialog</string> |
|||
</property> |
|||
<widget class="QLabel" name="l_text"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>60</x> |
|||
<y>40</y> |
|||
<width>121</width> |
|||
<height>17</height> |
|||
</rect> |
|||
</property> |
|||
<property name="font"> |
|||
<font> |
|||
<pointsize>12</pointsize> |
|||
</font> |
|||
</property> |
|||
<property name="text"> |
|||
<string>TextLabel</string> |
|||
</property> |
|||
</widget> |
|||
</widget> |
|||
<resources/> |
|||
<connections/> |
|||
</ui> |
Loading…
Reference in new issue