-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfallingfigures.cpp
64 lines (41 loc) · 1.71 KB
/
fallingfigures.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "fallingfigures.h"
#include "ui_fallingfigures.h"
FallingFigures::FallingFigures(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::FallingFigures)
{
ui->setupUi(this);
Scene* scene=new Scene(300,400);
ui->graphicsView->setScene(scene);
ui->graphicsView->setRenderHint(QPainter::Antialiasing,true); //сглаживание
//scene->create_frame_of_scene();
ui->graphicsView->scale(1,-1);
// ui->radioButton_Circle->pressed();
// ui->radioButton_Circle->setChecked(true);
QObject::connect(ui->clearButton , SIGNAL(clicked()), scene, SLOT(refresh()));
//----выбор фигуры
but_rect=new QRadioButton("Rect");
but_ellipse=new QRadioButton("Circle");
QButtonGroup *but_group=new QButtonGroup(this);
but_group->addButton(but_rect);
but_group->addButton(but_ellipse);
// but_ellipse->setChecked(true);
ui->verticalLayout->addWidget(but_rect);
ui->verticalLayout->addWidget(but_ellipse);
ui->verticalLayout->addWidget(ui->clearButton);
QObject::connect(but_rect, SIGNAL (clicked()), this, SLOT (select_radbutton()));
QObject::connect(but_ellipse, SIGNAL (clicked()), this, SLOT (select_radbutton()));
QObject::connect(this, SIGNAL(selected_radbutton(ShapeType)), scene , SLOT(select_figure(ShapeType)));
but_ellipse->click();
//----
}
FallingFigures::~FallingFigures()
{
delete ui;
}
void FallingFigures::paintEvent(QPaintEvent *event)
{
//ui->verticalLayout->setGeometry(tmp_rect);
ui->graphicsView->setGeometry(5,15,this->width()-100, this->height()-35);
ui->verticalLayoutWidget->setGeometry(ui->graphicsView->width()+15,15, 80, 100);
}