-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
56 lines (48 loc) · 1.12 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "mainwindow.h"
#include "ui_mainwindow.h"
//#include "view.h"
//MainWindow::MainWindow(const short plane)
MainWindow::MainWindow()
: viewArea(new QGraphicsView)
{
ui->setupUi(this);
//isUntitled = true;
viewArea = new QGraphicsView;
scene = new QGraphicsScene(0, 0, this->x(), this->y(), this);
viewArea->setScene(scene);
//setCentralWidget(view);
setCentralWidget(viewArea);
}
MainWindow::~MainWindow()
{
}
void MainWindow::SetPlane(const short plane)
{
m_plane = plane;
}
void MainWindow::ShowSlice(size_t slice)
{
scene->clear();
if (m_plane == XYPLANE)
{
setWindowTitle("XY");
image = QPixmap(":/images/XY.png");
}
else if (m_plane == YZPLANE)
{
setWindowTitle("YZ");
image = QPixmap(":/images/YZ.png");
}
else
{
setWindowTitle("XZ");
image = QPixmap(":/images/XZ.png");
}
scene->addPixmap(image);
scene->update();
auto width = image.width();
auto height = image.height();
viewArea->resize(width,height);
viewArea->resize(scene->width(),scene->height());
viewArea->update();
}