summaryrefslogtreecommitdiff
path: root/examples/main-tab/simple.h
blob: e0e43c0f11c1d30f3af805d5717d97a8ee5470e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

/*
 * A Simple widget with a button to quit
 *
 */

/*
 * The below sequence is called a guard and guards
 * against multiple inclusion of header files
 * NOTE: you need to use unique names among the header files
 */
#ifndef QUIET_SIMPLE_DEMO_H
#define QUIET_SIMPLE_DEMO_H




#include <qmainwindow.h>  // from this class we will inherit


class QPushButton; // forward declaration to not include the header. This can save time when compiling
class QAction;

/*
 * A mainwindow is a special QWidget it helps layouting
 * toolbar, statusbar, menubar. Got dockable areas
 * So in one sentence it is a MainWindow :)
 */
class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    static QString appName() { return QString::fromLatin1("main-tab"); }
    MainWindow( QWidget* parent, const char* name,  WFlags fl );
    ~MainWindow();

public slots:
    void setDocument( const QString& );
private slots:
    void slotCurrentChanged( QWidget* wid );

private:
    void initUI();
    QAction *m_fire;
    QWidget* m_oldCurrent;
};


/*
 * We will just reuse the two simple widgets for now
 */
class Simple1 : public QWidget {

    Q_OBJECT
public:

    Simple1( QWidget* parent = 0, const char * name = 0,  WFlags fl = 0 );
    ~Simple1();


public slots:
    void slotFire();

private:
    /* my variable */
    QPushButton* m_button;
};

class Simple2 : public QWidget {
    Q_OBJECT
public:

    Simple2( QWidget* parent = 0, const char * name = 0,  WFlags fl = 0 );
    ~Simple2();



public slots:
    void slotFire();

private:
    /* my variable */
    QPushButton* m_button;
};



#endif