From 30c5994817cb87f4a291eec0bc6eaec485eefb15 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 14 Nov 2012 14:48:47 -0600 Subject: Speed up application loading --- src/kernel/qstyle.cpp | 6 +- src/kernel/qstyle.h | 1 + src/styles/qcommonstyle.cpp | 732 ++++++++++++++++++++++---------------------- 3 files changed, 376 insertions(+), 363 deletions(-) diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 4e689c2..75d448d 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -2579,7 +2579,11 @@ QSize QStyle::sizeFromContents(ContentsType contents, int QStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption &so, QStyleHintReturn *shr) const { - QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false); + bool ceDataNotNeeded = false; + if (sh == SH_Widget_ShareActivation) { + ceDataNotNeeded = true; + } + QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded); return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption(), false), so, shr, w); } diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h index f76b970..63acec6 100644 --- a/src/kernel/qstyle.h +++ b/src/kernel/qstyle.h @@ -1231,6 +1231,7 @@ Q_EXPORT QStyleControlElementData populateControlElementDataFromWidget(const QWi Q_EXPORT QStyleControlElementData populateControlElementDataFromApplication(const QApplication* app, const QStyleOption& opt, bool populateReliantFields=true); Q_EXPORT QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* object, QStringList objectTypeList, const QStyleOption& opt, bool populateReliantFields=true); Q_EXPORT QStringList getObjectTypeListForObject(const QObject* object); +Q_EXPORT QStyleControlElementData populateControlElementDataFromWidget(const QWidget* widget, const QStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields); #endif // QT_NO_STYLE #endif // QSTYLE_H diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index a0e64d0..b49bef2 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -251,421 +251,429 @@ QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* objec } QStyleControlElementData populateControlElementDataFromWidget(const QWidget* widget, const QStyleOption& opt, bool populateReliantFields) { + return populateControlElementDataFromWidget(widget, opt, populateReliantFields, false); +} + +QStyleControlElementData populateControlElementDataFromWidget(const QWidget* widget, const QStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields) { QStyleControlElementData ceData; if (widget) { ceData.widgetObjectTypes = getObjectTypeListForObject(widget); - ceData.allDataPopulated = populateReliantFields; - const QPixmap* erasePixmap = widget->backgroundPixmap(); - if (erasePixmap) { - ceData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.bgBrush = widget->backgroundBrush(); + ceData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + if (!populateMinimumNumberOfFields) { + const QPixmap* erasePixmap = widget->backgroundPixmap(); + if (erasePixmap) { + ceData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.bgBrush = widget->backgroundBrush(); + ceData.windowState = (Qt::WindowState)(widget->windowState()); + } } ceData.wflags = widget->getWFlags(); - if (populateReliantFields) { - ceData.windowState = (Qt::WindowState)(widget->windowState()); - } - ceData.bgColor = widget->eraseColor(); - ceData.bgOffset = widget->backgroundOffset(); - ceData.backgroundMode = widget->backgroundMode(); - if (populateReliantFields) { - ceData.fgColor = widget->foregroundColor(); - ceData.colorGroup = widget->colorGroup(); - ceData.paletteBgColor = widget->paletteBackgroundColor(); - } - ceData.geometry = widget->geometry(); - ceData.rect = widget->rect(); - ceData.pos = widget->pos(); - const QPixmap* icon = widget->icon(); - if (icon) { - ceData.icon = *icon; + if (!populateMinimumNumberOfFields) { + ceData.bgColor = widget->eraseColor(); + ceData.bgOffset = widget->backgroundOffset(); + ceData.backgroundMode = widget->backgroundMode(); + if (populateReliantFields) { + ceData.fgColor = widget->foregroundColor(); + ceData.colorGroup = widget->colorGroup(); + ceData.paletteBgColor = widget->paletteBackgroundColor(); + } + ceData.geometry = widget->geometry(); + ceData.rect = widget->rect(); + ceData.pos = widget->pos(); + const QPixmap* icon = widget->icon(); + if (icon) { + ceData.icon = *icon; + } + ceData.palette = widget->palette(); + ceData.font = widget->font(); } - 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(widget); - if (button) { - QIconSet* iconSet = 0; - const QPixmap* fgPixmap = 0; - iconSet = button->iconSet(); - fgPixmap = button->pixmap(); - if (iconSet) { - ceData.iconSet = *iconSet; - } - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; + if (!populateMinimumNumberOfFields) { + if (ceData.widgetObjectTypes.contains("QPushButton")) { + const QPushButton *button = dynamic_cast(widget); + if (button) { + QIconSet* iconSet = 0; + const QPixmap* fgPixmap = 0; + iconSet = button->iconSet(); + fgPixmap = button->pixmap(); + if (iconSet) { + ceData.iconSet = *iconSet; + } + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } } } - } - if (ceData.widgetObjectTypes.contains("QToolButton")) { - const QToolButton *button = dynamic_cast(widget); - if (button) { - const QPixmap* fgPixmap = 0; - ceData.iconSet = button->iconSet(); - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; + if (ceData.widgetObjectTypes.contains("QToolButton")) { + const QToolButton *button = dynamic_cast(widget); + if (button) { + const QPixmap* fgPixmap = 0; + ceData.iconSet = button->iconSet(); + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } + ceData.textLabel = button->textLabel(); + ceData.toolButtonTextPosition = button->textPosition(); + ceData.popupDelay = button->popupDelay(); } - ceData.textLabel = button->textLabel(); - ceData.toolButtonTextPosition = button->textPosition(); - ceData.popupDelay = button->popupDelay(); } - } - if (ceData.widgetObjectTypes.contains("QCheckBox")) { - const QCheckBox *button = dynamic_cast(widget); - if (button) { - const QPixmap* fgPixmap = 0; - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; + if (ceData.widgetObjectTypes.contains("QCheckBox")) { + const QCheckBox *button = dynamic_cast(widget); + if (button) { + const QPixmap* fgPixmap = 0; + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } } } - } - if (ceData.widgetObjectTypes.contains("QRadioButton")) { - const QRadioButton *button = dynamic_cast(widget); - if (button) { - const QPixmap* fgPixmap = 0; - fgPixmap = button->pixmap(); - if (fgPixmap) { - ceData.fgPixmap = *fgPixmap; + if (ceData.widgetObjectTypes.contains("QRadioButton")) { + const QRadioButton *button = dynamic_cast(widget); + if (button) { + const QPixmap* fgPixmap = 0; + fgPixmap = button->pixmap(); + if (fgPixmap) { + ceData.fgPixmap = *fgPixmap; + } } } - } - if (ceData.widgetObjectTypes.contains("QButton")) { - const QButton *button = dynamic_cast(widget); - if (button) { - ceData.text = button->text(); - } - } - if (ceData.widgetObjectTypes.contains("QTabBar")) { - const QTabBar *tb = dynamic_cast(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; - for (int i=0; icount(); ++i) { - currentTab = tb->tabAt(i); - if (currentTab) { - ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); - } + if (ceData.widgetObjectTypes.contains("QButton")) { + const QButton *button = dynamic_cast(widget); + if (button) { + ceData.text = button->text(); } - const QTabWidget *tw = dynamic_cast(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(); + } + if (ceData.widgetObjectTypes.contains("QTabBar")) { + const QTabBar *tb = dynamic_cast(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; + for (int i=0; icount(); ++i) { + currentTab = tb->tabAt(i); + if (currentTab) { + ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier()); + } } - 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(); + const QTabWidget *tw = dynamic_cast(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")) { - const QToolBox *tb = dynamic_cast(widget); - if (tb) { - const QWidget* currentItem = tb->currentItem(); - if (currentItem) { - ceData.activeItemPaletteBgColor = currentItem->paletteBackgroundColor(); + if (ceData.widgetObjectTypes.contains("QToolBox")) { + const QToolBox *tb = dynamic_cast(widget); + if (tb) { + const QWidget* currentItem = tb->currentItem(); + if (currentItem) { + ceData.activeItemPaletteBgColor = currentItem->paletteBackgroundColor(); + } } } - } - if (ceData.widgetObjectTypes.contains("QProgressBar")) { - const QProgressBar *pb = dynamic_cast(widget); - if (pb) { - ceData.currentStep = pb->progress(); - ceData.totalSteps = pb->totalSteps(); - ceData.progressText = pb->progressString(); - ceData.percentageVisible = pb->percentageVisible(); - ceData.orientation = pb->orientation(); + if (ceData.widgetObjectTypes.contains("QProgressBar")) { + const QProgressBar *pb = dynamic_cast(widget); + if (pb) { + ceData.currentStep = pb->progress(); + ceData.totalSteps = pb->totalSteps(); + ceData.progressText = pb->progressString(); + ceData.percentageVisible = pb->percentageVisible(); + ceData.orientation = pb->orientation(); + } } - } - if (ceData.widgetObjectTypes.contains("QHeader")) { - const QHeader *header = dynamic_cast(widget); - if (header) { - int section = opt.headerSection(); - QIconSet* iconSet = 0; - iconSet = header->iconSet(section); - ceData.textLabel = header->label(section); - if (iconSet) { - ceData.iconSet = *iconSet; + if (ceData.widgetObjectTypes.contains("QHeader")) { + const QHeader *header = dynamic_cast(widget); + if (header) { + int section = opt.headerSection(); + QIconSet* iconSet = 0; + iconSet = header->iconSet(section); + ceData.textLabel = header->label(section); + if (iconSet) { + ceData.iconSet = *iconSet; + } } } - } - // Complex Controls - if (ceData.widgetObjectTypes.contains("QScrollBar")) { - const QScrollBar *sb = dynamic_cast(widget); - if (sb) { - ceData.orientation = sb->orientation(); - ceData.minSteps = sb->minValue(); - ceData.maxSteps = sb->maxValue(); - ceData.currentStep = sb->value(); - ceData.startStep = sb->sliderStart(); - ceData.lineStep = sb->lineStep(); - ceData.pageStep = sb->pageStep(); - if (populateReliantFields) { - ceData.sliderRect = sb->sliderRect(); + // Complex Controls + if (ceData.widgetObjectTypes.contains("QScrollBar")) { + const QScrollBar *sb = dynamic_cast(widget); + if (sb) { + ceData.orientation = sb->orientation(); + ceData.minSteps = sb->minValue(); + ceData.maxSteps = sb->maxValue(); + ceData.currentStep = sb->value(); + ceData.startStep = sb->sliderStart(); + ceData.lineStep = sb->lineStep(); + ceData.pageStep = sb->pageStep(); + if (populateReliantFields) { + ceData.sliderRect = sb->sliderRect(); + } } } - } - if (ceData.widgetObjectTypes.contains("QSlider")) { - const QSlider *sl = dynamic_cast(widget); - if (sl) { - ceData.orientation = sl->orientation(); - ceData.minSteps = sl->minValue(); - ceData.maxSteps = sl->maxValue(); - ceData.tickMarkSetting = sl->tickmarks(); - ceData.tickInterval = sl->tickInterval(); - ceData.currentStep = sl->value(); - ceData.startStep = sl->sliderStart(); - ceData.lineStep = sl->lineStep(); - ceData.pageStep = sl->pageStep(); - if (populateReliantFields) { - ceData.sliderRect = sl->sliderRect(); + if (ceData.widgetObjectTypes.contains("QSlider")) { + const QSlider *sl = dynamic_cast(widget); + if (sl) { + ceData.orientation = sl->orientation(); + ceData.minSteps = sl->minValue(); + ceData.maxSteps = sl->maxValue(); + ceData.tickMarkSetting = sl->tickmarks(); + ceData.tickInterval = sl->tickInterval(); + ceData.currentStep = sl->value(); + ceData.startStep = sl->sliderStart(); + ceData.lineStep = sl->lineStep(); + ceData.pageStep = sl->pageStep(); + if (populateReliantFields) { + ceData.sliderRect = sl->sliderRect(); + } } } - } - if (ceData.widgetObjectTypes.contains("QDialogButtons")) { - const QDialogButtons *dlgbtns = dynamic_cast(widget); - if (dlgbtns) { - ceData.orientation = dlgbtns->orientation(); - ceData.dlgVisibleButtons = dlgbtns->visibleButtons(); - QDialogButtons::Button btns[] = { QDialogButtons::All, QDialogButtons::Reject, QDialogButtons::Accept, QDialogButtons::Apply, QDialogButtons::Retry, QDialogButtons::Ignore, QDialogButtons::Abort, QDialogButtons::Help }; - for(unsigned int i = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { - if (ceData.dlgVisibleButtons & btns[i]) { - ceData.dlgVisibleSizeHints[btns[i]] = dlgbtns->sizeHint(btns[i]); + if (ceData.widgetObjectTypes.contains("QDialogButtons")) { + const QDialogButtons *dlgbtns = dynamic_cast(widget); + if (dlgbtns) { + ceData.orientation = dlgbtns->orientation(); + ceData.dlgVisibleButtons = dlgbtns->visibleButtons(); + QDialogButtons::Button btns[] = { QDialogButtons::All, QDialogButtons::Reject, QDialogButtons::Accept, QDialogButtons::Apply, QDialogButtons::Retry, QDialogButtons::Ignore, QDialogButtons::Abort, QDialogButtons::Help }; + for(unsigned int i = 0; i < (sizeof(btns)/sizeof(btns[0])); i++) { + if (ceData.dlgVisibleButtons & btns[i]) { + ceData.dlgVisibleSizeHints[btns[i]] = dlgbtns->sizeHint(btns[i]); + } } + } - } - } - if (ceData.widgetObjectTypes.contains("QTitleBar")) { - const QTitleBar *tb = dynamic_cast(widget); - if (tb) { - ceData.titleBarData.hasWindow = !!(tb->window()); - if (populateReliantFields) { - if (ceData.titleBarData.hasWindow) { - ceData.titleBarData.windowState = (Qt::WindowState)(tb->window()->windowState()); + if (ceData.widgetObjectTypes.contains("QTitleBar")) { + const QTitleBar *tb = dynamic_cast(widget); + if (tb) { + ceData.titleBarData.hasWindow = !!(tb->window()); + if (populateReliantFields) { + if (ceData.titleBarData.hasWindow) { + ceData.titleBarData.windowState = (Qt::WindowState)(tb->window()->windowState()); + } + ceData.titleBarData.usesActiveColor = tb->usesActiveColor(); } - ceData.titleBarData.usesActiveColor = tb->usesActiveColor(); + ceData.titleBarData.visibleText = tb->visibleText(); } - ceData.titleBarData.visibleText = tb->visibleText(); } - } - if (ceData.widgetObjectTypes.contains("QSpinWidget")) { - const QSpinWidget *sw = dynamic_cast(widget); - if (sw) { - ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols(); - ceData.spinWidgetData.upRect = sw->upRect(); - ceData.spinWidgetData.downRect = sw->downRect(); - ceData.spinWidgetData.upEnabled = sw->isUpEnabled(); - ceData.spinWidgetData.downEnabled = sw->isDownEnabled(); + if (ceData.widgetObjectTypes.contains("QSpinWidget")) { + const QSpinWidget *sw = dynamic_cast(widget); + if (sw) { + ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols(); + ceData.spinWidgetData.upRect = sw->upRect(); + ceData.spinWidgetData.downRect = sw->downRect(); + ceData.spinWidgetData.upEnabled = sw->isUpEnabled(); + ceData.spinWidgetData.downEnabled = sw->isDownEnabled(); + } } - } - if (ceData.widgetObjectTypes.contains("QListView")) { - const QListView *lv = dynamic_cast(widget); - if (lv) { - ceData.listViewData.rootDecorated = lv->rootIsDecorated(); - ceData.listViewData.itemMargin = lv->itemMargin(); - QWidget* viewport = lv->viewport(); - if (viewport) { - ceData.viewportData.widgetObjectTypes = getObjectTypeListForObject(viewport); - ceData.viewportData.allDataPopulated = populateReliantFields; - const QPixmap* erasePixmap = viewport->backgroundPixmap(); - if (erasePixmap) { - ceData.viewportData.bgPixmap = *erasePixmap; + if (ceData.widgetObjectTypes.contains("QListView")) { + const QListView *lv = dynamic_cast(widget); + if (lv) { + ceData.listViewData.rootDecorated = lv->rootIsDecorated(); + ceData.listViewData.itemMargin = lv->itemMargin(); + QWidget* viewport = lv->viewport(); + if (viewport) { + ceData.viewportData.widgetObjectTypes = getObjectTypeListForObject(viewport); + ceData.viewportData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const QPixmap* erasePixmap = viewport->backgroundPixmap(); + if (erasePixmap) { + ceData.viewportData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.viewportData.bgBrush = viewport->backgroundBrush(); + } + if (populateReliantFields) { + ceData.viewportData.windowState = (Qt::WindowState)(widget->windowState()); + } + ceData.viewportData.wflags = viewport->getWFlags(); + ceData.viewportData.bgColor = viewport->eraseColor(); + ceData.viewportData.bgOffset = viewport->backgroundOffset(); + ceData.viewportData.backgroundMode = viewport->backgroundMode(); + 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(); + ceData.viewportData.pos = viewport->pos(); + const QPixmap* icon = viewport->icon(); + if (icon) { + ceData.viewportData.icon = *icon; + } + ceData.viewportData.palette = viewport->palette(); + ceData.viewportData.font = viewport->font(); + ceData.viewportData.name = viewport->name(); + ceData.viewportData.caption = viewport->caption(); } - if (populateReliantFields) { - ceData.viewportData.bgBrush = viewport->backgroundBrush(); + } + } + if (ceData.widgetObjectTypes.contains("QComboBox")) { + const QComboBox *cb = dynamic_cast(widget); + if (cb) { + const QLineEdit* lineEdit = cb->lineEdit(); + if (lineEdit) { + ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, ceData.widgetObjectTypes, QStyleOption::Default); } - ceData.viewportData.wflags = viewport->getWFlags(); - if (populateReliantFields) { - ceData.viewportData.windowState = (Qt::WindowState)(widget->windowState()); + const QListBox* listBox = cb->listBox(); + if (listBox) { + ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, ceData.widgetObjectTypes, QStyleOption::Default); } - ceData.viewportData.bgColor = viewport->eraseColor(); - ceData.viewportData.bgOffset = viewport->backgroundOffset(); - ceData.viewportData.backgroundMode = viewport->backgroundMode(); - if (populateReliantFields) { - ceData.viewportData.fgColor = viewport->foregroundColor(); - ceData.viewportData.colorGroup = viewport->colorGroup(); - ceData.viewportData.paletteBgColor = viewport->paletteBackgroundColor(); + } + } + if (ceData.widgetObjectTypes.contains("QFrame")) { + const QFrame *frame = dynamic_cast(widget); + if (frame) { + ceData.frameStyle = frame->frameStyle(); + } + } + + const QWidget* parentWidget = widget->parentWidget(); + if (parentWidget) { + ceData.parentWidgetData.widgetObjectTypes = getObjectTypeListForObject(parentWidget); + ceData.parentWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const QPixmap* erasePixmap = parentWidget->backgroundPixmap(); + if (erasePixmap) { + ceData.parentWidgetData.bgPixmap = *erasePixmap; + } + if (populateReliantFields) { + ceData.parentWidgetData.bgBrush = parentWidget->backgroundBrush(); + } + if (populateReliantFields) { + ceData.parentWidgetData.windowState = (Qt::WindowState)(widget->windowState()); + } + ceData.parentWidgetData.wflags = parentWidget->getWFlags(); + ceData.parentWidgetData.bgColor = parentWidget->eraseColor(); + ceData.parentWidgetData.bgOffset = parentWidget->backgroundOffset(); + ceData.parentWidgetData.backgroundMode = parentWidget->backgroundMode(); + 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(); + ceData.parentWidgetData.pos = parentWidget->pos(); + const QPixmap* icon = parentWidget->icon(); + if (icon) { + ceData.parentWidgetData.icon = *icon; + } + 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(parentWidget); + if (dw) { + if (dw->area()) { + ceData.dwData.hasDockArea = true; + ceData.dwData.areaOrientation = dw->area()->orientation(); } - ceData.viewportData.geometry = viewport->geometry(); - ceData.viewportData.rect = viewport->rect(); - ceData.viewportData.pos = viewport->pos(); - const QPixmap* icon = viewport->icon(); - if (icon) { - ceData.viewportData.icon = *icon; + else { + ceData.dwData.hasDockArea = false; } - ceData.viewportData.palette = viewport->palette(); - ceData.viewportData.font = viewport->font(); - ceData.viewportData.name = viewport->name(); - ceData.viewportData.caption = viewport->caption(); + ceData.dwData.closeEnabled = dw->isCloseEnabled(); } + const QToolBar * toolbar = dynamic_cast(parentWidget); + if (toolbar) { + ceData.toolBarData.orientation = toolbar->orientation(); + } + ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, ceData.parentWidgetData.widgetObjectTypes, QStyleOption::Default, populateReliantFields); } - } - if (ceData.widgetObjectTypes.contains("QComboBox")) { - const QComboBox *cb = dynamic_cast(widget); - if (cb) { - const QLineEdit* lineEdit = cb->lineEdit(); - if (lineEdit) { - ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, ceData.widgetObjectTypes, QStyleOption::Default); + const QWidget* topLevelWidget = widget->topLevelWidget(); + if (topLevelWidget) { + ceData.topLevelWidgetData.widgetObjectTypes = getObjectTypeListForObject(topLevelWidget); + ceData.topLevelWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields; + const QPixmap* erasePixmap = topLevelWidget->backgroundPixmap(); + if (erasePixmap) { + ceData.topLevelWidgetData.bgPixmap = *erasePixmap; } - const QListBox* listBox = cb->listBox(); - if (listBox) { - ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, ceData.widgetObjectTypes, QStyleOption::Default); + if (populateReliantFields) { + ceData.topLevelWidgetData.bgBrush = topLevelWidget->backgroundBrush(); } - } - } - if (ceData.widgetObjectTypes.contains("QFrame")) { - const QFrame *frame = dynamic_cast(widget); - if (frame) { - ceData.frameStyle = frame->frameStyle(); - } - } - - const QWidget* parentWidget = widget->parentWidget(); - if (parentWidget) { - ceData.parentWidgetData.widgetObjectTypes = getObjectTypeListForObject(parentWidget); - ceData.parentWidgetData.allDataPopulated = populateReliantFields; - const QPixmap* erasePixmap = parentWidget->backgroundPixmap(); - if (erasePixmap) { - ceData.parentWidgetData.bgPixmap = *erasePixmap; - } - if (populateReliantFields) { - ceData.parentWidgetData.bgBrush = parentWidget->backgroundBrush(); - } - ceData.parentWidgetData.wflags = parentWidget->getWFlags(); - if (populateReliantFields) { - ceData.parentWidgetData.windowState = (Qt::WindowState)(widget->windowState()); - } - ceData.parentWidgetData.bgColor = parentWidget->eraseColor(); - ceData.parentWidgetData.bgOffset = parentWidget->backgroundOffset(); - ceData.parentWidgetData.backgroundMode = parentWidget->backgroundMode(); - 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(); - ceData.parentWidgetData.pos = parentWidget->pos(); - const QPixmap* icon = parentWidget->icon(); - if (icon) { - ceData.parentWidgetData.icon = *icon; - } - 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(parentWidget); - if (dw) { - if (dw->area()) { - ceData.dwData.hasDockArea = true; - ceData.dwData.areaOrientation = dw->area()->orientation(); + if (populateReliantFields) { + ceData.topLevelWidgetData.windowState = (Qt::WindowState)(widget->windowState()); } - else { - ceData.dwData.hasDockArea = false; + ceData.topLevelWidgetData.wflags = topLevelWidget->getWFlags(); + 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.dwData.closeEnabled = dw->isCloseEnabled(); - } - const QToolBar * toolbar = dynamic_cast(parentWidget); - 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(topLevelWidget); - if (dw) { - if (dw->area()) { - ceData.dwData.hasDockArea = true; - ceData.dwData.areaOrientation = dw->area()->orientation(); + 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; } - else { - ceData.dwData.hasDockArea = false; + 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(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(topLevelWidget); + if (toolbar) { + ceData.toolBarData.orientation = toolbar->orientation(); } - ceData.dwData.closeEnabled = dw->isCloseEnabled(); + ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, ceData.topLevelWidgetData.widgetObjectTypes, QStyleOption::Default, populateReliantFields); } - const QToolBar * toolbar = dynamic_cast(topLevelWidget); - if (toolbar) { - ceData.toolBarData.orientation = toolbar->orientation(); + + QCheckListItem *item = opt.checkListItem(); + if (item) { + ceData.checkListItemData.dataValid = true; + ceData.checkListItemData.enabled = item->isEnabled(); + ceData.checkListItemData.hasParent = ( item->parent() && (item->parent()->rtti() == 1) && (((QCheckListItem*) item->parent())->type() == QCheckListItem::Controller) ); + ceData.checkListItemData.height = item->height(); + } + else { + ceData.checkListItemData.dataValid = false; } - ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, ceData.topLevelWidgetData.widgetObjectTypes, QStyleOption::Default, populateReliantFields); - } - - QCheckListItem *item = opt.checkListItem(); - if (item) { - ceData.checkListItemData.dataValid = true; - ceData.checkListItemData.enabled = item->isEnabled(); - ceData.checkListItemData.hasParent = ( item->parent() && (item->parent()->rtti() == 1) && (((QCheckListItem*) item->parent())->type() == QCheckListItem::Controller) ); - ceData.checkListItemData.height = item->height(); - } - else { - ceData.checkListItemData.dataValid = false; } } -- cgit v1.2.1