diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-10 13:31:43 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-10 15:02:55 (GMT) |
commit | 4a8a851315ba10824ac107084ccff9de649418ea (patch) | |
tree | aa5c2696f6a3a5a8dd0e74b57c04003769f10455 /src/gui/widgets | |
parent | 747444c6776d948dad479e7b6f3564d0515d4e52 (diff) | |
download | Qt-4a8a851315ba10824ac107084ccff9de649418ea.zip Qt-4a8a851315ba10824ac107084ccff9de649418ea.tar.gz Qt-4a8a851315ba10824ac107084ccff9de649418ea.tar.bz2 |
removed superflous indirection (ie. using q->..) instead of using the
private class member.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qabstractbutton.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/qmdiarea.cpp | 32 | ||||
-rw-r--r-- | src/gui/widgets/qmdisubwindow.cpp | 24 | ||||
-rw-r--r-- | src/gui/widgets/qmdisubwindow_p.h | 2 |
4 files changed, 37 insertions, 41 deletions
diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index 1900016..f28288e 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -319,20 +319,16 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const return group->d_func()->buttonList; #endif - Q_Q(const QAbstractButton); - QList<QAbstractButton*>candidates; - if (q->parentWidget()) { - candidates = qFindChildren<QAbstractButton *>(q->parentWidget()); - if (autoExclusive) { - for (int i = candidates.count() - 1; i >= 0; --i) { - QAbstractButton *candidate = candidates.at(i); - if (!candidate->autoExclusive() + QList<QAbstractButton*>candidates = qFindChildren<QAbstractButton *>(parent); + if (autoExclusive) { + for (int i = candidates.count() - 1; i >= 0; --i) { + QAbstractButton *candidate = candidates.at(i); + if (!candidate->autoExclusive() #ifndef QT_NO_BUTTONGROUP - || candidate->group() + || candidate->group() #endif - ) - candidates.removeAt(i); - } + ) + candidates.removeAt(i); } } return candidates; diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index 6acd977..0235c04 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -800,12 +800,12 @@ void QMdiAreaPrivate::appendChild(QMdiSubWindow *child) Q_Q(QMdiArea); Q_ASSERT(child && childWindows.indexOf(child) == -1); - if (child->parent() != q->viewport()) - child->setParent(q->viewport(), child->windowFlags()); + if (child->parent() != viewport) + child->setParent(viewport, child->windowFlags()); childWindows.append(QPointer<QMdiSubWindow>(child)); if (!child->testAttribute(Qt::WA_Resized) && q->isVisible()) { - QSize newSize(child->sizeHint().boundedTo(q->viewport()->size())); + QSize newSize(child->sizeHint().boundedTo(viewport->size())); child->resize(newSize.expandedTo(qSmartMinSize(child))); } @@ -931,7 +931,7 @@ void QMdiAreaPrivate::rearrange(Rearranger *rearranger) widgets.move(indexToActive, 0); } - QRect domain = q->viewport()->rect(); + QRect domain = viewport->rect(); if (rearranger->type() == Rearranger::RegularTiler && !widgets.isEmpty()) domain = resizeToMinimumTileSize(minSubWindowSize, widgets.count()); @@ -1236,7 +1236,7 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in { Q_Q(QMdiArea); if (!minSubWindowSize.isValid() || subWindowCount <= 0) - return q->viewport()->rect(); + return viewport->rect(); // Calculate minimum size. const int columns = qMax(qCeil(qSqrt(qreal(subWindowCount))), 1); @@ -1255,10 +1255,10 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in // We don't want sub-subwindows to be placed at the edge, thus add 2 pixels. int minAreaWidth = minWidth + left + right + 2; int minAreaHeight = minHeight + top + bottom + 2; - if (q->horizontalScrollBar()->isVisible()) - minAreaHeight += q->horizontalScrollBar()->height(); - if (q->verticalScrollBar()->isVisible()) - minAreaWidth += q->verticalScrollBar()->width(); + if (hbar->isVisible()) + minAreaHeight += hbar->height(); + if (vbar->isVisible()) + minAreaWidth += vbar->width(); if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, 0, q)) { const int frame = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, q); minAreaWidth += 2 * frame; @@ -1268,23 +1268,23 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in topLevel->resize(topLevel->size() + diff); } - QRect domain = q->viewport()->rect(); + QRect domain = viewport->rect(); // Adjust domain width and provide horizontal scroll bar. if (domain.width() < minWidth) { domain.setWidth(minWidth); - if (q->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) + if (hbarpolicy == Qt::ScrollBarAlwaysOff) q->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - else if (q->horizontalScrollBar()->value() != 0) - q->horizontalScrollBar()->setValue(0); + else + hbar->setValue(0); } // Adjust domain height and provide vertical scroll bar. if (domain.height() < minHeight) { domain.setHeight(minHeight); - if (q->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) + if (vbarpolicy == Qt::ScrollBarAlwaysOff) q->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - else if (q->verticalScrollBar()->value() != 0) - q->verticalScrollBar()->setValue(0); + else + vbar->setValue(0); } return domain; } diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp index 56df8ea..b366c28 100644 --- a/src/gui/widgets/qmdisubwindow.cpp +++ b/src/gui/widgets/qmdisubwindow.cpp @@ -1115,7 +1115,7 @@ void QMdiSubWindowPrivate::updateDirtyRegions() void QMdiSubWindowPrivate::updateGeometryConstraints() { Q_Q(QMdiSubWindow); - if (!q->parent()) + if (!parent) return; internalMinimumSize = (!q->isMinimized() && !q->minimumSize().isNull()) @@ -1145,7 +1145,7 @@ void QMdiSubWindowPrivate::updateMask() if (!q->mask().isEmpty()) q->clearMask(); - if (!q->parent()) + if (!parent) return; if ((q->isMaximized() && !drawTitleBarWhenMaximized()) @@ -1168,7 +1168,7 @@ void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos) { Q_Q(QMdiSubWindow); Q_ASSERT(currentOperation != None); - Q_ASSERT(q->parent()); + Q_ASSERT(parent); uint cflags = operationMap.find(currentOperation).value().changeFlags; int posX = pos.x(); @@ -1235,7 +1235,7 @@ void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos) void QMdiSubWindowPrivate::setMinimizeMode() { Q_Q(QMdiSubWindow); - Q_ASSERT(q->parent()); + Q_ASSERT(parent); ensureWindowState(Qt::WindowMinimized); isShadeRequestFromMinimizeMode = true; @@ -1263,7 +1263,7 @@ void QMdiSubWindowPrivate::setMinimizeMode() void QMdiSubWindowPrivate::setNormalMode() { Q_Q(QMdiSubWindow); - Q_ASSERT(q->parent()); + Q_ASSERT(parent); isShadeMode = false; isMaximizeMode = false; @@ -1334,7 +1334,7 @@ void QMdiSubWindowPrivate::setNormalMode() void QMdiSubWindowPrivate::setMaximizeMode() { Q_Q(QMdiSubWindow); - Q_ASSERT(q->parent()); + Q_ASSERT(parent); ensureWindowState(Qt::WindowMaximized); isShadeMode = false; @@ -1423,7 +1423,7 @@ void QMdiSubWindowPrivate::setMaximizeMode() void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) { Q_Q(QMdiSubWindow); - if (!q->parent() || !activationEnabled) + if (!parent || !activationEnabled) return; if (activate && !isActive && q->isEnabled()) { @@ -1711,7 +1711,7 @@ void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state) int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const { Q_Q(const QMdiSubWindow); - if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint + if (!parent || q->windowFlags() & Qt::FramelessWindowHint || (q->isMaximized() && !drawTitleBarWhenMaximized())) { return 0; } @@ -1734,7 +1734,7 @@ void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const { Q_Q(const QMdiSubWindow); Qt::WindowFlags flags = q->windowFlags(); - if (!q->parent() || flags & Qt::FramelessWindowHint) { + if (!parent || flags & Qt::FramelessWindowHint) { *margin = 0; *minWidth = 0; return; @@ -1893,7 +1893,7 @@ void QMdiSubWindowPrivate::enterRubberBandMode() if (q->isMaximized()) return; Q_ASSERT(oldGeometry.isValid()); - Q_ASSERT(q->parent()); + Q_ASSERT(parent); if (!rubberBand) { rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget()); // For accessibility to identify this special widget. @@ -2079,7 +2079,7 @@ void QMdiSubWindowPrivate::restoreFocus() void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags) { Q_Q(QMdiSubWindow); - if (!q->parent()) { + if (!parent) { q->setWindowFlags(windowFlags); return; } @@ -2164,7 +2164,7 @@ void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QStri QSize QMdiSubWindowPrivate::iconSize() const { Q_Q(const QMdiSubWindow); - if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint) + if (!parent || q->windowFlags() & Qt::FramelessWindowHint) return QSize(-1, -1); return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight()); } diff --git a/src/gui/widgets/qmdisubwindow_p.h b/src/gui/widgets/qmdisubwindow_p.h index 2e672d6..394f11c 100644 --- a/src/gui/widgets/qmdisubwindow_p.h +++ b/src/gui/widgets/qmdisubwindow_p.h @@ -287,7 +287,7 @@ public: inline int titleBarHeight() const { Q_Q(const QMdiSubWindow); - if (!q->parent() || q->windowFlags() & Qt::FramelessWindowHint + if (!parent || q->windowFlags() & Qt::FramelessWindowHint || (q->isMaximized() && !drawTitleBarWhenMaximized())) { return 0; } |