forked from RealChuan/Qt-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
42 lines (32 loc) · 997 Bytes
/
mainwindow.cpp
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
#include "mainwindow.h"
#include "bubblewidget.h"
#include <QtWidgets>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupUI();
resize(370, 400);
}
void MainWindow::setupUI()
{
BubbleWidget *top = new BubbleWidget(this);
top->setTriangleInfo(20, 20);
top->setDerection(BubbleWidget::Top);
BubbleWidget *left = new BubbleWidget(this);
left->setTriangleInfo(20, 20);
left->setDerection(BubbleWidget::Left);
BubbleWidget *right = new BubbleWidget(this);
right->setTriangleInfo(20, 20);
right->setDerection(BubbleWidget::Right);
BubbleWidget *bottom = new BubbleWidget(this);
bottom->setTriangleInfo(20, 20);
bottom->setDerection(BubbleWidget::Bottom);
QWidget *widget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(widget);
layout->addWidget(top);
layout->addWidget(left);
layout->addWidget(right);
layout->addWidget(bottom);
setCentralWidget(widget);
}