annotate Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp @ 320:10d188d6e5cc am-2

compatibility with Qt4
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Oct 2018 14:38:48 +0200
parents daa04d15192c
children 56b2e47d3c0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
1 /**
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
6 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
11 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
16 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
19 **/
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
20
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
21 #include "SimpleViewerMainWindow.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
22
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
23 /**
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
24 * Don't use "ui_MainWindow.h" instead of <ui_MainWindow.h> below, as
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
25 * this makes CMake unable to detect when the UI file changes.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
26 **/
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
27 #include <ui_SimpleViewerMainWindow.h>
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
28 #include "../SimpleViewerApplication.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
29
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
30 namespace SimpleViewer
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
31 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
32
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
33 SimpleViewerMainWindow::SimpleViewerMainWindow(OrthancStone::NativeStoneApplicationContext& context, SimpleViewerApplication& stoneApplication, QWidget *parent) :
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
34 QStoneMainWindow(context, parent),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
35 ui_(new Ui::SimpleViewerMainWindow),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
36 stoneApplication_(stoneApplication)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
37 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
38 ui_->setupUi(this);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
39 SetCentralStoneWidget(ui_->cairoCentralWidget);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
40
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
41 #if QT_VERSION >= 0x050000
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
42 connect(ui_->toolButtonCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::cropClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
43 connect(ui_->toolButtonLine, &QToolButton::clicked, this, &SimpleViewerMainWindow::lineClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
44 connect(ui_->toolButtonCircle, &QToolButton::clicked, this, &SimpleViewerMainWindow::circleClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
45 connect(ui_->toolButtonWindowing, &QToolButton::clicked, this, &SimpleViewerMainWindow::windowingClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
46 connect(ui_->pushButtonRotate, &QPushButton::clicked, this, &SimpleViewerMainWindow::rotateClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
47 connect(ui_->pushButtonInvert, &QPushButton::clicked, this, &SimpleViewerMainWindow::invertClicked);
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
48 #else
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
49 connect(ui_->toolButtonCrop, SIGNAL(clicked()), this, SLOT(cropClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
50 connect(ui_->toolButtonLine, SIGNAL(clicked()), this, SLOT(lineClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
51 connect(ui_->toolButtonCircle, SIGNAL(clicked()), this, SLOT(circleClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
52 connect(ui_->toolButtonWindowing, SIGNAL(clicked()), this, SLOT(windowingClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
53 connect(ui_->pushButtonRotate, SIGNAL(clicked()), this, SLOT(rotateClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
54 connect(ui_->pushButtonInvert, SIGNAL(clicked()), this, SLOT(invertClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
55 #endif
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
56 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
57
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
58 SimpleViewerMainWindow::~SimpleViewerMainWindow()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
59 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
60 delete ui_;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
61 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
62
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
63 void SimpleViewerMainWindow::cropClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
64 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
65 GenericNoArgCommand command("selectTool:crop");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
66 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
67 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
68
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
69 void SimpleViewerMainWindow::lineClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
70 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
71 GenericNoArgCommand command("selectTool:line-measure");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
72 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
73 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
74
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
75 void SimpleViewerMainWindow::circleClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
76 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
77 GenericNoArgCommand command("selectTool:circle-measure");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
78 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
79 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
80
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
81 void SimpleViewerMainWindow::windowingClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
82 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
83 GenericNoArgCommand command("selectTool:windowing");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
84 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
85 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
86
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
87 void SimpleViewerMainWindow::rotateClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
88 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
89 GenericNoArgCommand command("action:rotate");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
90 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
91 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
92
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
93 void SimpleViewerMainWindow::invertClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
94 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
95 GenericNoArgCommand command("action:invert");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
96 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
97 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
98 }