Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #include "QmitkStatusBar.h"
19 
20 #include <qmainwindow.h>
21 #include <qstatusbar.h>
22 #include <qapplication.h>
23 #include <qdesktopwidget.h>
24 
25 #include <mitkStatusBar.h>
26 
27 #include <itkObjectFactory.h>
28 
29 
33 void QmitkStatusBar::DisplayText(const char* t)
34 {
35  m_StatusBar->showMessage(t);
36  // TODO bug #1357
37  //qApp->processEvents(); // produces crashes!
38 }
39 
43 void QmitkStatusBar::DisplayText(const char* t, int ms)
44 {
45  m_StatusBar->showMessage(t, ms);
46  // TODO bug #1357
47  //qApp->processEvents(); // produces crashes!
48 }
53 {
54  QString text(t);
55  m_GreyValueLabel->setText(text);
56 }
61 {
62  if (m_StatusBar != nullptr)
63  m_StatusBar->clearMessage();
64  // TODO bug #1357
65  //qApp->processEvents(); // produces crashes!
66 }
67 
72 {
73  if (m_StatusBar != nullptr)
74  m_StatusBar->setSizeGripEnabled(enable);
75 }
76 
77 
78 QmitkStatusBar::QmitkStatusBar(QStatusBar* instance)
79 :StatusBarImplementation()
80 {
81  m_StatusBar = instance;
82  m_GreyValueLabel = new QLabel(m_StatusBar,nullptr);
83  int xResolution = QApplication::desktop()->screenGeometry(0).width()-100;
84  m_GreyValueLabel->setMaximumSize(QSize(xResolution,50));
85  m_GreyValueLabel->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Fixed);
86  m_StatusBar->addPermanentWidget(m_GreyValueLabel);
88 }
89 
91 {
92 }
93 
virtual void Clear() override
removes any temporary message being shown.
virtual void DisplayGreyValueText(const char *t) override
virtual void SetSizeGripEnabled(bool enable) override
Set the QSizeGrip of the window (the triangle in the lower right Windowcorner for changing the size) ...
virtual void DisplayText(const char *t) override
Send a string to the applications StatusBar (QStatusBar).
virtual ~QmitkStatusBar()
Destructor.
static void SetImplementation(StatusBarImplementation *instance)
Supply a GUI- dependent StatusBar. Has to be set by the application to connect the application depend...