diff options
Diffstat (limited to 'src/styles')
-rw-r--r-- | src/styles/qcommonstyle.cpp | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 1cc2540..a0e64d0 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -66,6 +66,7 @@ #include "qradiobutton.h" #include "qbitmap.h" #include "qprogressbar.h" +#include "qlistbox.h" #include "private/qdialogbuttons_p.h" #include <limits.h> #include <qpixmap.h> @@ -158,7 +159,7 @@ QStringList getObjectTypeListForObject(const QObject* object) { } QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* object, QStringList objectTypeList, const QStyleOption& opt, bool populateReliantFields) { - QStyle::ControlElementFlags cef = (QStyle::ControlElementFlags)0; + QStyle::ControlElementFlags cef = QStyle::CEF_None; if (object) { if (objectTypeList.contains("QPushButton")) { @@ -195,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) { @@ -232,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; } } } @@ -265,6 +273,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid if (populateReliantFields) { ceData.fgColor = widget->foregroundColor(); ceData.colorGroup = widget->colorGroup(); + ceData.paletteBgColor = widget->paletteBackgroundColor(); } ceData.geometry = widget->geometry(); ceData.rect = widget->rect(); @@ -275,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) { @@ -394,6 +405,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid ceData.totalSteps = pb->totalSteps(); ceData.progressText = pb->progressString(); ceData.percentageVisible = pb->percentageVisible(); + ceData.orientation = pb->orientation(); } } if (ceData.widgetObjectTypes.contains("QHeader")) { @@ -504,6 +516,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid if (populateReliantFields) { ceData.viewportData.fgColor = viewport->foregroundColor(); ceData.viewportData.colorGroup = viewport->colorGroup(); + ceData.viewportData.paletteBgColor = viewport->paletteBackgroundColor(); } ceData.viewportData.geometry = viewport->geometry(); ceData.viewportData.rect = viewport->rect(); @@ -514,6 +527,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(); } } } @@ -524,6 +539,10 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid if (lineEdit) { ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, ceData.widgetObjectTypes, QStyleOption::Default); } + const QListBox* listBox = cb->listBox(); + if (listBox) { + ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, ceData.widgetObjectTypes, QStyleOption::Default); + } } } if (ceData.widgetObjectTypes.contains("QFrame")) { @@ -554,6 +573,7 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid if (populateReliantFields) { ceData.parentWidgetData.fgColor = parentWidget->foregroundColor(); ceData.parentWidgetData.colorGroup = parentWidget->colorGroup(); + ceData.parentWidgetData.paletteBgColor = parentWidget->paletteBackgroundColor(); } ceData.parentWidgetData.geometry = parentWidget->geometry(); ceData.parentWidgetData.rect = parentWidget->rect(); @@ -564,6 +584,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) { @@ -580,6 +602,59 @@ QStyleControlElementData populateControlElementDataFromWidget(const QWidget* wid if (toolbar) { ceData.toolBarData.orientation = toolbar->orientation(); } + 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(); |