protected:
int metric(PaintDeviceMetric) const;
-
private:
QExplicitlySharedDataPointer<QPixmapData> data;
return result;
}
-//pre4.3 tests the format that was used before 4.3
-bool QMainWindowLayoutState::checkFormat(QDataStream &stream, bool pre43)
+bool QMainWindowLayoutState::checkFormat(QDataStream &stream)
{
-#ifdef QT_NO_TOOLBAR
- Q_UNUSED(pre43);
-#endif
while (!stream.atEnd()) {
uchar marker;
stream >> marker;
{
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
if (!toolBarAreaLayout.restoreState(stream, toolBars, marker,
- pre43 /*testing 4.3 format*/, true /*testing*/)) {
+ true /*testing*/)) {
return false;
}
}
}
QDataStream ds(copy);
- const bool oldFormat = !checkFormat(ds, false);
- if (oldFormat) {
- //we should try with the old format
- QDataStream ds2(copy);
- if (!checkFormat(ds2, true)) {
- return false; //format unknown
- }
+ if (!checkFormat(ds)) {
+ return false; //format unknown
}
QDataStream stream(copy);
case QToolBarAreaLayout::ToolBarStateMarkerEx:
{
QList<QToolBar *> toolBars = findChildrenHelper<QToolBar*>(mainWindow);
- if (!toolBarAreaLayout.restoreState(stream, toolBars, marker, oldFormat))
+ if (!toolBarAreaLayout.restoreState(stream, toolBars, marker))
return false;
for (int i = 0; i < toolBars.size(); ++i) {
#ifndef QT_NO_TOOLBAR
if (QToolBar *tb = qobject_cast<QToolBar*>(widget)) {
QToolBarLayout *tbl = qobject_cast<QToolBarLayout*>(tb->layout());
- if (tbl->animating) {
+ if (tbl && tbl->animating) {
tbl->animating = false;
if (tbl->expanded)
tbl->layoutActions(tb->size());
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
- if (qobject_cast<QDockWidget*>(widget) != 0) {
+ if (qobject_cast<QDockWidget*>(widget)) {
// info() might return null if the widget is destroyed while
// animating but before the animationFinished signal is received.
if (QDockAreaLayoutInfo *info = layoutState.dockAreaLayout.info(widget))
QLayoutItem *unplug(const QList<int> &path, QMainWindowLayoutState *savedState = 0);
void saveState(QDataStream &stream) const;
- bool checkFormat(QDataStream &stream, bool pre43);
+ bool checkFormat(QDataStream &stream);
bool restoreState(QDataStream &stream, const QMainWindowLayoutState &oldState);
};
}
}
-static inline int getInt(QDataStream &stream, Qt::Orientation o, bool pre43)
+static inline int getInt(QDataStream &stream)
{
- if (pre43) {
- QPoint p;
- stream >> p;
- return pick(o, p);
- } else {
- int x;
- stream >> x;
- return x;
- }
+ int x;
+ stream >> x;
+ return x;
}
-bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker, bool pre43, bool testing)
+bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker, bool testing)
{
QList<QToolBar*> toolBars = _toolBars;
int lines;
stream >> objectName;
uchar shown;
stream >> shown;
- item.pos = getInt(stream, dock.o, pre43);
- item.size = getInt(stream, dock.o, pre43);
+ item.pos = getInt(stream);
+ item.size = getInt(stream);
/*
4.3.0 added floating toolbars, but failed to add the ability to restore them.
QRect rect;
bool floating = false;
uint geom0, geom1;
- geom0 = getInt(stream, dock.o, pre43);
+ geom0 = getInt(stream);
if (tmarker == ToolBarStateMarkerEx) {
- geom1 = getInt(stream, dock.o, pre43);
+ geom1 = getInt(stream);
rect = unpackRect(geom0, geom1, &floating);
}
QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other);
void saveState(QDataStream &stream) const;
- bool restoreState(QDataStream &stream, const QList<QToolBar*> &toolBars, uchar tmarker, bool pre43, bool testing = false);
+ bool restoreState(QDataStream &stream, const QList<QToolBar*> &toolBars, uchar tmarker, bool testing = false);
bool isEmpty() const;
};