-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.cpp
More file actions
46 lines (39 loc) · 1.08 KB
/
widget.cpp
File metadata and controls
46 lines (39 loc) · 1.08 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
#include "widget.h"
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QSlider>
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
view = new QGraphicsView;
scene = new tethraScene;
layout = new QVBoxLayout;
view->setScene(scene);
layout->addWidget(view);
xSlider = new QSlider(Qt::Horizontal);
xSlider->setRange(-90, 90);
xSlider->setSingleStep(1);
xSlider->setPageStep(10);
xSlider->setTickInterval(10);
xSlider->setTickPosition(QSlider::TicksBelow);
ySlider = createSlider();
layout->addWidget(xSlider);
layout->addWidget(ySlider);
this->setLayout(layout);
connect(xSlider, SIGNAL(valueChanged(int)), scene, SLOT(rotateOX(int)));
connect(ySlider, SIGNAL(valueChanged(int)), scene, SLOT(rotateOY(int)));
this->resize(QSize(500,600));
}
QSlider *Widget::createSlider()
{
QSlider *slider = new QSlider(Qt::Horizontal);
slider->setRange(-180, 180);
slider->setSingleStep(1);
slider->setPageStep(10);
slider->setTickInterval(10);
slider->setTickPosition(QSlider::TicksBelow);
return slider;
}
Widget::~Widget()
{
}