Mercurial > hg > orthanc-stone
annotate Applications/Samples/Qt/SampleMainWindowWithButtons.cpp @ 871:4bc8d9609447
Added support for measuring tool edition in TrackerSampleApp
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 25 Jun 2019 18:17:33 +0200 |
parents | b70e9be013e4 |
children | 2d8ab34c8c91 |
rev | line source |
---|---|
326 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
326 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #include "SampleMainWindow.h" | |
22 | |
23 /** | |
24 * Don't use "ui_MainWindow.h" instead of <ui_MainWindow.h> below, as | |
25 * this makes CMake unable to detect when the UI file changes. | |
26 **/ | |
27 #include <ui_SampleMainWindowWithButtons.h> | |
28 #include "../../Applications/Samples/SampleApplicationBase.h" | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 namespace Samples | |
33 { | |
34 | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
35 SampleMainWindowWithButtons::SampleMainWindowWithButtons( |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
36 OrthancStone::NativeStoneApplicationContext& context, |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
37 OrthancStone::Samples::SampleSingleCanvasWithButtonsApplicationBase& stoneSampleApplication, |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
38 QWidget *parent) : |
326 | 39 QStoneMainWindow(context, parent), |
40 ui_(new Ui::SampleMainWindowWithButtons), | |
41 stoneSampleApplication_(stoneSampleApplication) | |
42 { | |
43 ui_->setupUi(this); | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
44 SetCentralStoneWidget(*ui_->cairoCentralWidget); |
326 | 45 |
46 #if QT_VERSION >= 0x050000 | |
47 connect(ui_->toolButton1, &QToolButton::clicked, this, &SampleMainWindowWithButtons::tool1Clicked); | |
48 connect(ui_->toolButton2, &QToolButton::clicked, this, &SampleMainWindowWithButtons::tool2Clicked); | |
49 connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindowWithButtons::pushButton1Clicked); | |
50 connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindowWithButtons::pushButton2Clicked); | |
51 #else | |
52 connect(ui_->toolButton1, SIGNAL(clicked()), this, SLOT(tool1Clicked())); | |
53 connect(ui_->toolButton2, SIGNAL(clicked()), this, SLOT(tool2Clicked())); | |
54 connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton1Clicked())); | |
55 connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton2Clicked())); | |
56 #endif | |
57 | |
58 std::string pushButton1Name; | |
59 std::string pushButton2Name; | |
60 std::string tool1Name; | |
61 std::string tool2Name; | |
62 stoneSampleApplication_.GetButtonNames(pushButton1Name, pushButton2Name, tool1Name, tool2Name); | |
63 | |
64 ui_->toolButton1->setText(QString::fromStdString(tool1Name)); | |
65 ui_->toolButton2->setText(QString::fromStdString(tool2Name)); | |
66 ui_->pushButton1->setText(QString::fromStdString(pushButton1Name)); | |
67 ui_->pushButton2->setText(QString::fromStdString(pushButton2Name)); | |
68 } | |
69 | |
70 SampleMainWindowWithButtons::~SampleMainWindowWithButtons() | |
71 { | |
72 delete ui_; | |
73 } | |
74 | |
75 void SampleMainWindowWithButtons::tool1Clicked() | |
76 { | |
77 stoneSampleApplication_.OnTool1Clicked(); | |
78 } | |
79 | |
80 void SampleMainWindowWithButtons::tool2Clicked() | |
81 { | |
82 stoneSampleApplication_.OnTool2Clicked(); | |
83 } | |
84 | |
85 void SampleMainWindowWithButtons::pushButton1Clicked() | |
86 { | |
87 stoneSampleApplication_.OnPushButton1Clicked(); | |
88 } | |
89 | |
90 void SampleMainWindowWithButtons::pushButton2Clicked() | |
91 { | |
92 stoneSampleApplication_.OnPushButton2Clicked(); | |
93 } | |
94 | |
95 } | |
96 } |