summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-17 15:03:40 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-17 15:03:40 -0500
commit4037eb7e84eda2b72a456cf7ff19182c2d4a1f7a (patch)
tree4a2affdf8189079fd627c80b145e1790fdecb5e9
parentf209ff4b488f2ea3fa39bbed57dbbb8fe0162a3b (diff)
downloadqt3-4037eb7e.tar.gz
qt3-4037eb7e.zip
Add tab corner widget information to style data structures
This breaks the style ABI
-rw-r--r--src/kernel/qstyle.h25
-rw-r--r--src/styles/qcommonstyle.cpp34
2 files changed, 52 insertions, 7 deletions
diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h
index 324b987..1d20b8c 100644
--- a/src/kernel/qstyle.h
+++ b/src/kernel/qstyle.h
@@ -133,6 +133,8 @@ class QStyleHintReturn; // not defined yet
typedef QMap<Q_UINT32, QSize> DialogButtonSizeMap;
typedef QMap<Q_INT32, Q_INT32> TabIdentifierIndexMap;
+class QStyleControlElementGenericWidgetData;
+
class QStyleControlElementPopupMenuData {
public:
//
@@ -146,13 +148,6 @@ class QStyleControlElementCheckListItemData {
int height;
};
-class QStyleControlElementTabBarData {
- public:
- int tabCount;
- QTabBar::Shape shape;
- TabIdentifierIndexMap identIndexMap;
-};
-
class QStyleControlElementListViewData {
public:
bool rootDecorated;
@@ -204,6 +199,22 @@ class QStyleControlElementGenericWidgetData {
QFont font;
};
+class QStyleControlElementTabBarData {
+ public:
+ int tabCount;
+ int currentTabIndex;
+ QTabBar::Shape shape;
+ TabIdentifierIndexMap identIndexMap;
+ QStyleControlElementGenericWidgetData cornerWidgets[4];
+
+ enum CornerWidgetLocation {
+ CWL_TopLeft = 0,
+ CWL_TopRight = 1,
+ CWL_BottomLeft = 2,
+ CWL_BottomRight = 3
+ };
+};
+
class Q_EXPORT QStyleControlElementData {
public:
QStringList widgetObjectTypes;
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index 8293285..2614bbf 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -49,6 +49,7 @@
#include "qpixmap.h"
#include "qpushbutton.h"
#include "qtabbar.h"
+#include "qtabwidget.h"
#include "qlineedit.h"
#include "qscrollbar.h"
#include "qtoolbutton.h"
@@ -333,6 +334,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid
const QTabBar *tb = dynamic_cast<const QTabBar*>(widget);
if (tb) {
ceData.tabBarData.tabCount = tb->count();
+ ceData.tabBarData.currentTabIndex = tb->currentTab();
ceData.tabBarData.shape = tb->shape();
ceData.tabBarData.identIndexMap.clear();
const QTab* currentTab;
@@ -342,6 +344,38 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid
ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier());
}
}
+ const QTabWidget *tw = dynamic_cast<const QTabWidget*>(tb->parent());
+ if (tw) {
+ QWidget *cw;
+ cw = tw->cornerWidget(Qt::TopLeft);
+ if(cw) {
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ 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) {
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ 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) {
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ 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) {
+ ceData.tabBarData.cornerWidgets[QStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ 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 (ceData.widgetObjectTypes.contains("QToolBox")) {