Page MenuHomePhabricator

5245RedesignWindowLevelWidgetUsingQxtSpanSlider.patch

Authored By
wald
Aug 25 2010, 4:57 PM
Size
6 KB
Referenced Files
None
Subscribers
None

5245RedesignWindowLevelWidgetUsingQxtSpanSlider.patch

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 25762)
+++ CMakeLists.txt (working copy)
@@ -1,5 +1,5 @@
MITK_CREATE_MODULE( Qmitk
- DEPENDS Mitk
+ DEPENDS Mitk qxt
PACKAGE_DEPENDS QT QVTK
QT_MODULE
)
Index: files.cmake
===================================================================
--- files.cmake (revision 25762)
+++ files.cmake (working copy)
@@ -28,6 +28,7 @@
QmitkScalarBar.cpp
QmitkScalarBarOverlay.cpp
QmitkSliderLevelWindowWidget.cpp
+QmitkSpanSliderLevelWindowWidget.cpp
QmitkStdMultiWidget.cpp
QmitkTextOverlay.cpp
)
@@ -54,6 +55,7 @@
QmitkRenderingManager.h
QmitkRenderWindow.h
QmitkSliderLevelWindowWidget.h
+QmitkSpanSliderLevelWindowWidget.h
QmitkStdMultiWidget.h
)
SET(UI_FILES
Index: QmitkSpanSliderLevelWindowWidget.cpp
===================================================================
--- QmitkSpanSliderLevelWindowWidget.cpp (revision 0)
+++ QmitkSpanSliderLevelWindowWidget.cpp (revision 0)
@@ -0,0 +1,100 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-06-15 17:15:21 +0200 (Di, 15 Jun 2010) $
+Version: $Revision: 23776 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include <QmitkSpanSliderLevelWindowWidget.h>
+
+#include <QCursor>
+#include <QPainter>
+#include <QToolTip>
+#include <QMouseEvent>
+#include <QVBoxLayout>
+
+#include <itkCommand.h>
+#include <QmitkLevelWindowWidgetContextMenu.h>
+#include <mitkRenderingManager.h>
+
+/**
+* Constructor
+*/
+QmitkSpanSliderLevelWindowWidget::QmitkSpanSliderLevelWindowWidget( QWidget * parent, Qt::WindowFlags f )
+: QmitkSliderLevelWindowWidget( parent, f )
+{
+ m_Slider = new QxtSpanSlider(Qt::Vertical);
+ m_Slider->setTickPosition(QSlider::TicksRight);
+
+ connect( m_Slider, SIGNAL( spanChanged(int,int) ), this, SLOT( OnSpanChanged(int, int) ) );
+
+ QVBoxLayout* layout = new QVBoxLayout;
+ layout->setContentsMargins(0,0,0,0);
+ layout->addWidget(m_Slider);
+ this->setLayout( layout );
+
+ this->hide();
+}
+
+QmitkSpanSliderLevelWindowWidget::~QmitkSpanSliderLevelWindowWidget()
+{
+}
+
+void QmitkSpanSliderLevelWindowWidget::update()
+{
+ // do update
+ int minRange = static_cast<int>(m_LevelWindow.GetRangeMin());
+ int maxRange = static_cast<int>(m_LevelWindow.GetRangeMax());
+ int lowValue = static_cast<int>(m_LevelWindow.GetLowerWindowBound());
+ int upValue = static_cast<int>(m_LevelWindow.GetUpperWindowBound());
+
+ m_Slider->setMinimum(minRange);
+ m_Slider->setMaximum(maxRange);
+ m_Slider->setLowerValue(lowValue);
+ m_Slider->setUpperValue(upValue);
+}
+
+void QmitkSpanSliderLevelWindowWidget::OnSpanChanged (int lower, int upper)
+{
+ m_LevelWindow.SetWindowBounds( lower, upper );
+}
+
+void QmitkSpanSliderLevelWindowWidget::paintEvent( QPaintEvent* e )
+{
+ QWidget::paintEvent(e);
+}
+
+void QmitkSpanSliderLevelWindowWidget::mouseMoveEvent( QMouseEvent* mouseEvent )
+{
+ QWidget::mouseMoveEvent(mouseEvent);
+}
+
+void QmitkSpanSliderLevelWindowWidget::enterEvent ( QEvent * event )
+{
+ QWidget::enterEvent(event);
+}
+
+void QmitkSpanSliderLevelWindowWidget::mouseReleaseEvent( QMouseEvent* mouseEvent )
+{
+ QWidget::mouseReleaseEvent(mouseEvent);
+}
+
+void QmitkSpanSliderLevelWindowWidget::mousePressEvent( QMouseEvent* mouseEvent )
+{
+ QWidget::mousePressEvent(mouseEvent);
+}
+
+void QmitkSpanSliderLevelWindowWidget::resizeEvent ( QResizeEvent * event )
+{
+ QWidget::resizeEvent(event);
+}
\ No newline at end of file
Index: QmitkSpanSliderLevelWindowWidget.h
===================================================================
--- QmitkSpanSliderLevelWindowWidget.h (revision 0)
+++ QmitkSpanSliderLevelWindowWidget.h (revision 0)
@@ -0,0 +1,88 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2010-06-15 17:15:21 +0200 (Di, 15 Jun 2010) $
+Version: $Revision: 23776 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef QMITKSPANSLIDERLEVELWINDOW_WIDGET
+#define QMITKSPANSLIDERLEVELWINDOW_WIDGET
+
+#include <QWidget>
+#include <mitkLevelWindowManager.h>
+#include "QmitkSliderLevelWindowWidget.h"
+#include <qxtspanslider.h>
+
+class QmitkLevelWindowWidgetContextMenu;
+
+class QMITK_EXPORT QmitkSpanSliderLevelWindowWidget : public QmitkSliderLevelWindowWidget
+{
+
+ Q_OBJECT
+
+public:
+
+ /// constructor
+ QmitkSpanSliderLevelWindowWidget( QWidget * parent=0, Qt::WindowFlags f = 0 );
+
+ /// destructor
+ ~QmitkSpanSliderLevelWindowWidget();
+
+protected slots:
+
+ void OnSpanChanged (int lower, int upper);
+
+protected:
+
+ QxtSpanSlider* m_Slider;
+
+ /// recalculate the size and position of the slider bar
+ virtual void update( );
+
+ /*!
+ * repaint the slider and the scale
+ */
+ void paintEvent( QPaintEvent* e );
+
+ /*!
+ * method implements the component behaviour
+ *
+ * checks if cursor is on upper or lower bound of slider bar and changes cursor symbol
+ *
+ * checks if left mouse button is pressed and if CTRL is pressed and changes sliderbar in movedirection accordingly
+ */
+ void mouseMoveEvent( QMouseEvent* mouseEvent );
+
+ void enterEvent ( QEvent * event );
+
+ /*!
+ * registers events when a mousebutton is pressed
+ *
+ * if leftbutton is pressed m_Leftbutton is set to true
+ *
+ * also checks if CTRL is pressed and sets the bool variable m_CtrlPressed
+ */
+ void mousePressEvent( QMouseEvent* mouseEvent );
+
+ /*!
+ * sets the variable m_MouseDown to false
+ */
+ void mouseReleaseEvent( QMouseEvent* mouseEvent );
+
+ /*!
+ * causes an update of the sliderbar when resizing the window
+ */
+ void virtual resizeEvent ( QResizeEvent * event );
+
+};
+#endif //QMITKSPANSLIDERLEVELWINDOW_WIDGET

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
565
Default Alt Text
5245RedesignWindowLevelWidgetUsingQxtSpanSlider.patch (6 KB)

Event Timeline

New design of the WindowLevelWidget using spanSlider