Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkStatusBar.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #include "QmitkStatusBar.h"
15 
16 #include <qmainwindow.h>
17 #include <qstatusbar.h>
18 #include <qapplication.h>
19 #include <qdesktopwidget.h>
20 
21 #include <mitkStatusBar.h>
22 
23 #include <itkObjectFactory.h>
24 
25 
29 void QmitkStatusBar::DisplayText(const char* t)
30 {
31  m_StatusBar->showMessage(t);
32  // TODO bug #1357
33  //qApp->processEvents(); // produces crashes!
34 }
35 
39 void QmitkStatusBar::DisplayText(const char* t, int ms)
40 {
41  m_StatusBar->showMessage(t, ms);
42  // TODO bug #1357
43  //qApp->processEvents(); // produces crashes!
44 }
49 {
50  QString text(t);
51  m_GreyValueLabel->setText(text);
52 }
57 {
58  if (m_StatusBar != nullptr)
59  m_StatusBar->clearMessage();
60  // TODO bug #1357
61  //qApp->processEvents(); // produces crashes!
62 }
63 
68 {
69  if (m_StatusBar != nullptr)
70  m_StatusBar->setSizeGripEnabled(enable);
71 }
72 
73 
74 QmitkStatusBar::QmitkStatusBar(QStatusBar* instance)
75 :StatusBarImplementation()
76 {
77  m_StatusBar = instance;
78  m_GreyValueLabel = new QLabel(m_StatusBar,nullptr);
79  int xResolution = QApplication::desktop()->screenGeometry(0).width()-100;
80  m_GreyValueLabel->setMaximumSize(QSize(xResolution,50));
81  m_GreyValueLabel->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Fixed);
82  m_StatusBar->addPermanentWidget(m_GreyValueLabel);
84 }
85 
87 {
88 }
89 
void Clear() override
removes any temporary message being shown.
void DisplayGreyValueText(const char *t) override
~QmitkStatusBar() override
Destructor.
void SetSizeGripEnabled(bool enable) override
Set the QSizeGrip of the window (the triangle in the lower right Windowcorner for changing the size) ...
void DisplayText(const char *t) override
Send a string to the applications StatusBar (QStatusBar).
QmitkStatusBar(QStatusBar *instance)
Constructor; holds param instance internaly and connects this to the mitkStatusBar.
static void SetImplementation(StatusBarImplementation *instance)
Supply a GUI- dependent StatusBar. Has to be set by the application to connect the application depend...