~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to demos/shared/arthurwidgets.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ARTHUR_WIDGETS
 
2
#define ARTHUR_WIDGETS
 
3
 
 
4
#include <qbitmap.h>
 
5
#include <qpushbutton.h>
 
6
#include <qgroupbox.h>
 
7
#include "arthurstyle.h"
 
8
 
 
9
class QTextDocument;
 
10
class QTextEdit;
 
11
class QVBoxLayout;
 
12
 
 
13
class ArthurFrame : public QWidget
 
14
{
 
15
    Q_OBJECT
 
16
public:
 
17
    ArthurFrame(QWidget *parent);
 
18
    virtual void paint(QPainter *) {}
 
19
 
 
20
 
 
21
    void paintDescription(QPainter *p);
 
22
 
 
23
    void loadDescription(const QString &filename);
 
24
    void setDescription(const QString &htmlDesc);
 
25
 
 
26
    void loadSourceFile(const QString &fileName);
 
27
 
 
28
    bool preferImage() const { return m_prefer_image; }
 
29
 
 
30
public slots:
 
31
    void setPreferImage(bool pi) { m_prefer_image = pi; }
 
32
    void setDescriptionEnabled(bool enabled);
 
33
    void showSource();
 
34
 
 
35
signals:
 
36
    void descriptionEnabledChanged(bool);
 
37
 
 
38
protected:
 
39
    void paintEvent(QPaintEvent *);
 
40
 
 
41
    QPixmap m_tile;
 
42
 
 
43
    bool m_show_doc;
 
44
    bool m_prefer_image;
 
45
    QTextDocument *m_document;
 
46
 
 
47
    QString m_sourceFileName;
 
48
 
 
49
};
 
50
 
 
51
class ArthurGroupBox : public QGroupBox
 
52
{
 
53
public:
 
54
    ArthurGroupBox(QWidget *parent) : QGroupBox(parent) {}
 
55
 
 
56
protected:
 
57
    void paintEvent(QPaintEvent *) {
 
58
        QPainter painter(this);
 
59
        QRect frameRect = rect();
 
60
        ArthurGroupBoxStyleOption opt;
 
61
        opt.init(this);
 
62
        opt.rect = frameRect;
 
63
        opt.title = title();
 
64
 
 
65
        style()->drawPrimitive(QStyle::PE_FrameGroupBox, &opt, &painter, this);
 
66
    }
 
67
};
 
68
 
 
69
#endif