4#include <QtWidgets/qmessagebox.h>
6#include <QtWidgets/qdialogbuttonbox.h>
7#include "private/qlabel_p.h"
8#include "private/qapplication_p.h"
9#include <QtCore/qlist.h>
10#include <QtCore/qdebug.h>
11#include <QtWidgets/qstyle.h>
12#include <QtWidgets/qstyleoption.h>
13#include <QtWidgets/qgridlayout.h>
14#include <QtWidgets/qpushbutton.h>
15#include <QtWidgets/qcheckbox.h>
16#include <QtGui/qaccessible.h>
17#include <QtGui/qicon.h>
18#include <QtGui/qtextdocument.h>
19#include <QtWidgets/qapplication.h>
20#if QT_CONFIG(textedit)
21#include <QtWidgets/qtextedit.h>
24#include <QtWidgets/qmenu.h>
27#include <QtGui/qfont.h>
28#include <QtGui/qfontmetrics.h>
29#include <QtGui/qclipboard.h>
30#include "private/qabstractbutton_p.h"
31#include <QtGui/qpa/qplatformtheme.h>
33#include <QtCore/qanystringview.h>
34#include <QtCore/qdebug.h>
35#include <QtCore/qpointer.h>
36#include <QtCore/qversionnumber.h>
39# include <QtCore/qt_windows.h>
40#include <qpa/qplatformnativeinterface.h>
50HMENU qt_getWindowsSystemMenu(
const QWidget *
w)
54 return GetSystemMenu(
reinterpret_cast<HWND
>(
handle),
false);
61 "QMessageBox::ButtonRole and QDialogButtonBox::ButtonRole out of sync!");
63static_assert(std::is_same_v<std::underlying_type_t<QMessageBox::ButtonRole>,
64 std::underlying_type_t<QDialogButtonBox::ButtonRole>>);
71 "QMessageBox::StandardButton and QDialogButtonBox::StandardButton out of sync!");
78#if QT_CONFIG(textedit)
79class QMessageBoxDetailsText :
public QWidget
87#ifndef QT_NO_CONTEXTMENU
90 if (
QMenu *
menu = createStandardContextMenu()) {
98 QMessageBoxDetailsText(
QWidget *parent=
nullptr)
100 , copyAvailable(
false)
116 this, &QMessageBoxDetailsText::textCopyAvailable);
123#ifdef QT_NO_CLIPBOARD
139 void textCopyAvailable(
bool available)
141 copyAvailable = available;
159 {
return label ==
ShowLabel ? QMessageBox::tr(
"Show Details...") : QMessageBox::tr(
"Hide Details..."); }
215 int button0,
int button1,
int button2);
221 int defaultButtonNumber,
222 int escapeButtonNumber);
241#if QT_CONFIG(textedit)
242 QMessageBoxDetailsText *detailsText;
251 QSharedPointer<QMessageDialogOptions>
options;
266 label->setOpenExternalLinks(
true);
305 grid->
addItem(indentSpacer, 0, hasIcon ? 1 : 0, 2, 1);
326 q->setContentsMargins(24, 15, 24, 20);
332#if QT_CONFIG(textedit)
356 const QSize screenSize =
q->screen()->availableGeometry().size();
357 int hardLimit =
qMin(screenSize.
width() - 480, 1000);
359 if (screenSize.
width() <= 1024)
360 hardLimit = screenSize.
width();
362 int softLimit =
qMin(screenSize.
width()/2, 420);
365 int softLimit =
qMin(screenSize.
width()/2, 500);
371 label->setWordWrap(
false);
374 if (
width > softLimit) {
375 label->setWordWrap(
true);
378 if (
width > hardLimit) {
379 label->d_func()->ensureTextControl();
383 control->document()->setDefaultTextOption(
opt);
395 if (
width > hardLimit) {
400 control->document()->setDefaultTextOption(
opt);
409 int windowTitleWidth =
qMin(fm.horizontalAdvance(
q->windowTitle()) + 50, hardLimit);
410 if (windowTitleWidth >
width)
411 width = windowTitleWidth;
457 return standardButton;
464 if (customButtonIndex >= 0)
467 return customButtonIndex;
496#if QT_CONFIG(textedit)
499 detailsText->setHidden(!detailsText->isHidden());
543 dialogButton->click();
864 StandardButtons buttons,
QWidget *parent,
910 d->customButtonList.append(
button);
911 d->autoAddOkButton =
false;
959 d->autoAddOkButton =
false;
973 d->customButtonList.removeAll(
button);
975 d->escapeButton =
nullptr;
976 if (
d->defaultButton ==
button)
977 d->defaultButton =
nullptr;
978 d->buttonBox->removeButton(
button);
996 d->buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(
int(
buttons)));
998 QList<QAbstractButton *> buttonList =
d->buttonBox->buttons();
999 if (!buttonList.contains(
d->escapeButton))
1000 d->escapeButton =
nullptr;
1001 if (!buttonList.contains(
d->defaultButton))
1002 d->defaultButton =
nullptr;
1003 d->autoAddOkButton =
false;
1010 return QMessageBox::StandardButtons(
int(
d->buttonBox->standardButtons()));
1070 return d->escapeButton;
1084 if (
d->buttonBox->buttons().contains(
button))
1116 if (buttons.size() == 1) {
1132 for (
auto *
button : buttons) {
1145 for (
auto *
button : buttons) {
1174 return d->clickedButton;
1189 return d->defaultButton;
1203 if (!
d->buttonBox->buttons().contains(
button))
1236 if (
cb ==
d->checkbox)
1240 d->checkbox->hide();
1242 if (
d->checkbox->parentWidget() ==
this) {
1243 d->checkbox->setParent(
nullptr);
1244 d->checkbox->deleteLater();
1251 d->checkbox->setSizePolicy(
sp);
1287 const QMessageBox::Options previousOptions =
options();
1288 if (!(previousOptions &
option) != !on)
1319 return QMessageBox::Options(
int(
d->options->options()));
1360 return d->label->text();
1366 d->label->setText(
text);
1446 return d->iconLabel->pixmap();
1452 d->iconLabel->setPixmap(
pixmap);
1471 return d->label->textFormat();
1477 d->label->setTextFormat(
format);
1480 if (
d->informativeLabel)
1481 d->informativeLabel->setTextFormat(
format);
1500 return d->label->textInteractionFlags();
1506 d->label->setTextInteractionFlags(
flags);
1515 switch (e->
type()) {
1517 d_func()->updateSize();
1520 d_func()->retranslateStrings();
1542 if (!
d->detectedEscapeButton) {
1547 if (!
d->clickedButton) {
1548 d->clickedButton =
d->detectedEscapeButton;
1549 setResult(
d->execReturnCode(
d->detectedEscapeButton));
1559 switch (ev->type()) {
1565 d->label->setTextInteractionFlags(
flags);
1567 if (
d->informativeLabel)
1568 d->informativeLabel->setTextInteractionFlags(
flags);
1577 d->label->setFont(
f);
1592#if QT_CONFIG(shortcut)
1595 if (
d->detectedEscapeButton) {
1597 d->detectedEscapeButton->animateClick();
1599 d->detectedEscapeButton->click();
1606#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
1608#if QT_CONFIG(textedit)
1610 if (
d->detailsText &&
d->detailsText->isVisible() &&
d->detailsText->copy()) {
1615 d->detailsText->selectAll();
1621#if defined(Q_OS_WIN)
1623 const auto separator =
"---------------------------\n"_L1;
1625 textToCopy += separator +
windowTitle() + u
'\n' + separator
1626 +
d->label->text() + u
'\n' + separator;
1628 if (
d->informativeLabel)
1629 textToCopy +=
d->informativeLabel->text() + u
'\n' + separator;
1631 const QList<QAbstractButton *>
buttons =
d->buttonBox->buttons();
1634 textToCopy += u
'\n' + separator;
1635#if QT_CONFIG(textedit)
1637 textToCopy +=
d->detailsText->text() + u
'\n' + separator;
1646#ifndef QT_NO_SHORTCUT
1648 int key = e->
key() &
~Qt::MODIFIER_MASK;
1650 const QList<QAbstractButton *>
buttons =
d->buttonBox->buttons();
1678 d->signalToDisconnectOnClose =
signal;
1679 d->receiverToDisconnectOnClose = receiver;
1680 d->memberToDisconnectOnClose = member;
1714 return d->buttonBox->buttons();
1737 d->clickedButton =
nullptr;
1740#if QT_CONFIG(accessibility)
1741 QAccessibleEvent
event(
this, QAccessible::Alert);
1742 QAccessible::updateAccessibility(&
event);
1744#if defined(Q_OS_WIN)
1745 if (
const HMENU systemMenu = qt_getWindowsSystemMenu(
this)) {
1746 EnableMenuItem(systemMenu, SC_CLOSE,
d->detectedEscapeButton ?
1747 MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED);
1757 QMessageBox::StandardButtons buttons,
1762 if (defaultButton && !(buttons & defaultButton)) {
1764 const int otherButtons = buttons.toInt();
1948 static QPointer<QMessageBox> oldMsgBox;
1950 if (oldMsgBox && oldMsgBox->text() ==
text) {
1953 oldMsgBox->activateWindow();
1972 d->buttonBox->setCenterButtons(
true);
2002 static QPointer<QMessageBox> oldMsgBox;
2007 oldMsgBox->activateWindow();
2012 QString translatedTextAboutQtCaption;
2013 translatedTextAboutQtCaption = QMessageBox::tr(
2015 "<p>This program uses Qt version %1.</p>"
2016 ).
arg(QT_VERSION_STR
""_L1);
2019 const QString translatedTextAboutQtText = QMessageBox::tr(
2020 "<p>Qt is a C++ toolkit for cross-platform application "
2022 "<p>Qt provides single-source portability across all major desktop "
2023 "operating systems. It is also available for embedded Linux and other "
2024 "embedded and mobile operating systems.</p>"
2025 "<p>Qt is available under multiple licensing options designed "
2026 "to accommodate the needs of our various users.</p>"
2027 "<p>Qt licensed under our commercial license agreement is appropriate "
2028 "for development of proprietary/commercial software where you do not "
2029 "want to share any source code with third parties or otherwise cannot "
2030 "comply with the terms of GNU (L)GPL.</p>"
2031 "<p>Qt licensed under GNU (L)GPL is appropriate for the "
2032 "development of Qt applications provided you can comply with the terms "
2033 "and conditions of the respective licenses.</p>"
2034 "<p>Please see <a href=\"https://%2/\">%2</a> "
2035 "for an overview of Qt licensing.</p>"
2036 "<p>Copyright (C) The Qt Company Ltd. and other "
2038 "<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
2039 "<p>Qt is The Qt Company Ltd. product developed as an open source "
2040 "project. See <a href=\"https://%3/\">%3</a> for more information.</p>"
2049 QPixmap pm(
":/qt-project.org/qmessagebox/images/qtlogo-64.png"_L1);
2057 d->buttonBox->setCenterButtons(
true);
2097 if (button0 &
flags) {
2099 }
else if (button1 &
flags) {
2101 }
else if (button2 &
flags) {
2113 q->setDefaultButton(
2132 int button0,
int button1,
int button2)
2135 messageBox.d_func()->addOldButtons(button0, button1, button2);
2144 int defaultButtonNumber,
2145 int escapeButtonNumber)
2148 QString myButton0Text = button0Text;
2149 if (myButton0Text.isEmpty())
2150 myButton0Text = QDialogButtonBox::tr(
"OK");
2152 if (!button1Text.isEmpty())
2154 if (!button2Text.isEmpty())
2157 const QList<QAbstractButton *> &buttonList =
messageBox.d_func()->customButtonList;
2166#if QT_CONFIG(textedit)
2172#if QT_DEPRECATED_SINCE(6,2)
2226 int button0,
int button1,
int button2,
QWidget *parent,
2229 f |
Qt::WindowTitleHint |
Qt::WindowSystemMenuHint |
Qt::WindowCloseButtonHint)
2234 d->addOldButtons(button0, button1, button2);
2277 int button0,
int button1,
int button2)
2280 button0, button1, button2);
2315 const QString& button2Text,
int defaultButtonNumber,
2316 int escapeButtonNumber)
2319 button0Text, button1Text, button2Text,
2320 defaultButtonNumber, escapeButtonNumber);
2364 int button0,
int button1,
int button2)
2367 button0, button1, button2);
2401 const QString& button2Text,
int defaultButtonNumber,
2402 int escapeButtonNumber)
2405 button0Text, button1Text, button2Text,
2406 defaultButtonNumber, escapeButtonNumber);
2450 int button0,
int button1,
int button2)
2453 button0, button1, button2);
2487 const QString& button2Text,
int defaultButtonNumber,
2488 int escapeButtonNumber)
2491 button0Text, button1Text, button2Text,
2492 defaultButtonNumber, escapeButtonNumber);
2536 int button0,
int button1,
int button2)
2539 button0, button1, button2);
2573 const QString& button2Text,
int defaultButtonNumber,
2574 int escapeButtonNumber)
2577 button0Text, button1Text, button2Text,
2578 defaultButtonNumber, escapeButtonNumber);
2595 return abstractButton->text();
2598 return QDialogButtonBox::tr(
"OK");
2616 abstractButton->setText(
text);
2625#if QT_CONFIG(textedit)
2637QString QMessageBox::detailedText()
const
2640 return d->detailsText ?
d->detailsText->text() :
QString();
2643void QMessageBox::setDetailedText(
const QString &
text)
2647 if (
d->detailsText) {
2648 d->detailsText->hide();
2649 d->detailsText->deleteLater();
2651 d->detailsText =
nullptr;
2653 if (
d->detailsButton) {
2654 d->detailsButton->hide();
2655 d->detailsButton->deleteLater();
2657 d->detailsButton =
nullptr;
2659 if (!
d->detailsText) {
2660 d->detailsText =
new QMessageBoxDetailsText(
this);
2661 d->detailsText->hide();
2663 if (!
d->detailsButton) {
2664 const bool autoAddOkButton =
d->autoAddOkButton;
2667 d->autoAddOkButton = autoAddOkButton;
2669 d->detailsText->setText(
text);
2699 return d->informativeLabel ?
d->informativeLabel->text() :
QString();
2706 if (
d->informativeLabel) {
2707 d->informativeLabel->hide();
2708 d->informativeLabel->deleteLater();
2710 d->informativeLabel =
nullptr;
2712 if (!
d->informativeLabel) {
2717 label->setOpenExternalLinks(
true);
2722 label->setWordWrap(
true);
2723 label->setTextFormat(
d->label->textFormat());
2724 d->informativeLabel =
label;
2726 d->informativeLabel->setText(
text);
2795 if (!tmpIcon.isNull()) {
2796 qreal dpr = mb ? mb->devicePixelRatio() :
qApp->devicePixelRatio();
2815 messageDialogHelper->setOptions(
options);
2837 QPlatformDialogHelper::StandardButtons buttons(
int(
q->standardButtons()));
2855 if (strcmp(QMessageBox::staticMetaObject.
className(),
q->metaObject()->className()) != 0)
2877#if QT_CONFIG(textedit)
2891 if (!standardButton)
2895 if (standardButton->text() != platformTheme->standardButtonText(
button)) {
2939 if (current >= required)
2941 std::optional<QApplication> application;
2943 application.emplace(argc, argv);
2944 const QString message = QApplication::tr(
"Application \"%1\" requires Qt %2, found Qt %3.")
2945 .
arg(
qAppName(), required.toString(), current.toString());
2951#if QT_DEPRECATED_SINCE(6,2)
3038#include "moc_qmessagebox.cpp"
3039#include "qmessagebox.moc"
static QWindow * windowForWidget(const QWidget *widget)
static QStyle * style()
Returns the application's style object.
static QFont font()
Returns the default application font.
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void clear()
Clears the contents of the byte array and makes it null.
The QCheckBox widget provides a checkbox with a text label.
void setCheckState(Qt::CheckState state)
Sets the checkbox's check state to state.
Qt::CheckState checkState() const
Returns the checkbox's check state.
The QCloseEvent class contains parameters that describe a close event.
static void removePostedEvents(QObject *receiver, int eventType=0)
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
bool setNativeDialogVisible(bool visible)
virtual void setVisible(bool visible)
virtual bool canBeNativeDialog() const
virtual int dialogCode() const
The QDialog class is the base class of dialog windows.
void closeEvent(QCloseEvent *) override
\reimp
void finished(int result)
void setResult(int r)
Sets the modal dialog's result code to i.
void keyPressEvent(QKeyEvent *) override
\reimp
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
void setModal(bool modal)
void resizeEvent(QResizeEvent *) override
\reimp
void showEvent(QShowEvent *) override
\reimp
friend class QPushButton
[1]
virtual void setAccepted(bool accepted)
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
\reentrant \inmodule QtGui
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
The QFrame class is the base class of widgets that can have a frame.
The QGridLayout class lays out widgets in a grid.
void setHorizontalSpacing(int spacing)
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setRowMinimumHeight(int row, int minSize)
Sets the minimum height of row row to minSize pixels.
int rowCount() const
Returns the number of rows in this grid.
void addItem(QLayoutItem *item, int row, int column, int rowSpan=1, int columnSpan=1, Qt::Alignment=Qt::Alignment())
Adds item at position row, column, spanning rowSpan rows and columnSpan columns, and aligns it accord...
void setVerticalSpacing(int spacing)
void setRowStretch(int row, int stretch)
Sets the stretch factor of row row to stretch.
int columnCount() const
Returns the number of columns in this grid.
static QPlatformTheme * platformTheme()
static QPlatformNativeInterface * platformNativeInterface()
static QClipboard * clipboard()
Returns the object for interacting with the clipboard.
The QIcon class provides scalable icons in different modes and states.
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
The QLabel widget provides a text or image display.
QPixmap pixmap
the label's pixmap.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
int totalHeightForWidth(int w) const
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
void setSizeConstraint(SizeConstraint)
bool activate()
Redoes the layout for parentWidget() if necessary.
QSize totalMinimumSize() const
void setContentsMargins(int left, int top, int right, int bottom)
T value(qsizetype i) const
QDialogButtonBox * buttonBox
QAbstractButton * abstractButtonForId(int id) const
QList< QAbstractButton * > customButtonList
void initHelper(QPlatformDialogHelper *) override
DetailButton * detailsButton
int execReturnCode(QAbstractButton *button)
bool canBeNativeDialog() const override
void addOldButtons(int button0, int button1, int button2)
void buttonClicked(QAbstractButton *)
void retranslateStrings()
QLabel * informativeLabel
static QPixmap standardIcon(QMessageBox::Icon icon, QMessageBox *mb)
void init(const QString &title=QString(), const QString &text=QString())
QAbstractButton * clickedButton
QPushButton * defaultButton
int dialogCode() const override
QSharedPointer< QMessageDialogOptions > options
void setVisible(bool visible) override
QAbstractButton * escapeButton
QPointer< QObject > receiverToDisconnectOnClose
static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2)
QByteArray memberToDisconnectOnClose
void helperPrepareShow(QPlatformDialogHelper *) override
QAbstractButton * findButton(int button0, int button1, int button2, int flags)
void setClickedButton(QAbstractButton *button)
static QMessageBox::StandardButton standardButtonForRole(QMessageBox::ButtonRole role)
void detectEscapeButton()
void helperClicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QAbstractButton * detectedEscapeButton
QByteArray signalToDisconnectOnClose
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
QList< QAbstractButton * > buttons() const
void closeEvent(QCloseEvent *event) override
\reimp
void changeEvent(QEvent *event) override
\reimp
void setEscapeButton(QAbstractButton *button)
bool testOption(Option option) const
void setStandardButtons(StandardButtons buttons)
void setWindowTitle(const QString &title)
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void buttonClicked(QAbstractButton *button)
This signal is emitted whenever a button is clicked inside the QMessageBox.
Qt::TextFormat textFormat
the format of the text displayed by the message box
StandardButtons standardButtons
collection of standard buttons in the message box
void keyPressEvent(QKeyEvent *event) override
\reimp
QMessageBox(QWidget *parent=nullptr)
Constructs an \l{Qt::ApplicationModal} {application modal} message box with no text and no buttons.
~QMessageBox()
Destroys the message box.
void addButton(QAbstractButton *button, ButtonRole role)
bool event(QEvent *e) override
\reimp
void removeButton(QAbstractButton *button)
void setInformativeText(const QString &text)
static void aboutQt(QWidget *parent, const QString &title=QString())
Displays a simple message box about Qt, with the given title and centered over parent (if parent is n...
void resizeEvent(QResizeEvent *event) override
\reimp
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void setOptions(Options options)
void setTextFormat(Qt::TextFormat format)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void showEvent(QShowEvent *event) override
\reimp
static void about(QWidget *parent, const QString &title, const QString &text)
Displays a simple about box with title title and text text.
QString text
the message box text to be displayed.
Icon icon
the message box's icon
QPushButton * defaultButton() const
Options options
Options that affect the look and feel of the dialog.
void setTextInteractionFlags(Qt::TextInteractionFlags flags)
void setWindowModality(Qt::WindowModality windowModality)
QAbstractButton * clickedButton() const
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=StandardButtons(Yes|No), StandardButton defaultButton=NoButton)
Icon
This enum has the following values:
void setIconPixmap(const QPixmap &pixmap)
Qt::TextInteractionFlags textInteractionFlags
void setCheckBox(QCheckBox *cb)
StandardButton standardButton(QAbstractButton *button) const
void setOption(Option option, bool on=true)
QPixmap iconPixmap
the current icon
QAbstractButton * escapeButton() const
ButtonRole buttonRole(QAbstractButton *button) const
void setText(const QString &text)
void setDefaultButton(QPushButton *button)
QString informativeText
the informative text that provides a fuller description for the message
QAbstractButton * button(StandardButton which) const
QCheckBox * checkBox() const
void setWindowTitle(const QString &)
void setInformativeText(const QString &text)
void setDefaultButton(int id)
void setDetailedText(const QString &text)
void setText(const QString &text)
int addButton(const QString &label, QPlatformDialogHelper::ButtonRole role, void *buttonImpl=nullptr, int buttonId=0)
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons)
const CustomButton * customButton(int id)
void clearCustomButtons()
void setCheckBox(const QString &label, Qt::CheckState state)
void setEscapeButton(int id)
void setStandardIcon(StandardIcon icon)
void setIconPixmap(const QPixmap &pixmap)
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
T findChild(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QResizeEvent class contains event parameters for resize events.
The QShowEvent class provides an event that is sent when a widget is shown.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
constexpr void setHeightForWidth(bool b) noexcept
Sets the flag determining whether the widget's preferred height depends on its width,...
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
The QSpacerItem class provides blank space in a layout.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_MessageBox_CenterButtons
@ SH_MessageBox_TextInteractionFlags
@ SP_MessageBoxInformation
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
void copyAvailable(bool b)
This signal is emitted when text is selected or de-selected in the text edit.
The QVBoxLayout class lines up widgets vertically.
static Q_CORE_EXPORT QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex=nullptr)
Combined button and popup list for selecting options.
Q_GUI_EXPORT bool mightBeRichText(QAnyStringView)
Returns true if the string text is likely to be rich text; otherwise returns false.
@ AA_DontUseNativeDialogs
static jboolean copy(JNIEnv *, jobject)
static jboolean selectAll(JNIEnv *, jobject)
FontHash * qt_app_fonts_hash()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static int oldButton(int button)
static QMessageDialogOptions::StandardIcon helperIcon(QMessageBox::Icon i)
static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
static QMessageBox::StandardButton newButton(int button)
static bool detectedCompat(int button0, int button1, int button2)
void qRequireVersion(int argc, char *argv[], QAnyStringView req)
static QPlatformDialogHelper::StandardButtons helperStandardButtons(QMessageBox *q)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLuint64 GLenum void * handle
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLsizei const GLchar * label
[43]
GLuint GLsizei const GLchar * message
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define qUtf16Printable(string)
#define QStringLiteral(str)
#define QT_CONFIG(feature)
QT_BEGIN_NAMESPACE constexpr std::underlying_type_t< Enum > qToUnderlying(Enum e) noexcept
QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char * qVersion(void) Q_DECL_NOEXCEPT
const char className[16]
[1]
if(qFloatDistance(a, b)<(1<< 7))
[0]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QMessageBox messageBox(this)
[2]
QGraphicsWidget * textEdit
myAction setIcon(SomeIcon)
insertRed setText("insert red text")
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept