10#if QT_CONFIG(messagebox)
85 options->setWindowTitle(
q->windowTitle());
86 options->setText(QErrorMessage::tr(
"An error occurred"));
90 messageDialogHelper->setOptions(options);
94class QErrorMessageTextView :
public QTextEdit
97 QErrorMessageTextView(
QWidget *parent)
98 :
QTextEdit(parent) { setReadOnly(
true); }
100 virtual QSize minimumSizeHint()
const override;
101 virtual QSize sizeHint()
const override;
105QSize QErrorMessageTextView::minimumSizeHint()
const
107 return QSize(50, 50);
110QSize QErrorMessageTextView::sizeHint()
const
112 return QSize(250, 75);
176 const char *
const messages[] = {
183 Q_ASSERT(
size_t(
t) <
sizeof messages /
sizeof *messages);
192 const auto forwardToOriginalHandler =
qScopeGuard([&] {
201 if (
context.category && defaultCategory
202 &&
qstrcmp(
context.category, defaultCategory->categoryName()) != 0)
209 if (rich.endsWith(
"</p>"_L1))
240#if defined(Q_OS_MACOS)
245 d->errors =
new QErrorMessageTextView(
this);
259#if QT_CONFIG(messagebox)
265 d->again->setChecked(
true);
268 d->retranslateStrings();
281 if (currentMessagHandler !=
jump)
295 if (!
d->again->isChecked()) {
296 if (
d->currentType.isEmpty()) {
297 if (!
d->currentMessage.isEmpty())
298 d->doNotShow.insert(
d->currentMessage);
300 d->doNotShowType.insert(
d->currentType);
303 d->currentMessage.clear();
304 d->currentType.clear();
308 if (
d->nextPending()) {
356#ifndef QT_NO_TEXTHTMLPARSER
431 d->retranslateStrings();
438 again->
setText(QErrorMessage::tr(
"&Show this message again"));
444#include "moc_qerrormessage.cpp"
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.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
QString applicationName
the name of this application
bool setNativeDialogVisible(bool visible)
virtual void setVisible(bool visible)
virtual bool canBeNativeDialog() const
The QDialog class is the base class of dialog windows.
friend class QPushButton
[1]
virtual void done(int)
Closes the dialog and sets its result code to r.
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
void helperPrepareShow(QPlatformDialogHelper *) override
void retranslateStrings()
void initHelper(QPlatformDialogHelper *) override
QSet< QString > doNotShowType
bool isMessageToBeShown(const QString &message, const QString &type) const
std::queue< Message > pending
void setVisible(bool) override
QSet< QString > doNotShow
The QErrorMessage class provides an error message display dialog.
static QErrorMessage * qtHandler()
Returns a pointer to a QErrorMessage object that outputs the default Qt messages.
void showMessage(const QString &message)
Shows the given message, message, and returns immediately.
void done(int) override
\reimp
void changeEvent(QEvent *e) override
\reimp
QErrorMessage(QWidget *parent=nullptr)
Constructs and installs an error handler window with the given parent.
~QErrorMessage()
Destroys the error message dialog.
Type type() const
Returns the event type.
The QGridLayout class lays out widgets in a grid.
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setRowStretch(int row, int stretch)
Sets the stretch factor of row row to stretch.
void setColumnStretch(int column, int stretch)
Sets the stretch factor of column column to stretch.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
The QLabel widget provides a text or image display.
static QLoggingCategory * defaultCategory()
Returns a pointer to the global category "default" that is used, for example, by qDebug(),...
static QSharedPointer< QMessageDialogOptions > create()
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
qreal devicePixelRatio() const
bool contains(const T &value) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
@ 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 setPlainText(const QString &text)
Changes the text of the text edit to the string text.
void setHtml(const QString &text)
static QThread * currentThread()
QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
Combined button and popup list for selecting options.
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode=WhiteSpacePre)
Converts the plain text string plain to an HTML-formatted paragraph while preserving most of its look...
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
void qAddPostRoutine(QtCleanUpFunction p)
static QString msgType2i18nString(QtMsgType t)
static void deleteStaticcQErrorMessage()
static QErrorMessage * qtMessageHandler
static QtMessageHandler originalMessageHandler
static void jump(QtMsgType t, const QMessageLogContext &context, const QString &m)
void(* QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &)
#define Q_ARG(Type, data)
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLsizei const GLchar * message
GLdouble GLdouble GLdouble GLdouble q
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
#define QT_TRANSLATE_NOOP(scope, x)