diff options
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index e74f17b6f7..eec60b14d0 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -129,11 +129,11 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w) if (lay) { lay->addItem(this); } else if (w) { - if (w->layout()) { - qWarning("QLayout: Attempting to add QLayout \"%s\" to %s \"%s\", which" + if (Q_UNLIKELY(w->layout())) { + qWarning("QLayout: Attempting to add QLayout \"%ls\" to %s \"%ls\", which" " already has a layout", - qPrintable(QObject::objectName()), w->metaObject()->className(), - w->objectName().toLocal8Bit().data()); + qUtf16Printable(QObject::objectName()), w->metaObject()->className(), + qUtf16Printable(w->objectName())); setParent(0); } else { d->topLevel = true; @@ -469,7 +469,7 @@ QWidget *QLayout::parentWidget() const if (!d->topLevel) { if (parent()) { QLayout *parentLayout = qobject_cast<QLayout*>(parent()); - if (!parentLayout) { + if (Q_UNLIKELY(!parentLayout)) { qWarning("QLayout::parentWidget: A layout can only have another layout as a parent."); return 0; } @@ -776,9 +776,9 @@ QLayout::~QLayout() */ void QLayout::addChildLayout(QLayout *l) { - if (l->parent()) { - qWarning("QLayout::addChildLayout: layout \"%s\" already has a parent", - l->objectName().toLocal8Bit().data()); + if (Q_UNLIKELY(l->parent())) { + qWarning("QLayout::addChildLayout: layout \"%ls\" already has a parent", + qUtf16Printable(l->objectName())); return; } l->setParent(this); @@ -826,9 +826,9 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) if (QWidget *w = item->widget()) { QWidget *pw = w->parentWidget(); #ifdef QT_DEBUG - if (pw && pw != mw && layoutDebug()) { - qWarning("QLayout::addChildLayout: widget %s \"%s\" in wrong parent; moved to correct parent", - w->metaObject()->className(), w->objectName().toLocal8Bit().data()); + if (Q_UNLIKELY(pw && pw != mw && layoutDebug())) { + qWarning("QLayout::addChildLayout: widget %s \"%ls\" in wrong parent; moved to correct parent", + w->metaObject()->className(), qUtf16Printable(w->objectName())); } #endif bool needShow = mwVisible && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)); @@ -849,15 +849,15 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) bool QLayoutPrivate::checkWidget(QWidget *widget) const { Q_Q(const QLayout); - if (!widget) { - qWarning("QLayout: Cannot add a null widget to %s/%s", q->metaObject()->className(), - qPrintable(q->objectName())); + if (Q_UNLIKELY(!widget)) { + qWarning("QLayout: Cannot add a null widget to %s/%ls", q->metaObject()->className(), + qUtf16Printable(q->objectName())); return false; } - if (widget == q->parentWidget()) { - qWarning("QLayout: Cannot add parent widget %s/%s to its child layout %s/%s", - widget->metaObject()->className(), qPrintable(widget->objectName()), - q->metaObject()->className(), qPrintable(q->objectName())); + if (Q_UNLIKELY(widget == q->parentWidget())) { + qWarning("QLayout: Cannot add parent widget %s/%ls to its child layout %s/%ls", + widget->metaObject()->className(), qUtf16Printable(widget->objectName()), + q->metaObject()->className(), qUtf16Printable(q->objectName())); return false; } return true; @@ -870,14 +870,14 @@ bool QLayoutPrivate::checkWidget(QWidget *widget) const bool QLayoutPrivate::checkLayout(QLayout *otherLayout) const { Q_Q(const QLayout); - if (!otherLayout) { - qWarning("QLayout: Cannot add a null layout to %s/%s", q->metaObject()->className(), - qPrintable(q->objectName())); + if (Q_UNLIKELY(!otherLayout)) { + qWarning("QLayout: Cannot add a null layout to %s/%ls", + q->metaObject()->className(), qUtf16Printable(q->objectName())); return false; } - if (otherLayout == q) { - qWarning("QLayout: Cannot add layout %s/%s to itself", q->metaObject()->className(), - qPrintable(q->objectName())); + if (Q_UNLIKELY(otherLayout == q)) { + qWarning("QLayout: Cannot add layout %s/%ls to itself", + q->metaObject()->className(), qUtf16Printable(q->objectName())); return false; } return true; @@ -902,17 +902,17 @@ void QLayout::addChildWidget(QWidget *w) QLayout *l = pw->layout(); if (l && removeWidgetRecursively(l, w)) { #ifdef QT_DEBUG - if (layoutDebug()) - qWarning("QLayout::addChildWidget: %s \"%s\" is already in a layout; moved to new layout", - w->metaObject()->className(), w->objectName().toLocal8Bit().data()); + if (Q_UNLIKELY(layoutDebug())) + qWarning("QLayout::addChildWidget: %s \"%ls\" is already in a layout; moved to new layout", + w->metaObject()->className(), qUtf16Printable(w->objectName())); #endif } } if (pw && mw && pw != mw) { #ifdef QT_DEBUG - if (layoutDebug()) - qWarning("QLayout::addChildWidget: %s \"%s\" in wrong parent; moved to correct parent", - w->metaObject()->className(), w->objectName().toLocal8Bit().data()); + if (Q_UNLIKELY(layoutDebug())) + qWarning("QLayout::addChildWidget: %s \"%ls\" in wrong parent; moved to correct parent", + w->metaObject()->className(), qUtf16Printable(w->objectName())); #endif pw = 0; } @@ -1064,9 +1064,9 @@ bool QLayout::activate() if (d->activated) return false; QWidget *mw = static_cast<QWidget*>(parent()); - if (mw == 0) { - qWarning("QLayout::activate: %s \"%s\" does not have a main widget", - QObject::metaObject()->className(), QObject::objectName().toLocal8Bit().data()); + if (Q_UNLIKELY(!mw)) { + qWarning("QLayout::activate: %s \"%ls\" does not have a main widget", + metaObject()->className(), qUtf16Printable(objectName())); return false; } activateRecursiveHelper(this); |