File: qwt_push_button.h

package info (click to toggle)
libqwt 4.2.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,856 kB
  • ctags: 5,512
  • sloc: cpp: 22,973; ansic: 244; makefile: 59
file content (66 lines) | stat: -rw-r--r-- 1,886 bytes parent folder | download | duplicates (5)
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
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2002   Uwe Rathmann
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

#ifndef QWT_PUSH_BUTTON_H
#define QWT_PUSH_BUTTON_H

#include <qpushbutton.h>
#include "qwt_global.h"

/*!
  A push button that allows alignment of button labels, 
  and use of rich texts, as provided by QLabel.

  \warning The layout of the text label might be broken for a couple
           of styles. At least the KDE 3.3 Keramik style is known.
*/

class QWT_EXPORT QwtPushButton: public QPushButton
{
    Q_OBJECT

    Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat)
    Q_PROPERTY(Alignment alignment READ alignment WRITE setAlignment)
    Q_PROPERTY(int indent READ indent WRITE setIndent)

public:
    QwtPushButton(QWidget * = NULL, const char * name = NULL);
    QwtPushButton(const QString &text, 
        QWidget * = NULL, const char *name = NULL);
    QwtPushButton(const QIconSet &, const QString &, 
        QWidget * = NULL, const char *name = NULL);

    // The second technology preview release of Qt-4 needs Qt::TextFormat
    // but moc accepts only TextFormat
    TextFormat textFormat() const;
    void setTextFormat(TextFormat);

    virtual Qt::TextFormat usedTextFormat() const;

    int alignment() const;
    virtual void setAlignment(int alignment);

    void setIndent(int);
    int indent() const;

    virtual QSize sizeHint() const;
    virtual int heightForWidth(int) const;

protected:
    virtual void drawButtonLabel(QPainter *);

private:
    void init();

    Qt::TextFormat d_textFormat;
    int d_alignment;
    int d_indent;
};

#endif