Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
12QT_BEGIN_NAMESPACE
13
14
15class QPushButtonPrivate;
16class QMenu;
17class QStyleOptionButton;
18
19class Q_WIDGETS_EXPORT QPushButton : public QAbstractButton
20{
21 Q_OBJECT
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
70QT_END_NAMESPACE
71
72#endif // QPUSHBUTTON_H
QColor grabScreenColor(const QPoint &p)
bool selectColor(const QColor &color)
void init(const QColor &initial)
void setCurrentAlpha(int a)
QColorPickingEventFilter * colorPickingEventFilter
bool handleColorPickingMouseButtonRelease(QMouseEvent *e)
QColor currentQColor() const
bool handleColorPickingMouseMove(QMouseEvent *e)
void _q_setCustom(int index, QRgb color)
QPushButton * eyeDropperButton
void updateColorLabelText(const QPoint &)
void setCurrentColor(const QColor &color, SetColorMode setColorMode=SetColorAll)
bool isAlphaVisible() const
QVBoxLayout * leftLay
void setCurrentQColor(const QColor &color)
bool canBeNativeDialog() const override
void setCurrentRgbColor(QRgb rgb)
QRgb currentColor() const
void newColorTypedIn(QRgb rgb)
bool handleColorPickingKeyPress(QKeyEvent *e)
void updateColorPicking(const QPoint &pos)
QSharedPointer< QColorDialogOptions > options
void newStandard(int, int)
void setVisible(bool visible) override
QDialogButtonBox * buttons
bool supportsColorPicking() const
QPointer< QObject > receiverToDisconnectOnClose
virtual void initHelper(QPlatformDialogHelper *h) override
QByteArray memberToDisconnectOnClose
QPushButton * addCusBt
void newHsv(int h, int s, int v)
virtual void helperPrepareShow(QPlatformDialogHelper *h) override
QColorLuminancePicker * lp
void newCustom(int, int)
QPlatformColorDialogHelper * platformColorDialogHelper() const
void nextCustom(int, int)
The QColorDialog class provides a dialog widget for specifying colors.
friend class QPainter
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
\variable QStyleOption::palette
\variable QStyleOptionFocusRect::backgroundColor
QColSpinBox(QWidget *parent)
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mouseMoveEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mouseMoveEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
QSize sizeHint() const override
void setCrossVisible(bool visible)
void resizeEvent(QResizeEvent *) override
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
bool eventFilter(QObject *, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent)
void mouseReleaseEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseMoveEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void setHsv(int h, int s, int v)
void currentColorChanged(const QColor &color)
QColorWell(QWidget *parent, int r, int c, const QRgb *vals)
void paintCellContents(QPainter *, int row, int col, const QRect &) override
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void mouseMoveEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
void mouseReleaseEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
friend class QT_PREPEND_NAMESPACE(QUntypedBindable)
void mouseReleaseEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
void focusOutEvent(QFocusEvent *) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) f...
void currentChanged(int row, int col)
int columnAt(int x) const
void updateCell(int row, int column)
void colorChanged(int index, QRgb color)
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void mousePressEvent(QMouseEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void focusInEvent(QFocusEvent *) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
virtual void setCurrent(int row, int col)
virtual void setSelected(int row, int col)
int rowAt(int y) const
QRect cellGeometry(int row, int column)
virtual void paintCell(QPainter *, int row, int col, const QRect &)
int columnX(int column) const
int rowY(int row) const
QSize sizeHint() const override
virtual void paintCellContents(QPainter *, int row, int col, const QRect &)
void keyPressEvent(QKeyEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
QString cellContent(int row, int col) const
\macro QT_NO_KEYWORDS >
Definition qcompare.h:24
static void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
@ colorColumns
@ standardColorRows
@ customColorRows
static int pHeight
static int pWidth
static const Qt::WindowFlags qcd_DefaultWindowFlags
QT_REQUIRE_CONFIG(colordialog)
QT_REQUIRE_CONFIG(itemmodel)
QT_REQUIRE_CONFIG(progressbar)