summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-11 08:51:54 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-11 14:07:01 (GMT)
commit0f60b6e05a707630e02655c60ae60884262a4b8e (patch)
tree564982f5dc6a2266818e050b2576ef4f5e74eaf5
parentf0a4a37a5182660580fd361110d3fd51463221d8 (diff)
downloadQt-0f60b6e05a707630e02655c60ae60884262a4b8e.zip
Qt-0f60b6e05a707630e02655c60ae60884262a4b8e.tar.gz
Qt-0f60b6e05a707630e02655c60ae60884262a4b8e.tar.bz2
remove q->layout() and q->parentWidget() code where unnecessary
-rw-r--r--src/corelib/io/qfile.cpp6
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp3
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp6
-rw-r--r--src/gui/dialogs/qmessagebox.cpp14
-rw-r--r--src/gui/itemviews/qtreewidget.cpp10
-rw-r--r--src/gui/kernel/qapplication_win.cpp10
-rw-r--r--src/gui/kernel/qwidget.cpp8
-rw-r--r--src/gui/widgets/qdockwidget.cpp75
-rw-r--r--src/gui/widgets/qmdiarea.cpp2
-rw-r--r--src/gui/widgets/qmdisubwindow.cpp12
-rw-r--r--src/gui/widgets/qmdisubwindow_p.h2
-rw-r--r--src/gui/widgets/qpushbutton.cpp2
-rw-r--r--src/gui/widgets/qspinbox.cpp13
-rw-r--r--src/gui/widgets/qsplitter.cpp2
-rw-r--r--src/gui/widgets/qtoolbar.cpp8
-rw-r--r--src/gui/widgets/qtoolbutton.cpp4
16 files changed, 84 insertions, 93 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 4deaddb..bfb1aae 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -154,17 +154,15 @@ QFilePrivate::setError(QFile::FileError err)
void
QFilePrivate::setError(QFile::FileError err, const QString &errStr)
{
- Q_Q(QFile);
error = err;
- q->setErrorString(errStr);
+ errorString = errStr;
}
void
QFilePrivate::setError(QFile::FileError err, int errNum)
{
- Q_Q(QFile);
error = err;
- q->setErrorString(qt_error_string(errNum));
+ errorString = qt_error_string(errNum);
}
//************* QFile
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index b9a50a2..973057b 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -89,8 +89,7 @@ QAbstractStatePrivate *QAbstractStatePrivate::get(QAbstractState *q)
QStateMachine *QAbstractStatePrivate::machine() const
{
- Q_Q(const QAbstractState);
- QObject *par = q->parent();
+ QObject *par = parent;
while (par != 0) {
if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
return mach;
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index f582b8c..c1b553c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -113,8 +113,7 @@ QAbstractTransitionPrivate *QAbstractTransitionPrivate::get(QAbstractTransition
QStateMachine *QAbstractTransitionPrivate::machine() const
{
- Q_Q(const QAbstractTransition);
- QObject *par = q->parent();
+ QObject *par = parent;
while (par != 0) {
if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
return mach;
@@ -137,8 +136,7 @@ void QAbstractTransitionPrivate::callOnTransition(QEvent *e)
QState *QAbstractTransitionPrivate::sourceState() const
{
- Q_Q(const QAbstractTransition);
- return qobject_cast<QState*>(q->parent());
+ return qobject_cast<QState*>(parent);
}
/*!
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index 648cda8..c526c7d 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -258,10 +258,8 @@ void QMessageBoxPrivate::init(const QString &title, const QString &text)
int QMessageBoxPrivate::layoutMinimumWidth()
{
- Q_Q(QMessageBox);
-
- q->layout()->activate();
- return q->layout()->totalMinimumSize().width();
+ layout->activate();
+ return layout->totalMinimumSize().width();
}
void QMessageBoxPrivate::updateSize()
@@ -339,10 +337,10 @@ void QMessageBoxPrivate::updateSize()
if (windowTitleWidth > width)
width = windowTitleWidth;
- q->layout()->activate();
- int height = (q->layout()->hasHeightForWidth())
- ? q->layout()->totalHeightForWidth(width)
- : q->layout()->totalMinimumSize().height();
+ layout->activate();
+ int height = (layout->hasHeightForWidth())
+ ? layout->totalHeightForWidth(width)
+ : layout->totalMinimumSize().height();
q->setFixedSize(width, height);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 5604f8d..24713c4 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2280,10 +2280,9 @@ void QTreeWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
void QTreeWidgetPrivate::_q_sort()
{
- Q_Q(QTreeWidget);
if (sortingEnabled) {
- int column = q->header()->sortIndicatorSection();
- Qt::SortOrder order = q->header()->sortIndicatorOrder();
+ int column = header->sortIndicatorSection();
+ Qt::SortOrder order = header->sortIndicatorOrder();
model()->sort(column, order);
}
}
@@ -2311,12 +2310,11 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con
void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
- Q_Q(QTreeWidget);
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()
&& !model()->sortPendingTimer.isActive()) {
- int column = q->header()->sortIndicatorSection();
+ int column = header->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
- Qt::SortOrder order = q->header()->sortIndicatorOrder();
+ Qt::SortOrder order = header->sortIndicatorOrder();
model()->ensureSorted(column, order, topLeft.row(),
bottomRight.row(), topLeft.parent());
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index b21eb36..8d77c4c 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2748,9 +2748,9 @@ void QApplicationPrivate::openPopup(QWidget *popup)
if (popup->focusWidget()) {
popup->focusWidget()->setFocus(Qt::PopupFocusReason);
} else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup
- if (QWidget *fw = q_func()->focusWidget()) {
+ if (QWidget *fw = QApplication::focusWidget()) {
QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
+ QApplication::sendEvent(fw, &e);
}
}
}
@@ -2777,13 +2777,13 @@ void QApplicationPrivate::closePopup(QWidget *popup)
if (!qt_nograb()) // grabbing not disabled
releaseAutoCapture();
QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget()
- : q_func()->focusWidget();
+ : QApplication::focusWidget();
if (fw) {
- if (fw != q_func()->focusWidget()) {
+ if (fw != QApplication::focusWidget()) {
fw->setFocus(Qt::PopupFocusReason);
} else {
QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
- q_func()->sendEvent(fw, &e);
+ QApplication::sendEvent(fw, &e);
}
}
} else {
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 61d8f20..230b8f6 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7268,10 +7268,10 @@ QSize QWidgetPrivate::adjustedSize() const
if (q->isWindow()) {
Qt::Orientations exp;
- if (QLayout *l = q->layout()) {
- if (l->hasHeightForWidth())
- s.setHeight(l->totalHeightForWidth(s.width()));
- exp = l->expandingDirections();
+ if (layout) {
+ if (layout->hasHeightForWidth())
+ s.setHeight(layout->totalHeightForWidth(s.width()));
+ exp = layout->expandingDirections();
} else
{
if (q->sizePolicy().hasHeightForWidth())
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 6a0c879..30f9a87 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -69,6 +69,9 @@ extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); /
extern QHash<QByteArray, QFont> *qt_app_fonts_hash(); // qapplication.cpp
+static inline bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
+{ return (priv->features & feature) == feature; }
+
static inline bool hasFeature(const QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
{ return (dockwidget->features() & feature) == feature; }
@@ -647,25 +650,25 @@ void QDockWidgetPrivate::_q_toggleView(bool b)
void QDockWidgetPrivate::updateButtons()
{
Q_Q(QDockWidget);
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
QStyleOptionDockWidget opt;
q->initStyleOption(&opt);
- bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
- bool nativeDeco = layout->nativeWindowDeco();
+ bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0;
+ bool nativeDeco = dwLayout->nativeWindowDeco();
bool hideButtons = nativeDeco || customTitleBar;
- bool canClose = hasFeature(q, QDockWidget::DockWidgetClosable);
- bool canFloat = hasFeature(q, QDockWidget::DockWidgetFloatable);
+ bool canClose = hasFeature(this, QDockWidget::DockWidgetClosable);
+ bool canFloat = hasFeature(this, QDockWidget::DockWidgetFloatable);
QAbstractButton *button
- = qobject_cast<QAbstractButton*>(layout->widgetForRole(QDockWidgetLayout::FloatButton));
+ = qobject_cast<QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::FloatButton));
button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q));
button->setVisible(canFloat && !hideButtons);
button
- = qobject_cast <QAbstractButton*>(layout->widgetForRole(QDockWidgetLayout::CloseButton));
+ = qobject_cast <QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::CloseButton));
button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q));
button->setVisible(canClose && !hideButtons);
@@ -688,7 +691,7 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca)
if (state != 0)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -741,15 +744,15 @@ void QDockWidgetPrivate::endDrag(bool abort)
q->releaseMouse();
if (state->dragging) {
- QMainWindowLayout *layout =
+ QMainWindowLayout *mwLayout =
qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout());
- Q_ASSERT(layout != 0);
+ Q_ASSERT(mwLayout != 0);
- if (abort || !layout->plug(state->widgetItem)) {
- if (hasFeature(q, QDockWidget::DockWidgetFloatable)) {
+ if (abort || !mwLayout->plug(state->widgetItem)) {
+ if (hasFeature(this, QDockWidget::DockWidgetFloatable)) {
if (state->ownWidgetItem)
delete state->widgetItem;
- layout->restore();
+ mwLayout->restore();
#ifdef Q_WS_X11
// get rid of the X11BypassWindowManager window flag and activate the resizer
Qt::WindowFlags flags = q->windowFlags();
@@ -759,14 +762,14 @@ void QDockWidgetPrivate::endDrag(bool abort)
q->show();
#else
QDockWidgetLayout *myLayout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ = qobject_cast<QDockWidgetLayout*>(layout);
resizer->setActive(QWidgetResizeHandler::Resize,
myLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0);
#endif
undockedGeometry = q->geometry();
q->activateWindow();
} else {
- layout->revert(state->widgetItem);
+ mwLayout->revert(state->widgetItem);
}
}
}
@@ -778,7 +781,7 @@ bool QDockWidgetPrivate::isAnimating() const
{
Q_Q(const QDockWidget);
- QMainWindow *mainWin = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *mainWin = qobject_cast<QMainWindow*>(parent);
if (mainWin == 0)
return false;
@@ -795,18 +798,18 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
#if !defined(QT_NO_MAINWINDOW)
Q_Q(QDockWidget);
- QDockWidgetLayout *layout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ QDockWidgetLayout *dwLayout
+ = qobject_cast<QDockWidgetLayout*>(layout);
- if (!layout->nativeWindowDeco()) {
- QRect titleArea = layout->titleArea();
+ if (!dwLayout->nativeWindowDeco()) {
+ QRect titleArea = dwLayout->titleArea();
if (event->button() != Qt::LeftButton ||
!titleArea.contains(event->pos()) ||
// check if the tool window is movable... do nothing if it
// is not (but allow moving if the window is floating)
- (!hasFeature(q, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
- qobject_cast<QMainWindow*>(q->parentWidget()) == 0 ||
+ (!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) ||
+ qobject_cast<QMainWindow*>(parent) == 0 ||
isAnimating() || state != 0) {
return false;
}
@@ -814,7 +817,7 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
initDrag(event->pos(), false);
if (state)
- state->ctrlDrag = hasFeature(q, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;
+ state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;
return true;
}
@@ -825,15 +828,13 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event)
{
- Q_Q(QDockWidget);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
-
- if (!layout->nativeWindowDeco()) {
- QRect titleArea = layout->titleArea();
+ if (!dwLayout->nativeWindowDeco()) {
+ QRect titleArea = dwLayout->titleArea();
if (event->button() == Qt::LeftButton && titleArea.contains(event->pos()) &&
- hasFeature(q, QDockWidget::DockWidgetFloatable)) {
+ hasFeature(this, QDockWidget::DockWidgetFloatable)) {
_q_toggleTopLevel();
return true;
}
@@ -851,7 +852,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
return ret;
QDockWidgetLayout *dwlayout
- = qobject_cast<QDockWidgetLayout*>(q->layout());
+ = qobject_cast<QDockWidgetLayout*>(layout);
QMainWindowLayout *mwlayout
= qobject_cast<QMainWindowLayout*>(q->parentWidget()->layout());
if (!dwlayout->nativeWindowDeco()) {
@@ -924,7 +925,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
break;
if (state != 0)
break;
- if (qobject_cast<QMainWindow*>(q->parentWidget()) == 0)
+ if (qobject_cast<QMainWindow*>(parent) == 0)
break;
if (isAnimating())
break;
@@ -997,9 +998,9 @@ void QDockWidgetPrivate::unplug(const QRect &rect)
Q_Q(QDockWidget);
QRect r = rect;
r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
- if (layout->nativeWindowDeco(true))
- r.adjust(0, layout->titleHeight(), 0, 0);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
+ if (dwLayout->nativeWindowDeco(true))
+ r.adjust(0, dwLayout->titleHeight(), 0, 0);
setWindowState(true, true, r);
}
@@ -1020,12 +1021,12 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
Qt::WindowFlags flags = floating ? Qt::Tool : Qt::Widget;
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(q->layout());
- const bool nativeDeco = layout->nativeWindowDeco(floating);
+ QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
+ const bool nativeDeco = dwLayout->nativeWindowDeco(floating);
if (nativeDeco) {
flags |= Qt::CustomizeWindowHint | Qt::WindowTitleHint;
- if (hasFeature(q, QDockWidget::DockWidgetClosable))
+ if (hasFeature(this, QDockWidget::DockWidgetClosable))
flags |= Qt::WindowCloseButtonHint;
} else {
flags |= Qt::FramelessWindowHint;
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index 0235c04..efaa2d3 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -1212,7 +1212,7 @@ void QMdiAreaPrivate::internalRaise(QMdiSubWindow *mdiChild) const
QMdiSubWindow *stackUnderChild = 0;
if (!windowStaysOnTop(mdiChild)) {
- foreach (QObject *object, q_func()->viewport()->children()) {
+ foreach (QObject *object, viewport->children()) {
QMdiSubWindow *child = qobject_cast<QMdiSubWindow *>(object);
if (!child || !childWindows.contains(child))
continue;
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
index b366c28..e5cc6b6 100644
--- a/src/gui/widgets/qmdisubwindow.cpp
+++ b/src/gui/widgets/qmdisubwindow.cpp
@@ -1006,7 +1006,7 @@ void QMdiSubWindowPrivate::removeBaseWidget()
Q_Q(QMdiSubWindow);
baseWidget->removeEventFilter(q);
- if (QLayout *layout = q->layout())
+ if (layout)
layout->removeWidget(baseWidget);
if (baseWidget->windowTitle() == q->windowTitle()) {
ignoreWindowTitleChange = true;
@@ -1102,7 +1102,7 @@ void QMdiSubWindowPrivate::updateCursor()
void QMdiSubWindowPrivate::updateDirtyRegions()
{
// No update necessary
- if (!q_func()->parent())
+ if (!parent)
return;
foreach (Operation operation, operationMap.keys())
@@ -2180,17 +2180,17 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
if (!newSizeGrip || sizeGrip || q->windowFlags() & Qt::FramelessWindowHint)
return;
- if (q->layout() && q->layout()->indexOf(newSizeGrip) != -1)
+ if (layout && layout->indexOf(newSizeGrip) != -1)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
- bool putSizeGripInLayout = q->layout() ? true : false;
+ bool putSizeGripInLayout = layout ? true : false;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
if (qobject_cast<QMacStyle *>(q->style()))
putSizeGripInLayout = false;
#endif
if (putSizeGripInLayout) {
- q->layout()->addWidget(newSizeGrip);
- q->layout()->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
+ layout->addWidget(newSizeGrip);
+ layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
} else {
newSizeGrip->setParent(q);
newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0,
diff --git a/src/gui/widgets/qmdisubwindow_p.h b/src/gui/widgets/qmdisubwindow_p.h
index 394f11c..d706546 100644
--- a/src/gui/widgets/qmdisubwindow_p.h
+++ b/src/gui/widgets/qmdisubwindow_p.h
@@ -308,7 +308,7 @@ public:
inline void setNewGeometry(QRect *geometry)
{
Q_Q(QMdiSubWindow);
- Q_ASSERT(q->parent());
+ Q_ASSERT(parent);
geometry->setSize(geometry->size().expandedTo(internalMinimumSize));
#ifndef QT_NO_RUBBERBAND
if (isInRubberBandMode)
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index ca58f87..5001001 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -576,7 +576,7 @@ void QPushButtonPrivate::_q_popupPressed()
menu->setNoReplayFor(q);
bool horizontal = true;
#if !defined(QT_NO_TOOLBAR)
- QToolBar *tb = qobject_cast<QToolBar*>(q->parentWidget());
+ QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
#endif
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index f12946c..a9b9a84 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -983,7 +983,7 @@ QVariant QSpinBoxPrivate::valueFromText(const QString &text) const
bool QSpinBoxPrivate::isIntermediateValue(const QString &str) const
{
- const int num = q_func()->locale().toInt(str, 0, 10);
+ const int num = locale.toInt(str, 0, 10);
const int min = minimum.toInt();
const int max = maximum.toInt();
@@ -1053,13 +1053,13 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else {
bool ok = false;
bool removedThousand = false;
- num = q_func()->locale().toInt(copy, &ok, 10);
+ num = locale.toInt(copy, &ok, 10);
if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) {
const int s = copy.size();
copy.remove(thousand);
pos = qMax(0, pos - (s - copy.size()));
removedThousand = true;
- num = q_func()->locale().toInt(copy, &ok, 10);
+ num = locale.toInt(copy, &ok, 10);
}
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
if (!ok) {
@@ -1346,9 +1346,8 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
{
bool ok = false;
- QLocale loc(q_func()->locale());
- num = loc.toDouble(copy, &ok);
- QSBDEBUG() << __FILE__ << __LINE__ << loc << copy << num << ok;
+ num = locale.toDouble(copy, &ok);
+ QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
bool notAcceptable = false;
if (!ok) {
@@ -1373,7 +1372,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
pos = qMax(0, pos - (s - copy.size()));
- num = loc.toDouble(copy, &ok);
+ num = locale.toDouble(copy, &ok);
QSBDEBUG() << thousand << num << copy << ok;
if (!ok) {
diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp
index 400d78a..24a8b6c 100644
--- a/src/gui/widgets/qsplitter.cpp
+++ b/src/gui/widgets/qsplitter.cpp
@@ -397,7 +397,7 @@ void QSplitterPrivate::recalc(bool update)
}
if (empty) {
- if (qobject_cast<QSplitter *>(q->parentWidget())) {
+ if (qobject_cast<QSplitter *>(parent)) {
// nested splitters; be nice
maxl = maxt = 0;
} else {
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index d765794..20f2c23 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -198,7 +198,7 @@ void QToolBarPrivate::initDrag(const QPoint &pos)
if (state != 0)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -224,7 +224,7 @@ void QToolBarPrivate::startDrag(bool moving)
if ((moving && state->moving) || state->dragging)
return;
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
Q_ASSERT(win != 0);
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
Q_ASSERT(layout != 0);
@@ -283,7 +283,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
// drag between toolbar contents to move the window. Make this work by
// implementing the standard mouse-dragging code and then call
// window->move() in mouseMoveEvent below.
- if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->parentWidget())) {
+ if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parent)) {
if (mainWindow->toolBarArea(q) == Qt::TopToolBarArea
&& mainWindow->unifiedTitleAndToolBarOnMac()
&& q->childAt(event->pos()) == 0) {
@@ -337,7 +337,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
return false;
}
- QMainWindow *win = qobject_cast<QMainWindow*>(q->parentWidget());
+ QMainWindow *win = qobject_cast<QMainWindow*>(parent);
if (win == 0)
return true;
diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp
index 20b84ef..7d41d1e 100644
--- a/src/gui/widgets/qtoolbutton.cpp
+++ b/src/gui/widgets/qtoolbutton.cpp
@@ -278,7 +278,7 @@ void QToolButtonPrivate::init()
#endif
defaultAction = 0;
#ifndef QT_NO_TOOLBAR
- if (qobject_cast<QToolBar*>(q->parentWidget()))
+ if (qobject_cast<QToolBar*>(parent))
autoRaise = true;
else
#endif
@@ -890,7 +890,7 @@ void QToolButtonPrivate::popupTimerDone()
q->setAutoRepeat(false);
bool horizontal = true;
#if !defined(QT_NO_TOOLBAR)
- QToolBar *tb = qobject_cast<QToolBar*>(q->parentWidget());
+ QToolBar *tb = qobject_cast<QToolBar*>(parent);
if (tb && tb->orientation() == Qt::Vertical)
horizontal = false;
#endif