7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qdialog.h>
9#include <QtWidgets/qdialogbuttonbox.h>
11QT_REQUIRE_CONFIG(messagebox);
24 Q_PROPERTY(QString text READ text WRITE setText)
25 Q_PROPERTY(Icon icon READ icon WRITE setIcon)
26 Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
27 Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
28 Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons)
29#if QT_CONFIG(textedit)
30 Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
32 Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
33 Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags
34 WRITE setTextInteractionFlags)
35 Q_PROPERTY(Options options READ options WRITE setOptions)
39 DontUseNativeDialog = 0x00000001
72 NoButton = 0x00000000,
78 YesToAll = 0x00008000,
90 RestoreDefaults = 0x08000000,
93 LastButton = RestoreDefaults,
100 FlagMask = 0x00000300,
101 ButtonMask = ~FlagMask
103 Q_ENUM(StandardButton)
105#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
106 typedef StandardButton Button;
108 Q_DECLARE_FLAGS(Options, Option)
109 Q_DECLARE_FLAGS(StandardButtons, StandardButton)
111 Q_FLAG(StandardButtons)
113 explicit QMessageBox(QWidget *parent =
nullptr);
114 QMessageBox(Icon icon,
const QString &title,
const QString &text,
115 StandardButtons buttons = NoButton, QWidget *parent =
nullptr,
116 Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
119 void addButton(QAbstractButton *button, ButtonRole role);
120 QPushButton *addButton(
const QString &text, ButtonRole role);
121 QPushButton *addButton(StandardButton button);
122 void removeButton(QAbstractButton *button);
125 void open(QObject *receiver,
const char *member);
127 QList<QAbstractButton *> buttons()
const;
128 ButtonRole buttonRole(QAbstractButton *button)
const;
130 void setStandardButtons(StandardButtons buttons);
131 StandardButtons standardButtons()
const;
132 StandardButton standardButton(QAbstractButton *button)
const;
133 QAbstractButton *button(StandardButton which)
const;
135 QPushButton *defaultButton()
const;
136 void setDefaultButton(QPushButton *button);
137 void setDefaultButton(StandardButton button);
139 QAbstractButton *escapeButton()
const;
140 void setEscapeButton(QAbstractButton *button);
141 void setEscapeButton(StandardButton button);
143 QAbstractButton *clickedButton()
const;
145 QString text()
const;
146 void setText(
const QString &text);
151 QPixmap iconPixmap()
const;
152 void setIconPixmap(
const QPixmap &pixmap);
154 Qt::TextFormat textFormat()
const;
155 void setTextFormat(Qt::TextFormat format);
157 void setTextInteractionFlags(Qt::TextInteractionFlags flags);
158 Qt::TextInteractionFlags textInteractionFlags()
const;
160 void setCheckBox(QCheckBox *cb);
161 QCheckBox* checkBox()
const;
163 void setOption(Option option,
bool on =
true);
164 bool testOption(Option option)
const;
165 void setOptions(Options options);
166 Options options()
const;
168 static StandardButton information(QWidget *parent,
const QString &title,
169 const QString &text, StandardButtons buttons = Ok,
170 StandardButton defaultButton = NoButton);
171#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
172 inline static StandardButton information(QWidget *parent,
const QString &title,
174 StandardButton button0, StandardButton button1 = NoButton)
175 {
return information(parent, title, text, StandardButtons(button0), button1); }
178 static StandardButton question(QWidget *parent,
const QString &title,
179 const QString &text, StandardButtons buttons = StandardButtons(Yes | No),
180 StandardButton defaultButton = NoButton);
181#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
182 inline static int question(QWidget *parent,
const QString &title,
184 StandardButton button0, StandardButton button1)
185 {
return question(parent, title, text, StandardButtons(button0), button1); }
188 static StandardButton warning(QWidget *parent,
const QString &title,
189 const QString &text, StandardButtons buttons = Ok,
190 StandardButton defaultButton = NoButton);
191#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
192 inline static int warning(QWidget *parent,
const QString &title,
194 StandardButton button0, StandardButton button1)
195 {
return warning(parent, title, text, StandardButtons(button0), button1); }
198 static StandardButton critical(QWidget *parent,
const QString &title,
199 const QString &text, StandardButtons buttons = Ok,
200 StandardButton defaultButton = NoButton);
201#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
202 inline static int critical(QWidget *parent,
const QString &title,
204 StandardButton button0, StandardButton button1)
205 {
return critical(parent, title, text, StandardButtons(button0), button1); }
208 static void about(QWidget *parent,
const QString &title,
const QString &text);
209 static void aboutQt(QWidget *parent,
const QString &title = QString());
211#if QT_DEPRECATED_SINCE(6
,2
)
213 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
214 QMessageBox(
const QString &title,
const QString &text, Icon icon,
215 int button0,
int button1,
int button2,
216 QWidget *parent =
nullptr,
217 Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
219 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
220 static int information(QWidget *parent,
const QString &title,
222 int button0,
int button1 = 0,
int button2 = 0);
223 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
224 static int information(QWidget *parent,
const QString &title,
226 const QString& button0Text,
227 const QString& button1Text = QString(),
228 const QString& button2Text = QString(),
229 int defaultButtonNumber = 0,
230 int escapeButtonNumber = -1);
232 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
233 static int question(QWidget *parent,
const QString &title,
235 int button0,
int button1 = 0,
int button2 = 0);
236 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
237 static int question(QWidget *parent,
const QString &title,
239 const QString& button0Text,
240 const QString& button1Text = QString(),
241 const QString& button2Text = QString(),
242 int defaultButtonNumber = 0,
243 int escapeButtonNumber = -1);
245 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
246 static int warning(QWidget *parent,
const QString &title,
248 int button0,
int button1,
int button2 = 0);
249 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
250 static int warning(QWidget *parent,
const QString &title,
252 const QString& button0Text,
253 const QString& button1Text = QString(),
254 const QString& button2Text = QString(),
255 int defaultButtonNumber = 0,
256 int escapeButtonNumber = -1);
258 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
259 static int critical(QWidget *parent,
const QString &title,
261 int button0,
int button1,
int button2 = 0);
262 QT_DEPRECATED_VERSION_X_6_2(
"Use the overload taking StandardButtons instead.")
263 static int critical(QWidget *parent,
const QString &title,
265 const QString& button0Text,
266 const QString& button1Text = QString(),
267 const QString& button2Text = QString(),
268 int defaultButtonNumber = 0,
269 int escapeButtonNumber = -1);
271 QT_DEPRECATED_VERSION_X_6_2(
"Use button() and QPushButton::text() instead.")
272 QString buttonText(
int button)
const;
273 QT_DEPRECATED_VERSION_X_6_2(
"Use addButton() instead.")
274 void setButtonText(
int button,
const QString &text);
277 QString informativeText()
const;
278 void setInformativeText(
const QString &text);
280#if QT_CONFIG(textedit)
281 QString detailedText()
const;
282 void setDetailedText(
const QString &text);
285 void setWindowTitle(
const QString &title);
286 void setWindowModality(Qt::WindowModality windowModality);
288#if QT_DEPRECATED_SINCE(6
,2
)
289 QT_DEPRECATED_VERSION_X_6_2(
"Use QStyle::standardIcon() instead.")
290 static QPixmap standardIcon(Icon icon);
294 void buttonClicked(QAbstractButton *button);
302 bool event(QEvent *e) override;
303 void resizeEvent(QResizeEvent *event) override;
304 void showEvent(QShowEvent *event) override;
305 void closeEvent(QCloseEvent *event) override;
306 void keyPressEvent(QKeyEvent *event) override;
307 void changeEvent(QEvent *event) override;
310 Q_DISABLE_COPY(QMessageBox)
311 Q_DECLARE_PRIVATE(QMessageBox)
314Q_DECLARE_OPERATORS_FOR_FLAGS(QMessageBox::StandardButtons)
316Q_WIDGETS_EXPORT
void qRequireVersion(
int argc,
char *argv[], QAnyStringView req);
318#define QT_REQUIRE_VERSION(argc, argv, str) qRequireVersion(argc, argv, str);
The QApplication class manages the GUI application's control flow and main settings.
The QGroupBox widget provides a group box frame with a title.
QScopedPointer< QImageIOHandlerPrivate > d_ptr
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
The QPaintEngineState class provides information about the active paint engine's current state....
virtual QPixmap createPixmap(QSize size)
void setSystemRect(const QRect &rect)
void setActive(bool newState)
Sets the active state of the paint engine to state.
virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QPixmap createPixmapFromImage(QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
friend class QWidgetPrivate
QPaintEngine(PaintEngineFeatures features=PaintEngineFeatures())
Creates a paint engine with the featureset specified by caps.
friend class QFontEngineQPF2
friend class QMacCGContext
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
virtual void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
virtual void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount rectangles in the buffer rects.
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
QPainter * painter() const
Returns the paint engine's painter.
void fix_neg_rect(int *x, int *y, int *w, int *h)
void setPaintDevice(QPaintDevice *device)
virtual QPoint coordinateOffset() const
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void setDirty(DirtyFlags df)
void setSystemClip(const QRegion &baseClip)
QPaintEngineState * state
friend class QPainterReplayer
friend class QX11GLPlatformPixmap
PaintEngineFeatures gccaps
void clearDirty(DirtyFlags df)
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
QRegion systemClip() const
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
bool testDirty(DirtyFlags df)
virtual void updateState(const QPaintEngineState &state)=0
Reimplement this function to update the state of a paint engine.
DirtyFlag
\value DirtyPen The pen is dirty and needs to be updated.
Type
\value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \val...
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
friend class QFontEngineMac
friend class QWin32PaintEngine
friend class QWin32PaintEnginePrivate
friend class QFontEngineWin
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen's color.
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
\inmodule QtCore\reentrant
The QPolygonF class provides a list of points using floating point precision.
The QStyleHintReturnMask class provides style hints that return a QRegion.
The QStyleHintReturnVariant class provides style hints that return a QVariant.
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionMenuItem::menuItemType
\variable QStyleOption::palette
\variable QStyleOptionFocusRect::backgroundColor
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
\variable QStyleOptionFrame::features
\variable QStyleOptionToolBox::selectedPosition
The QStyleOption class stores the parameters used by QStyle functions.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
The QWindows11Style class provides a look and feel suitable for applications on Microsoft Windows 11.
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
void unpolish(QWidget *widget) override
void polish(QWidget *widget) override
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const override
QWindows11Style(QWindows11StylePrivate &dd)
void polish(QPalette &pal) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget=nullptr) const override
~QWindows11Style() override
Destructor.
HRGN mask(QWidget *widget)
QWindowsThemeData(const QWidget *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0, const QRect &r=QRect())
QMarginsF margins(const QRect &rect, int propId=TMT_CONTENTMARGINS)
static RECT toRECT(const QRect &qr)
QMarginsF margins(int propId=TMT_CONTENTMARGINS)
static QSizeF themeSize(const QWidget *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0)
HBITMAP buffer(int w=0, int h=0)
static int fixedPixelMetric(QStyle::PixelMetric pm)
static HDC hdcForWidgetBackingStore(const QWidget *widget)
static QBackingStore * backingStoreForWidget(const QWidget *widget)
bool swapAlphaChannel(const QRect &rect, bool allPixels=false)
bool drawBackgroundThruNativeBuffer(QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio, qreal correctionFactor)
static HWND winId(const QWidget *widget)
void init(bool force=false)
static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
bool transitionsEnabled() const
bool drawBackgroundDirectly(HDC dc, QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio)
static bool isItemViewDelegateLineEdit(const QWidget *widget)
static bool useVista(bool update=false)
QRgb groupBoxTextColorDisabled
bool fixAlphaChannel(const QRect &rect)
void cleanup(bool force=false)
QWindowsVistaStylePrivate()
bool isTransparent(QWindowsThemeData &QWindowsThemeData)
bool hasAlphaChannel(const QRect &rect)
QRegion region(QWindowsThemeData &QWindowsThemeData)
QTime animationTime() const
~QWindowsVistaStylePrivate()
bool drawBackground(QWindowsThemeData &QWindowsThemeData, qreal correctionFactor=1)
static HTHEME createTheme(int theme, const QWidget *widget)
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr)
static QString themeName(int theme)
The QWindowsVistaStyle class provides a look and feel suitable for applications on Microsoft Windows ...
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=nullptr) const override
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
void polish(QWidget *widget) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=nullptr) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
\reimp
~QWindowsVistaStyle() override
Destructor.
void polish(QPalette &pal) override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
QWindowsVistaStyle(QWindowsVistaStylePrivate &dd)
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
void unpolish(QWidget *widget) override
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QT_REQUIRE_CONFIG(itemmodel)
T qstyleoption_cast(const QStyleOption *opt)
T qstyleoption_cast(QStyleOption *opt)
bool operator==(const ThemeMapKey &k1, const ThemeMapKey &k2)
size_t qHash(const ThemeMapKey &key)
AlphaChannelType alphaType
ThemeMapKey(const QWindowsThemeData &data)