CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkCheckablePushButton.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 __ctkCheckablePushButton_h
22 #define __ctkCheckablePushButton_h
23 
24 // CTK includes
25 #include <ctkPimpl.h>
26 #include "ctkPushButton.h"
27 #include "ctkWidgetsExport.h"
28 
29 class ctkCheckablePushButtonPrivate;
30 
48 class CTK_WIDGETS_EXPORT ctkCheckablePushButton : public ctkPushButton
49 {
50  Q_OBJECT
53  Q_PROPERTY(Qt::Alignment indicatorAlignment READ indicatorAlignment WRITE setIndicatorAlignment)
54  Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged)
55  Q_PROPERTY(bool checkBoxControlsButton READ checkBoxControlsButton WRITE setCheckBoxControlsButton)
56  Q_PROPERTY(bool checkBoxUserCheckable READ isCheckBoxUserCheckable WRITE setCheckBoxUserCheckable)
57 
58 public:
59  ctkCheckablePushButton(QWidget *parent = 0);
60  ctkCheckablePushButton(const QString& text, QWidget *parent = 0);
62 
65  void setIndicatorAlignment(Qt::Alignment indicatorAlignment);
66  Qt::Alignment indicatorAlignment()const;
67 
68  virtual Qt::CheckState checkState()const;
69  virtual void setCheckState(Qt::CheckState checkState);
70 
71  virtual bool checkBoxControlsButton()const;
72  virtual void setCheckBoxControlsButton(bool b);
73 
74  virtual bool isCheckBoxUserCheckable()const;
75  virtual void setCheckBoxUserCheckable(bool b);
76 
77 Q_SIGNALS:
79  void checkBoxToggled(bool);
81  void checkStateChanged(Qt::CheckState newCheckState);
82 
83 protected:
85  virtual void mousePressEvent(QMouseEvent* event);
87  virtual bool hitButton(const QPoint & pos) const;
88 
89 private:
90  Q_DECLARE_PRIVATE(ctkCheckablePushButton);
91  Q_DISABLE_COPY(ctkCheckablePushButton);
92 };
93 
94 #endif
ctkCheckablePushButton(QWidget *parent=0)
virtual void mousePressEvent(QMouseEvent *event)
Reimplemented for internal reasons.
virtual void setCheckState(Qt::CheckState checkState)
virtual bool checkBoxControlsButton() const
virtual bool hitButton(const QPoint &pos) const
Reimplemented for internal reasons.
virtual void setCheckBoxUserCheckable(bool b)
virtual bool isCheckBoxUserCheckable() const
void checkBoxToggled(bool)
Fired anytime the checkbox change of state.
virtual ~ctkCheckablePushButton()
Qt::Alignment indicatorAlignment() const
virtual Qt::CheckState checkState() const
void checkStateChanged(Qt::CheckState newCheckState)
Fired anytime the checkbox change of state.
ctkCheckablePushButton(const QString &text, QWidget *parent=0)
void setIndicatorAlignment(Qt::Alignment indicatorAlignment)
virtual void setCheckBoxControlsButton(bool b)