CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkAxesWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkAxesWidget_h
22 #define __ctkAxesWidget_h
23 
24 // Qt includes
25 #include <QMetaType>
26 #include <QWidget>
27 
28 // CTK includes
29 #include "ctkWidgetsExport.h"
30 
31 class ctkAxesWidgetPrivate;
32 
34 class CTK_WIDGETS_EXPORT ctkAxesWidget : public QWidget
35 {
36  Q_OBJECT
37  Q_ENUMS(Axis)
38  Q_PROPERTY(Axis currentAxis READ currentAxis WRITE setCurrentAxis NOTIFY currentAxisChanged)
39  Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
40  Q_PROPERTY(QStringList axesLabels READ axesLabels WRITE setAxesLabels)
41 public :
42 
43  enum Axis
44  {
45  None=0,
52  };
53 
54  ctkAxesWidget(QWidget *parent = 0);
55  virtual ~ctkAxesWidget();
56 
59  Axis currentAxis() const;
60 
65  bool autoReset() const;
66 
67 Q_SIGNALS:
69 
70 public slots :
75  void setCurrentAxis(Axis axis);
76 
80 
83  void setAutoReset(bool reset);
84 
94  bool setAxesLabels(const QStringList& labels);
95 
97  QStringList axesLabels() const;
98 
100  virtual QSize minimumSizeHint()const;
101  virtual QSize sizeHint()const;
102  virtual bool hasHeightForWidth()const;
103  virtual int heightForWidth(int width)const;
104 
105 protected:
106  void paintEvent(QPaintEvent *);
107  void mousePressEvent(QMouseEvent *mouseEvent);
108  void mouseMoveEvent(QMouseEvent *mouseEvent);
109  void mouseReleaseEvent(QMouseEvent *mouseEvent);
110 
111  QScopedPointer<ctkAxesWidgetPrivate> d_ptr;
112 private :
113  Q_DECLARE_PRIVATE(ctkAxesWidget);
114  Q_DISABLE_COPY(ctkAxesWidget);
115 };
116 
118 
119 #endif
120 
void setCurrentAxisToNone()
Utility slot that set the current axis to none.
virtual QSize sizeHint() const
QScopedPointer< ctkAxesWidgetPrivate > d_ptr
virtual bool hasHeightForWidth() const
bool setAxesLabels(const QStringList &labels)
Set the axes labels.
virtual ~ctkAxesWidget()
void mousePressEvent(QMouseEvent *mouseEvent)
void mouseReleaseEvent(QMouseEvent *mouseEvent)
Axis currentAxis() const
Current selected axis. None by default.
void mouseMoveEvent(QMouseEvent *mouseEvent)
virtual QSize minimumSizeHint() const
Size hints.
void setCurrentAxis(Axis axis)
void currentAxisChanged(ctkAxesWidget::Axis axis)
ctkAxesWidget(QWidget *parent=0)
bool autoReset() const
void paintEvent(QPaintEvent *)
void setAutoReset(bool reset)
Set the autoReset property to None anytime the currentAxis is changed.
virtual int heightForWidth(int width) const
QStringList axesLabels() const
Get the axes labels.
Q_DECLARE_METATYPE(ctkDICOMPersonName)