summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:25:42 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:26:47 +0200
commit1e9d76013ef0121bcfc6efbe4328ded58c1eebd3 (patch)
tree979e7705b9e12a1c664f5ac0108f9328e6b1e672 /src
parentf70f321c8b5769476796e2bae540a57b3b62c684 (diff)
QMainWindow: layout private API cleanup
using const references to pass parameter
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp56
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h14
2 files changed, 35 insertions, 35 deletions
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 0318f53c50..1057f5fdc6 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -426,42 +426,42 @@ QList<int> QMainWindowLayoutState::gapIndex(QWidget *widget,
return result;
}
-bool QMainWindowLayoutState::insertGap(QList<int> path, QLayoutItem *item)
+bool QMainWindowLayoutState::insertGap(const QList<int> &path, QLayoutItem *item)
{
if (path.isEmpty())
return false;
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0) {
Q_ASSERT(qobject_cast<QToolBar*>(item->widget()) != 0);
- return toolBarAreaLayout.insertGap(path, item);
+ return toolBarAreaLayout.insertGap(path.mid(1), item);
}
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1) {
Q_ASSERT(qobject_cast<QDockWidget*>(item->widget()) != 0);
- return dockAreaLayout.insertGap(path, item);
+ return dockAreaLayout.insertGap(path.mid(1), item);
}
#endif //QT_NO_DOCKWIDGET
return false;
}
-void QMainWindowLayoutState::remove(QList<int> path)
+void QMainWindowLayoutState::remove(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- toolBarAreaLayout.remove(path);
+ toolBarAreaLayout.remove(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- dockAreaLayout.remove(path);
+ dockAreaLayout.remove(path.mid(1));
#endif //QT_NO_DOCKWIDGET
}
@@ -501,88 +501,88 @@ bool QMainWindowLayoutState::isValid() const
return rect.isValid();
}
-QLayoutItem *QMainWindowLayoutState::item(QList<int> path)
+QLayoutItem *QMainWindowLayoutState::item(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.item(path).widgetItem;
+ return toolBarAreaLayout.item(path.mid(1)).widgetItem;
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.item(path).widgetItem;
+ return dockAreaLayout.item(path.mid(1)).widgetItem;
#endif //QT_NO_DOCKWIDGET
return 0;
}
-QRect QMainWindowLayoutState::itemRect(QList<int> path) const
+QRect QMainWindowLayoutState::itemRect(const QList<int> &path) const
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.itemRect(path);
+ return toolBarAreaLayout.itemRect(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.itemRect(path);
+ return dockAreaLayout.itemRect(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return QRect();
}
-QRect QMainWindowLayoutState::gapRect(QList<int> path) const
+QRect QMainWindowLayoutState::gapRect(const QList<int> &path) const
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.itemRect(path);
+ return toolBarAreaLayout.itemRect(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.gapRect(path);
+ return dockAreaLayout.gapRect(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return QRect();
}
-QLayoutItem *QMainWindowLayoutState::plug(QList<int> path)
+QLayoutItem *QMainWindowLayoutState::plug(const QList<int> &path)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifndef QT_NO_TOOLBAR
if (i == 0)
- return toolBarAreaLayout.plug(path);
+ return toolBarAreaLayout.plug(path.mid(1));
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.plug(path);
+ return dockAreaLayout.plug(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return 0;
}
-QLayoutItem *QMainWindowLayoutState::unplug(QList<int> path, QMainWindowLayoutState *other)
+QLayoutItem *QMainWindowLayoutState::unplug(const QList<int> &path, QMainWindowLayoutState *other)
{
- int i = path.takeFirst();
+ int i = path.first();
#ifdef QT_NO_TOOLBAR
Q_UNUSED(other);
#else
if (i == 0)
- return toolBarAreaLayout.unplug(path, other ? &other->toolBarAreaLayout : 0);
+ return toolBarAreaLayout.unplug(path.mid(1), other ? &other->toolBarAreaLayout : 0);
#endif
#ifndef QT_NO_DOCKWIDGET
if (i == 1)
- return dockAreaLayout.unplug(path);
+ return dockAreaLayout.unplug(path.mid(1));
#endif //QT_NO_DOCKWIDGET
return 0;
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index 5c5965a6a6..759461b52f 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -129,9 +129,9 @@ public:
QLayoutItem *itemAt(int index, int *x) const;
QLayoutItem *takeAt(int index, int *x);
QList<int> indexOf(QWidget *widget) const;
- QLayoutItem *item(QList<int> path);
- QRect itemRect(QList<int> path) const;
- QRect gapRect(QList<int> path) const; // ### get rid of this, use itemRect() instead
+ QLayoutItem *item(const QList<int> &path);
+ QRect itemRect(const QList<int> &path) const;
+ QRect gapRect(const QList<int> &path) const; // ### get rid of this, use itemRect() instead
bool contains(QWidget *widget) const;
@@ -139,14 +139,14 @@ public:
QWidget *centralWidget() const;
QList<int> gapIndex(QWidget *widget, const QPoint &pos) const;
- bool insertGap(QList<int> path, QLayoutItem *item);
- void remove(QList<int> path);
+ bool insertGap(const QList<int> &path, QLayoutItem *item);
+ void remove(const QList<int> &path);
void remove(QLayoutItem *item);
void clear();
bool isValid() const;
- QLayoutItem *plug(QList<int> path);
- QLayoutItem *unplug(QList<int> path, QMainWindowLayoutState *savedState = 0);
+ QLayoutItem *plug(const QList<int> &path);
+ QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
void saveState(QDataStream &stream) const;
bool checkFormat(QDataStream &stream, bool pre43);