summaryrefslogtreecommitdiff
path: root/examples/main-tab/simple.h
Unidiff
Diffstat (limited to 'examples/main-tab/simple.h') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/main-tab/simple.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/examples/main-tab/simple.h b/examples/main-tab/simple.h
new file mode 100644
index 0000000..e0e43c0
--- a/dev/null
+++ b/examples/main-tab/simple.h
@@ -0,0 +1,87 @@
1
2/*
3 * A Simple widget with a button to quit
4 *
5 */
6
7/*
8 * The below sequence is called a guard and guards
9 * against multiple inclusion of header files
10 * NOTE: you need to use unique names among the header files
11 */
12#ifndef QUIET_SIMPLE_DEMO_H
13#define QUIET_SIMPLE_DEMO_H
14
15
16
17
18#include <qmainwindow.h> // from this class we will inherit
19
20
21class QPushButton; // forward declaration to not include the header. This can save time when compiling
22class QAction;
23
24/*
25 * A mainwindow is a special QWidget it helps layouting
26 * toolbar, statusbar, menubar. Got dockable areas
27 * So in one sentence it is a MainWindow :)
28 */
29class MainWindow : public QMainWindow {
30 Q_OBJECT
31public:
32 static QString appName() { return QString::fromLatin1("main-tab"); }
33 MainWindow( QWidget* parent, const char* name, WFlags fl );
34 ~MainWindow();
35
36public slots:
37 void setDocument( const QString& );
38private slots:
39 void slotCurrentChanged( QWidget* wid );
40
41private:
42 void initUI();
43 QAction *m_fire;
44 QWidget* m_oldCurrent;
45};
46
47
48/*
49 * We will just reuse the two simple widgets for now
50 */
51class Simple1 : public QWidget {
52
53 Q_OBJECT
54public:
55
56 Simple1( QWidget* parent = 0, const char * name = 0, WFlags fl = 0 );
57 ~Simple1();
58
59
60public slots:
61 void slotFire();
62
63private:
64 /* my variable */
65 QPushButton* m_button;
66};
67
68class Simple2 : public QWidget {
69 Q_OBJECT
70public:
71
72 Simple2( QWidget* parent = 0, const char * name = 0, WFlags fl = 0 );
73 ~Simple2();
74
75
76
77public slots:
78 void slotFire();
79
80private:
81 /* my variable */
82 QPushButton* m_button;
83};
84
85
86
87#endif