diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-11-04 16:16:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-11-04 16:16:36 -0600 |
commit | 37a8b8a9126f613eb94ee76e3476d3c6a5830018 (patch) | |
tree | 534856965bf03ae7e18b86ecca6fb4a6aae3212b /src | |
parent | 380f29a7b4539f4b22e37774389f0845a742ad24 (diff) | |
download | qt3-37a8b8a9126f613eb94ee76e3476d3c6a5830018.tar.gz qt3-37a8b8a9126f613eb94ee76e3476d3c6a5830018.zip |
Add additional information to style info structs
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/qstyle.h | 9 | ||||
-rw-r--r-- | src/styles/qcommonstyle.cpp | 65 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h index f068462..f76b970 100644 --- a/src/kernel/qstyle.h +++ b/src/kernel/qstyle.h @@ -203,6 +203,8 @@ class QStyleControlElementGenericWidgetData { QPalette palette; QFont font; QColor paletteBgColor; + QString name; + QString caption; }; class QStyleControlElementTabBarData { @@ -280,6 +282,10 @@ class Q_EXPORT QStyleControlElementData { Q_UINT32 comboBoxListBoxFlags; QColor paletteBgColor; Q_UINT32 parentWidgetFlags; + QString name; + QString caption; + QStyleControlElementGenericWidgetData topLevelWidgetData; + Q_UINT32 topLevelWidgetFlags; public: QStyleControlElementData(); @@ -343,6 +349,7 @@ public: CEF_IsActiveWindow = 0x00200000, CEF_IsTopLevel = 0x00400000, CEF_IsVisible = 0x00800000, + CEF_IsShown = 0x01000000, CEF_HasMouse = 0x01000000 }; @@ -473,6 +480,8 @@ public: PE_MenuItemIndicatorIconFrame, PE_MenuItemIndicatorCheck, + PE_ScrollBarTrough, + // do not add any values below/greater this PE_CustomBase = 0xf000000 }; diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index f033df2..2052ef1 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -196,6 +196,12 @@ QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* objec if (t->identifier() == tb->currentTab()) cef = cef | QStyle::CEF_IsActive; } } + if (objectTypeList.contains("QTitleBar")) { + const QTitleBar *tb = dynamic_cast<const QTitleBar*>(object); + if (tb) { + if (tb->isActive()) cef = cef | QStyle::CEF_IsActive; + } + } if (objectTypeList.contains("QToolBox")) { const QToolBox *tb = dynamic_cast<const QToolBox*>(object); if (tb) { @@ -233,6 +239,7 @@ QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* objec if (widget->isActiveWindow()) cef = cef | QStyle::CEF_IsActiveWindow; if (widget->isTopLevel()) cef = cef | QStyle::CEF_IsTopLevel; if (widget->isVisible()) cef = cef | QStyle::CEF_IsVisible; + if (widget->isShown()) cef = cef | QStyle::CEF_IsShown; } } } @@ -277,6 +284,8 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid } ceData.palette = widget->palette(); ceData.font = widget->font(); + ceData.name = widget->name(); + ceData.caption = widget->caption(); if (ceData.widgetObjectTypes.contains("QPushButton")) { const QPushButton *button = dynamic_cast<const QPushButton*>(widget); if (button) { @@ -517,6 +526,8 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid } ceData.viewportData.palette = viewport->palette(); ceData.viewportData.font = viewport->font(); + ceData.viewportData.name = viewport->name(); + ceData.viewportData.caption = viewport->caption(); } } } @@ -572,6 +583,8 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid } ceData.parentWidgetData.palette = parentWidget->palette(); ceData.parentWidgetData.font = parentWidget->font(); + ceData.parentWidgetData.name = parentWidget->name(); + ceData.parentWidgetData.caption = parentWidget->caption(); const QDockWindow * dw = dynamic_cast<const QDockWindow*>(parentWidget); if (dw) { @@ -590,6 +603,58 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid } ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, ceData.parentWidgetData.widgetObjectTypes, QStyleOption::Default, populateReliantFields); } + const QWidget* topLevelWidget = widget->topLevelWidget(); + if (topLevelWidget) { + ceData.topLevelWidgetData.widgetObjectTypes = getObjectTypeListForObject(topLevelWidget); + ceData.topLevelWidgetData.allDataPopulated = populateReliantFields; + const QPixmap* erasePixmap = topLevelWidget->backgroundPixmap(); + if (erasePixmap) { + ceData.topLevelWidgetData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.topLevelWidgetData.bgBrush = topLevelWidget->backgroundBrush(); + } + ceData.topLevelWidgetData.wflags = topLevelWidget->getWFlags(); + if (populateReliantFields) { + ceData.topLevelWidgetData.windowState = (Qt::WindowState)(widget->windowState()); + } + ceData.topLevelWidgetData.bgColor = topLevelWidget->eraseColor(); + ceData.topLevelWidgetData.bgOffset = topLevelWidget->backgroundOffset(); + ceData.topLevelWidgetData.backgroundMode = topLevelWidget->backgroundMode(); + if (populateReliantFields) { + ceData.topLevelWidgetData.fgColor = topLevelWidget->foregroundColor(); + ceData.topLevelWidgetData.colorGroup = topLevelWidget->colorGroup(); + ceData.topLevelWidgetData.paletteBgColor = topLevelWidget->paletteBackgroundColor(); + } + ceData.topLevelWidgetData.geometry = topLevelWidget->geometry(); + ceData.topLevelWidgetData.rect = topLevelWidget->rect(); + ceData.topLevelWidgetData.pos = topLevelWidget->pos(); + const QPixmap* icon = topLevelWidget->icon(); + if (icon) { + ceData.topLevelWidgetData.icon = *icon; + } + ceData.topLevelWidgetData.palette = topLevelWidget->palette(); + ceData.topLevelWidgetData.font = topLevelWidget->font(); + ceData.topLevelWidgetData.name = topLevelWidget->name(); + ceData.topLevelWidgetData.caption = topLevelWidget->caption(); + + const QDockWindow * dw = dynamic_cast<const QDockWindow*>(topLevelWidget); + if (dw) { + if (dw->area()) { + ceData.dwData.hasDockArea = true; + ceData.dwData.areaOrientation = dw->area()->orientation(); + } + else { + ceData.dwData.hasDockArea = false; + } + ceData.dwData.closeEnabled = dw->isCloseEnabled(); + } + const QToolBar * toolbar = dynamic_cast<const QToolBar*>(topLevelWidget); + if (toolbar) { + ceData.toolBarData.orientation = toolbar->orientation(); + } + ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, ceData.topLevelWidgetData.widgetObjectTypes, QStyleOption::Default, populateReliantFields); + } QCheckListItem *item = opt.checkListItem(); if (item) { |