This repository was archived by the owner on Jul 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdialog.cpp
More file actions
65 lines (55 loc) · 1.28 KB
/
dialog.cpp
File metadata and controls
65 lines (55 loc) · 1.28 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "dialog.h"
#include "ui_dialog.h"
#include "qdragablewidget.h"
#include "dlgshow.h"
#include <QBoxLayout>
#include "qflowlayout.h"
QFlowLayout* pFlow = NULL;
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
this->setWindowFlag(Qt::WindowMinMaxButtonsHint, true);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_pushButton_clicked()
{
// widget
QDragableWidget* pShow = new QDragableWidget(this);
pShow->setGeometry(0,0,300,300);
pShow->show();
DlgShow* pReal = new DlgShow(pShow);
pShow->setContent(pReal);
if(pFlow)
pFlow->addWidget(pShow);
}
void Dialog::on_pushButton_2_clicked()
{
if( pFlow == NULL ){
pFlow = new QFlowLayout();
QRect rc = this->rect();
rc.adjust(5,50,-5,0);
ui->frame->setGeometry(rc);
pFlow->setGeometry(rc);
ui->frame->setLayout(pFlow);
}
}
void Dialog::on_pushButton_3_clicked()
{
if(pFlow)
pFlow->takeAt(0);
}
void Dialog::on_pushButton_4_clicked()
{
static int index = 0;
if( pFlow ){
QPushButton* btn = new QPushButton(QString(u8"Btn-%1").arg(++index));
QRect rc(0,0,60+rand()%40, 40+rand()%60);
btn->setGeometry(rc);
pFlow->addWidget(btn);
}
}