summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2014-05-20 08:46:19 +0200
committerSlávek Banko <[email protected]>2014-05-20 08:46:19 +0200
commit3d29992e94dc1238567be60c761b3be6b36437a7 (patch)
tree1a2ea5155e2154af2c2f6aaa233435b3fb62ee07
parent1afc62ef88274fea322f6c53857890fe17c9fdcf (diff)
downloadqt3-3d29992e94dc1238567be60c761b3be6b36437a7.tar.gz
qt3-3d29992e94dc1238567be60c761b3be6b36437a7.zip
Fix crash on populating style data to tabbar without parent
This resolves Bug 1966
-rw-r--r--src/styles/qcommonstyle.cpp72
1 files changed, 37 insertions, 35 deletions
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index f6319a4..0bad0a5 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -468,41 +468,43 @@ const QStyleControlElementData &populateControlElementDataFromWidget(const QWidg
ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier());
}
}
- updateObjectTypeListIfNeeded(tb->parent());
- if ((const_cast<QObject*>(tb->parent())->controlElementDataPrivateObject())->isQTabWidget) {
- const QTabWidget *tw = static_cast<const QTabWidget*>(tb->parent());
- QWidget *cw;
- cw = tw->cornerWidget(Qt::TopLeft);
- if (cw) {
- updateObjectTypeListIfNeeded(cw);
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos();
- }
- cw = tw->cornerWidget(Qt::TopRight);
- if (cw) {
- updateObjectTypeListIfNeeded(cw);
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos();
- }
- cw = tw->cornerWidget(Qt::BottomLeft);
- if (cw) {
- updateObjectTypeListIfNeeded(cw);
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos();
- }
- cw = tw->cornerWidget(Qt::BottomRight);
- if (cw) {
- updateObjectTypeListIfNeeded(cw);
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect();
- ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos();
+ if ( tb->parent() ) {
+ updateObjectTypeListIfNeeded(tb->parent());
+ if ((const_cast<QObject*>(tb->parent())->controlElementDataPrivateObject())->isQTabWidget) {
+ const QTabWidget *tw = static_cast<const QTabWidget*>(tb->parent());
+ QWidget *cw;
+ cw = tw->cornerWidget(Qt::TopLeft);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(Qt::TopRight);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(Qt::BottomLeft);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos();
+ }
+ cw = tw->cornerWidget(Qt::BottomRight);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast<QWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect();
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos();
+ }
}
}
}