OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pushbutton.hpp
Go to the documentation of this file.
1 #ifndef CSV_WIDGET_PUSHBUTTON_H
2 #define CSV_WIDGET_PUSHBUTTON_H
3 
4 #include <QPushButton>
5 
6 namespace CSMPrefs
7 {
8  class Setting;
9 }
10 
11 namespace CSVWidget
12 {
13  class PushButton : public QPushButton
14  {
15  Q_OBJECT
16 
17  public:
18 
19  enum Type
20  {
21  Type_TopMode, // top level button for mode selector panel
22  Type_TopAction, // top level button that triggers an action
23  Type_Mode, // mode button
25  };
26 
27  private:
28 
29  bool mKeepOpen;
31  QString mToolTip;
33 
34  private:
35 
36  void processShortcuts();
37  void setExtendedToolTip();
38 
39  protected:
40 
41  virtual void keyPressEvent (QKeyEvent *event);
42 
43  virtual void keyReleaseEvent (QKeyEvent *event);
44 
45  virtual void mouseReleaseEvent (QMouseEvent *event);
46 
47  public:
48 
50  PushButton (const QIcon& icon, Type type, const QString& tooltip = "",
51  QWidget *parent = 0);
52 
54  PushButton (Type type, const QString& tooltip = "",
55  QWidget *parent = 0);
56 
57  bool hasKeepOpen() const;
58 
60  QString getBaseToolTip() const;
61 
62  Type getType() const;
63 
64  private slots:
65 
66  void checkedStateChanged (bool checked);
67  void settingChanged (const CSMPrefs::Setting *setting);
68  };
69 }
70 
71 #endif
Type
Definition: pushbutton.hpp:19
virtual void keyReleaseEvent(QKeyEvent *event)
Definition: pushbutton.cpp:64
void settingChanged(const CSMPrefs::Setting *setting)
Definition: pushbutton.cpp:123
void setExtendedToolTip()
Definition: pushbutton.cpp:14
Definition: pushbutton.hpp:21
Definition: pushbutton.hpp:24
void processShortcuts()
Definition: pushbutton.cpp:9
bool hasKeepOpen() const
Definition: pushbutton.cpp:103
Definition: pushbutton.hpp:13
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: pushbutton.cpp:72
QString mProcessedToolTip
Definition: pushbutton.hpp:32
Definition: pushbutton.hpp:23
PushButton(const QIcon &icon, Type type, const QString &tooltip="", QWidget *parent=0)
Definition: pushbutton.cpp:78
Definition: setting.hpp:22
QString getBaseToolTip() const
Return tooltip used at construction (without any button-specific modifications)
Definition: pushbutton.cpp:108
Definition: pushbutton.hpp:22
virtual void keyPressEvent(QKeyEvent *event)
Definition: pushbutton.cpp:56
bool mKeepOpen
Definition: pushbutton.hpp:29
QString mToolTip
Definition: pushbutton.hpp:31
Type mType
Definition: pushbutton.hpp:30
void checkedStateChanged(bool checked)
Definition: pushbutton.cpp:118
Type getType() const
Definition: pushbutton.cpp:113