MagicSmoke  $VERSION$
checkdlg.h
Go to the documentation of this file.
1 //
2 // C++ Interface: checkdlg
3 //
4 // Description:
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_CHECKDLG_H
14 #define MAGICSMOKE_CHECKDLG_H
15 
16 #include <QDialog>
17 #include <QList>
18 
19 class QCheckBox;
20 
23 {
24  public:
26  MCheckItem(QString key=QString(),bool isset=false,QString label=QString())
27  {m_key=key;m_set=isset;if(label!="")m_label=label;else m_label=m_key;}
28 
29  virtual ~MCheckItem(){}
30 
32  virtual QString label()const{return m_label;}
34  virtual QString key()const{return m_key;}
36  virtual bool isSet()const{return m_set;}
38  virtual void set(bool b){m_set=b;}
39 
40  protected:
41  QString m_key,m_label;
42  bool m_set;
43 };
44 
46 typedef QList<MCheckItem> MCheckList;
47 
49 class MCheckDialog:public QDialog
50 {
51  Q_OBJECT
52  public:
54  MCheckDialog(QWidget*parent,const MCheckList&checks,QString title);
55 
57  MCheckList getCheckList()const;
58  private:
59  QList<QCheckBox*>m_boxes;
60  mutable MCheckList m_list;
61 };
62 
63 #endif
virtual bool isSet() const
overwrite this to return whether the item is checked
Definition: checkdlg.h:36
MCheckItem(QString key=QString(), bool isset=false, QString label=QString())
constructs a check item
Definition: checkdlg.h:26
virtual QString label() const
overwrite this to return a label that can be displayed
Definition: checkdlg.h:32
virtual QString key() const
overwrite this to return a key string that identifies the item (default implementation returns the la...
Definition: checkdlg.h:34
class for items that can be displayed in a MCheckDialog
Definition: checkdlg.h:22
a dialog that consists of check boxes in a QScrollArea
Definition: checkdlg.h:49
QList< MCheckItem > MCheckList
implements a list of checkable items
Definition: checkdlg.h:46
MCheckDialog(QWidget *parent, const MCheckList &checks, QString title)
creates the dialog
Definition: checkdlg.cpp:20
QString m_key
Definition: checkdlg.h:41
virtual void set(bool b)
overwrite this to change the checking status of the item
Definition: checkdlg.h:38
bool m_set
Definition: checkdlg.h:42
virtual ~MCheckItem()
Definition: checkdlg.h:29
MCheckList getCheckList() const
returns the current state of all check boxes, the return value is an exact copy of the check list fro...
Definition: checkdlg.cpp:49
QString m_label
Definition: checkdlg.h:41