Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpushbutton.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPUSHBUTTON_H
5#define QPUSHBUTTON_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractbutton.h>
9
11
13
14
16class QMenu;
18
19class Q_WIDGETS_EXPORT QPushButton : public QAbstractButton
20{
22
23 Q_PROPERTY(bool autoDefault READ autoDefault WRITE setAutoDefault)
24 Q_PROPERTY(bool default READ isDefault WRITE setDefault)
25 Q_PROPERTY(bool flat READ isFlat WRITE setFlat)
26
27public:
28 explicit QPushButton(QWidget *parent = nullptr);
29 explicit QPushButton(const QString &text, QWidget *parent = nullptr);
30 QPushButton(const QIcon& icon, const QString &text, QWidget *parent = nullptr);
31 ~QPushButton();
32
33 QSize sizeHint() const override;
34 QSize minimumSizeHint() const override;
35
36 bool autoDefault() const;
37 void setAutoDefault(bool);
38 bool isDefault() const;
39 void setDefault(bool);
40
41#if QT_CONFIG(menu)
42 void setMenu(QMenu* menu);
43 QMenu* menu() const;
44#endif
45
46 void setFlat(bool);
47 bool isFlat() const;
48
49public Q_SLOTS:
50#if QT_CONFIG(menu)
51 void showMenu();
52#endif
53
54protected:
55 bool event(QEvent *e) override;
56 void paintEvent(QPaintEvent *) override;
57 void keyPressEvent(QKeyEvent *) override;
58 void focusInEvent(QFocusEvent *) override;
59 void focusOutEvent(QFocusEvent *) override;
60 void mouseMoveEvent(QMouseEvent *) override;
61 virtual void initStyleOption(QStyleOptionButton *option) const;
62 bool hitButton(const QPoint &pos) const override;
63 QPushButton(QPushButtonPrivate &dd, QWidget* parent = nullptr);
64
65private:
66 Q_DISABLE_COPY(QPushButton)
67 Q_DECLARE_PRIVATE(QPushButton)
68};
69
71
72#endif // QPUSHBUTTON_H
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
\inmodule QtCore
Definition qcoreevent.h:45
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QKeyEvent class describes a key event.
Definition qevent.h:424
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition qmenu.h:26
\inmodule QtGui
Definition qevent.h:196
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\variable QStyleOptionHeaderV2::textElideMode
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QPushButton
[1]
QString text
Combined button and popup list for selecting options.
struct _cl_event * event
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define explicit
QMenu menu
[5]