summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kernel/ntqobject.h6
-rw-r--r--src/kernel/ntqstyle.h14
-rw-r--r--src/kernel/qobject.cpp52
-rw-r--r--src/kernel/qstyle.cpp78
-rw-r--r--src/kernel/qthread_unix.cpp2
-rw-r--r--src/styles/qcommonstyle.cpp314
-rw-r--r--src/tools/ntqvaluelist.h15
-rw-r--r--src/widgets/qdockarea.cpp6
-rw-r--r--src/widgets/qprogressbar.cpp10
9 files changed, 342 insertions, 155 deletions
diff --git a/src/kernel/ntqobject.h b/src/kernel/ntqobject.h
index 38ea7ba97..b2c9b2f55 100644
--- a/src/kernel/ntqobject.h
+++ b/src/kernel/ntqobject.h
@@ -68,6 +68,9 @@ struct TQUObject;
class TQThread;
#endif
+class TQStyleControlElementData;
+class TQStyleControlElementDataPrivate;
+
class Q_EXPORT TQObject: public TQt
{
TQ_OBJECT
@@ -140,6 +143,9 @@ public:
void dumpObjectTree();
void dumpObjectInfo();
+ TQStyleControlElementData* controlElementDataObject();
+ TQStyleControlElementDataPrivate* controlElementDataPrivateObject();
+
#ifndef QT_NO_PROPERTIES
virtual bool setProperty( const char *name, const TQVariant& value );
virtual TQVariant property( const char *name ) const;
diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h
index fa9694854..fe16c4253 100644
--- a/src/kernel/ntqstyle.h
+++ b/src/kernel/ntqstyle.h
@@ -223,6 +223,7 @@ class TQStyleControlElementTabBarData {
class Q_EXPORT TQStyleControlElementData {
public:
TQStyleControlElementData();
+ ~TQStyleControlElementData();
public:
bool isNull;
@@ -285,6 +286,11 @@ class Q_EXPORT TQStyleControlElementData {
TQStyleControlElementGenericWidgetData topLevelWidgetData;
TQ_UINT32 topLevelWidgetFlags;
TQPixmap paletteBgPixmap;
+
+ private:
+ // Disable copy constructor
+ TQStyleControlElementData(const TQStyleControlElementData&);
+
};
class Q_EXPORT TQStyleWidgetActionRequestData {
@@ -1222,11 +1228,11 @@ private:
inline TQStyle::ControlElementFlags operator|(const TQStyle::ControlElementFlags a, const TQStyle::ControlElementFlags b) { return static_cast<TQStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); }
// inline TQStyle::ControlElementFlags operator|=(TQStyle::ControlElementFlags &a, const TQStyle::ControlElementFlags b) { a = static_cast<TQStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); return a; }
-Q_EXPORT TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields=true);
-Q_EXPORT TQStyleControlElementData populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption& opt, bool populateReliantFields=true);
-Q_EXPORT TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt, bool populateReliantFields=true);
+Q_EXPORT const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields=true);
+Q_EXPORT const TQStyleControlElementData &populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption& opt, bool populateReliantFields=true);
+Q_EXPORT TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, const TQStyleOption& opt, bool populateReliantFields=true);
Q_EXPORT TQStringList getObjectTypeListForObject(const TQObject* object);
-Q_EXPORT TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields);
+Q_EXPORT const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields);
#endif // QT_NO_STYLE
#endif // TQSTYLE_H
diff --git a/src/kernel/qobject.cpp b/src/kernel/qobject.cpp
index d40bf0415..e90e2bd9b 100644
--- a/src/kernel/qobject.cpp
+++ b/src/kernel/qobject.cpp
@@ -49,6 +49,9 @@
#include "qucomextra_p.h"
#include "ntqptrvector.h"
+// TQStyleControlElementData
+#include "ntqstyle.h"
+
#ifdef QT_THREAD_SUPPORT
#include "ntqmutex.h"
#include <private/qmutexpool_p.h>
@@ -58,6 +61,33 @@
#include <ctype.h>
#include <stdlib.h>
+// Keep in sync with duplicate definition in qcommonstyle.cpp
+class TQStyleControlElementDataPrivate {
+ public:
+ bool isTQPushButton;
+ bool isTQToolButton;
+ bool isTQButton;
+ bool isTQTabBar;
+ bool isTQTitleBar;
+ bool isTQToolBox;
+ bool isTQToolBar;
+ bool isTQProgressBar;
+ bool isTQPopupMenu;
+ bool isTQComboBox;
+ bool isTQCheckBox;
+ bool isTQRadioButton;
+ bool isTQHeader;
+ bool isTQScrollBar;
+ bool isTQSlider;
+ bool isTQDialogButtons;
+ bool isTQSpinWidget;
+ bool isTQListView;
+ bool isTQDockWindow;
+ bool isTQTabWidget;
+ bool isTQFrame;
+ bool isTQWidget;
+};
+
#ifndef QT_NO_USERDATA
class TQObjectPrivate : public TQPtrVector<TQObjectUserData>
#else
@@ -70,14 +100,36 @@ public:
ownThread = NULL;
disableThreadPostedEvents = false;
setAutoDelete( TRUE );
+ controlElementData = NULL;
+ controlElementDataPrivate = NULL;
+ }
+ ~TQObjectPrivate() {
+ delete controlElementData;
+ delete controlElementDataPrivate;
}
#endif
TQThread* ownThread;
TQMutex* senderObjectListMutex;
TQMutex* childObjectListMutex;
bool disableThreadPostedEvents;
+ TQStyleControlElementData* controlElementData;
+ TQStyleControlElementDataPrivate* controlElementDataPrivate;
};
+TQStyleControlElementData* TQObject::controlElementDataObject() {
+ if (!d->controlElementData) {
+ d->controlElementData = new TQStyleControlElementData();
+ }
+ return d->controlElementData;
+}
+
+TQStyleControlElementDataPrivate* TQObject::controlElementDataPrivateObject() {
+ if (!d->controlElementDataPrivate) {
+ d->controlElementDataPrivate = new TQStyleControlElementDataPrivate();
+ }
+ return d->controlElementDataPrivate;
+}
+
#if defined(QT_THREAD_SUPPORT)
void TQObject::moveToThread_helper(TQThread *targetThread)
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index 5dd32a267..189a97575 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -637,8 +637,8 @@ TQStyle::~TQStyle()
\sa unPolish()
*/
void TQStyle::polish( TQWidget *widget ) {
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- polish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
+ polish(ceData, getControlElementFlagsForObject(widget, TQStyleOption()), widget);
}
/*!
@@ -652,8 +652,8 @@ void TQStyle::polish( TQWidget *widget ) {
\sa polish()
*/
void TQStyle::unPolish( TQWidget *widget ) {
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- unPolish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
+ unPolish(ceData, getControlElementFlagsForObject(widget, TQStyleOption()), widget);
}
/*!
@@ -715,8 +715,8 @@ void TQStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementF
\sa unPolish()
*/
void TQStyle::polish( TQApplication *app ) {
- TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption());
- applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromApplication(app, TQStyleOption());
+ applicationPolish(ceData, getControlElementFlagsForObject(app, TQStyleOption()), app);
}
/*!
@@ -727,8 +727,8 @@ void TQStyle::polish( TQApplication *app ) {
\sa polish()
*/
void TQStyle::unPolish( TQApplication *app ) {
- TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption());
- applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromApplication(app, TQStyleOption());
+ applicationUnPolish(ceData, getControlElementFlagsForObject(app, TQStyleOption()), app);
}
/*!
@@ -782,8 +782,8 @@ void TQStyle::polish( TQPalette&)
checkable by default (\l{TQPopupMenu::setCheckable()}).
*/
void TQStyle::polishPopupMenu( TQPopupMenu *pm ) {
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(pm, TQStyleOption());
- unPolish(ceData, getControlElementFlagsForObject(pm, ceData.widgetObjectTypes, TQStyleOption()), pm);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(pm, TQStyleOption());
+ unPolish(ceData, getControlElementFlagsForObject(pm, TQStyleOption()), pm);
}
/*!
@@ -2351,14 +2351,16 @@ bool TQStyle::eventFilter(TQObject *o, TQEvent *e) {
if (m_objectEventSourceToHandlerMap.contains(o)) {
TQStyle* handler = m_objectEventSourceToHandlerMap[o];
- TQStyleControlElementData ceData = m_objectEventSourceDataToHandlerMap[o];
+ const TQStyleControlElementData &ceData = m_objectEventSourceDataToHandlerMap[o];
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
bool ret;
TQWidget* w = dynamic_cast<TQWidget*>(o);
if ((w) && (e->type() == TQEvent::Paint)) {
TQPainter p(w);
- ceData.activePainter = &p;
+ TQPainter* activePainterOrig = ceData.activePainter;
+ const_cast<TQStyleControlElementData&>(ceData).activePainter = &p;
ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ const_cast<TQStyleControlElementData&>(ceData).activePainter = activePainterOrig;
}
else {
ret = handler->objectEventHandler(ceData, elementFlags, o, e);
@@ -2638,8 +2640,8 @@ void TQStyle::drawPrimitive( PrimitiveElement pe,
}
}
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), r, cg, flags, opt);
}
void TQStyle::drawControl( ControlElement element,
@@ -2657,8 +2659,8 @@ void TQStyle::drawControl( ControlElement element,
}
#endif
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawControl(element, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, cg, flags, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControl(element, p, ceData, getControlElementFlagsForObject(widget, opt), r, cg, flags, opt, widget);
}
void TQStyle::drawControlMask( ControlElement control,
@@ -2667,8 +2669,8 @@ void TQStyle::drawControlMask( ControlElement control,
const TQRect &r,
const TQStyleOption& opt ) const
{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, opt), r, opt, widget);
}
TQRect TQStyle::subRect(SubRect r, const TQWidget *widget) const
@@ -2680,8 +2682,8 @@ TQRect TQStyle::subRect(SubRect r, const TQWidget *widget) const
}
#endif
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- return subRect(r, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
+ return subRect(r, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), widget);
}
void TQStyle::drawComplexControl( ComplexControl control,
@@ -2701,8 +2703,8 @@ void TQStyle::drawComplexControl( ComplexControl control,
}
#endif
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, controls, active, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), r, cg, flags, controls, active, opt, widget);
}
void TQStyle::drawComplexControlMask( ComplexControl control,
@@ -2711,8 +2713,8 @@ void TQStyle::drawComplexControlMask( ComplexControl control,
const TQRect &r,
const TQStyleOption& opt ) const
{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), r, opt, widget);
}
TQRect TQStyle::querySubControlMetrics( ComplexControl control,
@@ -2727,8 +2729,8 @@ TQRect TQStyle::querySubControlMetrics( ComplexControl control,
}
#endif
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt, false);
- return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), sc, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt, false);
+ return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), sc, opt, widget);
}
TQStyle::SubControl TQStyle::querySubControl(ComplexControl control,
@@ -2736,14 +2738,14 @@ TQStyle::SubControl TQStyle::querySubControl(ComplexControl control,
const TQPoint &pos,
const TQStyleOption& opt ) const
{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- return querySubControl(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), pos, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ return querySubControl(control, ceData, getControlElementFlagsForObject(widget, opt), pos, opt, widget);
}
int TQStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, TQStyleOption(), false);
+ return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), widget);
}
TQSize TQStyle::sizeFromContents(ContentsType contents,
@@ -2760,8 +2762,8 @@ TQSize TQStyle::sizeFromContents(ContentsType contents,
}
#endif
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
- return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), contentsSize, opt, widget);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(widget, opt);
+ return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, TQStyleOption()), contentsSize, opt, widget);
}
int TQStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption &so, TQStyleHintReturn *shr) const
@@ -2770,14 +2772,14 @@ int TQStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption &so
if (sh == SH_Widget_ShareActivation) {
ceDataNotNeeded = true;
}
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded);
- return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption(), false), so, shr, w);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded);
+ return styleHint(sh, ceData, getControlElementFlagsForObject(w, TQStyleOption(), false), so, shr, w);
}
TQPixmap TQStyle::stylePixmap(StylePixmap sp, const TQWidget *w, const TQStyleOption &so) const
{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, so);
- return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption()), so, w);
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(w, so);
+ return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, TQStyleOption()), so, w);
}
/*!
@@ -2830,4 +2832,8 @@ TQStyleControlElementData::TQStyleControlElementData() {
topLevelWidgetFlags = 0;
}
+TQStyleControlElementData::~TQStyleControlElementData() {
+ //
+}
+
#endif // QT_NO_STYLE
diff --git a/src/kernel/qthread_unix.cpp b/src/kernel/qthread_unix.cpp
index 08b668e64..c0f02464f 100644
--- a/src/kernel/qthread_unix.cpp
+++ b/src/kernel/qthread_unix.cpp
@@ -410,7 +410,7 @@ void TQThread::start(Priority priority)
d->args[1] = d;
#if defined(QT_USE_GLIBMAINLOOP)
// The correct thread_id is set in TQThreadInstance::start using the value of d->args[1]
- d->thread_id = NULL;
+ d->thread_id = 0;
// Legacy glib versions require this threading system initialization call
if (!GLIB_CHECK_VERSION (2, 32, 0)) {
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index a1ede1ad2..17d94e4d5 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -147,6 +147,7 @@ static TQString TQButton_static_string("TQButton");
static TQString TQTabBar_static_string("TQTabBar");
static TQString TQTitleBar_static_string("TQTitleBar");
static TQString TQToolBox_static_string("TQToolBox");
+static TQString TQToolBar_static_string("TQToolBar");
static TQString TQProgressBar_static_string("TQProgressBar");
static TQString TQPopupMenu_static_string("TQPopupMenu");
static TQString TQComboBox_static_string("TQComboBox");
@@ -159,17 +160,48 @@ static TQString TQDialogButtons_static_string("TQDialogButtons");
static TQString TQSpinWidget_static_string("TQSpinWidget");
static TQString TQListView_static_string("TQListView");
static TQString TQDockWindow_static_string("TQDockWindow");
+static TQString TQTabWidget_static_string("TQTabWidget");
static TQString TQFrame_static_string("TQFrame");
+static TQString TQWidget_static_string("TQWidget");
+
+static TQStyleControlElementData* TQStyleControlElementData_null = NULL;
#include <ntqmetaobject.h>
+// Keep in sync with duplicate definition in qobject.cpp
+class TQStyleControlElementDataPrivate {
+ public:
+ bool isTQPushButton;
+ bool isTQToolButton;
+ bool isTQButton;
+ bool isTQTabBar;
+ bool isTQTitleBar;
+ bool isTQToolBox;
+ bool isTQToolBar;
+ bool isTQProgressBar;
+ bool isTQPopupMenu;
+ bool isTQComboBox;
+ bool isTQCheckBox;
+ bool isTQRadioButton;
+ bool isTQHeader;
+ bool isTQScrollBar;
+ bool isTQSlider;
+ bool isTQDialogButtons;
+ bool isTQSpinWidget;
+ bool isTQListView;
+ bool isTQDockWindow;
+ bool isTQTabWidget;
+ bool isTQFrame;
+ bool isTQWidget;
+};
+
TQStringList getObjectTypeListForObject(const TQObject* object) {
TQStringList objectTypes;
if (object) {
TQMetaObject* objectMetaObject = object->metaObject();
const char* name;
-
+
while (objectMetaObject) {
name = objectMetaObject->className();
objectTypes.append(TQString(name));
@@ -180,12 +212,54 @@ TQStringList getObjectTypeListForObject(const TQObject* object) {
return objectTypes;
}
-TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt, bool populateReliantFields) {
+void determineObjectTypes(const TQObject* object, TQStyleControlElementData &ceData, TQStyleControlElementDataPrivate* ceDataPrivate) {
+ ceData.widgetObjectTypes = getObjectTypeListForObject(object);
+
+ // Increase speed on repeated calls by checking object types here and caching them
+ ceDataPrivate->isTQPushButton = ceData.widgetObjectTypes.containsYesNo(TQPushButton_static_string);
+ ceDataPrivate->isTQToolButton = ceData.widgetObjectTypes.containsYesNo(TQToolButton_static_string);
+ ceDataPrivate->isTQButton = ceData.widgetObjectTypes.containsYesNo(TQButton_static_string);
+ ceDataPrivate->isTQTabBar = ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string);
+ ceDataPrivate->isTQTitleBar = ceData.widgetObjectTypes.containsYesNo(TQTitleBar_static_string);
+ ceDataPrivate->isTQToolBox = ceData.widgetObjectTypes.containsYesNo(TQToolBox_static_string);
+ ceDataPrivate->isTQToolBar = ceData.widgetObjectTypes.containsYesNo(TQToolBar_static_string);
+ ceDataPrivate->isTQProgressBar = ceData.widgetObjectTypes.containsYesNo(TQProgressBar_static_string);
+ ceDataPrivate->isTQPopupMenu = ceData.widgetObjectTypes.containsYesNo(TQPopupMenu_static_string);
+ ceDataPrivate->isTQComboBox = ceData.widgetObjectTypes.containsYesNo(TQComboBox_static_string);
+ ceDataPrivate->isTQCheckBox = ceData.widgetObjectTypes.containsYesNo(TQCheckBox_static_string);
+ ceDataPrivate->isTQRadioButton = ceData.widgetObjectTypes.containsYesNo(TQRadioButton_static_string);
+ ceDataPrivate->isTQHeader = ceData.widgetObjectTypes.containsYesNo(TQHeader_static_string);
+ ceDataPrivate->isTQScrollBar = ceData.widgetObjectTypes.containsYesNo(TQScrollBar_static_string);
+ ceDataPrivate->isTQSlider = ceData.widgetObjectTypes.containsYesNo(TQSlider_static_string);
+ ceDataPrivate->isTQDialogButtons = ceData.widgetObjectTypes.containsYesNo(TQDialogButtons_static_string);
+ ceDataPrivate->isTQSpinWidget = ceData.widgetObjectTypes.containsYesNo(TQSpinWidget_static_string);
+ ceDataPrivate->isTQListView = ceData.widgetObjectTypes.containsYesNo(TQListView_static_string);
+ ceDataPrivate->isTQDockWindow = ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string);
+ ceDataPrivate->isTQTabWidget = ceData.widgetObjectTypes.containsYesNo(TQTabWidget_static_string);
+ ceDataPrivate->isTQFrame = ceData.widgetObjectTypes.containsYesNo(TQFrame_static_string);
+ ceDataPrivate->isTQWidget = ceData.widgetObjectTypes.containsYesNo(TQWidget_static_string);
+}
+
+void updateObjectTypeListIfNeeded(const TQObject* object) {
+ TQStyleControlElementData &ceData = *(const_cast<TQObject*>(object)->controlElementDataObject());
+ TQStyleControlElementDataPrivate* ceDataPrivate = const_cast<TQObject*>(object)->controlElementDataPrivateObject();
+
+ // This is much faster than (ceData.widgetObjectTypes[0] != TQString(object->metaObject()->className())) due to TQString constructor/destructor overhead
+ // Casting to const also increases speed by preventing unneeded calls to detach()
+ if ((ceData.widgetObjectTypes.isEmpty()) || (strcmp(const_cast<const TQStringList&>(ceData.widgetObjectTypes)[0].ascii(), object->metaObject()->className()) != 0)) {
+ determineObjectTypes(object, ceData, ceDataPrivate);
+ }
+}
+
+TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, const TQStyleOption& opt, bool populateReliantFields) {
TQStyle::ControlElementFlags cef = TQStyle::CEF_None;
if (object) {
- if (objectTypeList.contains(TQPushButton_static_string)) {
- const TQPushButton *button = dynamic_cast<const TQPushButton*>(object);
+ TQStyleControlElementDataPrivate* ceDataPrivate = const_cast<TQObject*>(object)->controlElementDataPrivateObject();
+ updateObjectTypeListIfNeeded(object);
+
+ if (ceDataPrivate->isTQPushButton) {
+ const TQPushButton *button = static_cast<const TQPushButton*>(object);
if (button) {
if (button->isDefault()) cef = cef | TQStyle::CEF_IsDefault;
if (button->autoDefault()) cef = cef | TQStyle::CEF_AutoDefault;
@@ -194,8 +268,8 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button->isFlat()) cef = cef | TQStyle::CEF_IsFlat;
}
}
- if (objectTypeList.contains(TQToolButton_static_string)) {
- const TQToolButton *button = dynamic_cast<const TQToolButton*>(object);
+ if (ceDataPrivate->isTQToolButton) {
+ const TQToolButton *button = static_cast<const TQToolButton*>(object);
if (button) {
if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState;
if (button->usesTextLabel()) cef = cef | TQStyle::CEF_UsesTextLabel;
@@ -203,65 +277,67 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button->popup()) cef = cef | TQStyle::CEF_HasPopupMenu;
}
}
- if (objectTypeList.contains(TQButton_static_string)) {
- const TQButton *button = dynamic_cast<const TQButton*>(object);
+ if (ceDataPrivate->isTQButton) {
+ const TQButton *button = static_cast<const TQButton*>(object);
if (button) {
if (button->isDown()) cef = cef | TQStyle::CEF_IsDown;
if (button->isOn()) cef = cef | TQStyle::CEF_IsOn;
if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState;
}
}
- if (objectTypeList.contains(TQTabBar_static_string)) {
- const TQTabBar *tb = dynamic_cast<const TQTabBar*>(object);
+ if (ceDataPrivate->isTQTabBar) {
+ const TQTabBar *tb = static_cast<const TQTabBar*>(object);
TQTab * t = opt.tab();
if ((t) && (tb)) {
if (t->identifier() == tb->currentTab()) cef = cef | TQStyle::CEF_IsActive;
}
}
- if (objectTypeList.contains(TQTitleBar_static_string)) {
- const TQTitleBar *tb = dynamic_cast<const TQTitleBar*>(object);
+ if (ceDataPrivate->isTQTitleBar) {
+ const TQTitleBar *tb = static_cast<const TQTitleBar*>(object);
if (tb) {
if (tb->isActive()) cef = cef | TQStyle::CEF_IsActive;
}
}
- if (objectTypeList.contains(TQToolBox_static_string)) {
- const TQToolBox *tb = dynamic_cast<const TQToolBox*>(object);
+ if (ceDataPrivate->isTQToolBox) {
+ const TQToolBox *tb = static_cast<const TQToolBox*>(object);
if (tb) {
if (!tb->currentItem()) cef = cef | TQStyle::CEF_IsContainerEmpty;
}
}
- if (objectTypeList.contains(TQProgressBar_static_string)) {
- const TQProgressBar *pb = dynamic_cast<const TQProgressBar*>(object);
+ if (ceDataPrivate->isTQProgressBar) {
+ const TQProgressBar *pb = static_cast<const TQProgressBar*>(object);
if (pb) {
if (pb->centerIndicator()) cef = cef | TQStyle::CEF_CenterIndicator;
if (pb->indicatorFollowsStyle()) cef = cef | TQStyle::CEF_IndicatorFollowsStyle;
}
}
- if (objectTypeList.contains(TQPopupMenu_static_string)) {
- const TQPopupMenu *pm = dynamic_cast<const TQPopupMenu*>(object);
+ if (ceDataPrivate->isTQPopupMenu) {
+ const TQPopupMenu *pm = static_cast<const TQPopupMenu*>(object);
if (pm) {
if (pm->isCheckable()) cef = cef | TQStyle::CEF_IsCheckable;
}
}
- if (objectTypeList.contains(TQComboBox_static_string)) {
- const TQComboBox *cb = dynamic_cast<const TQComboBox*>(object);
+ if (ceDataPrivate->isTQComboBox) {
+ const TQComboBox *cb = static_cast<const TQComboBox*>(object);
if (cb) {
if (cb->editable()) cef = cef | TQStyle::CEF_IsEditable;
}
}
// Generic flags
- const TQWidget* widget = dynamic_cast<const TQWidget*>(object);
- if (widget) {
- if (widget->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled;
- if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget;
- if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy;
- if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus;
- if (widget->hasMouse()) cef = cef | TQStyle::CEF_HasMouse;
- if (populateReliantFields) {
- if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow;
- if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel;
- if (widget->isVisible()) cef = cef | TQStyle::CEF_IsVisible;
- if (widget->isShown()) cef = cef | TQStyle::CEF_IsShown;
+ if (ceDataPrivate->isTQWidget) {
+ const TQWidget* widget = static_cast<const TQWidget*>(object);
+ if (widget) {
+ if (widget->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled;
+ if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget;
+ if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy;
+ if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus;
+ if (widget->hasMouse()) cef = cef | TQStyle::CEF_HasMouse;
+ if (populateReliantFields) {
+ if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow;
+ if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel;
+ if (widget->isVisible()) cef = cef | TQStyle::CEF_IsVisible;
+ if (widget->isShown()) cef = cef | TQStyle::CEF_IsShown;
+ }
}
}
}
@@ -272,16 +348,18 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
return cef;
}
-TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields) {
+const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields) {
return populateControlElementDataFromWidget(widget, opt, populateReliantFields, false);
}
-TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields) {
- TQStyleControlElementData ceData;
-
+const TQStyleControlElementData &populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields, bool populateMinimumNumberOfFields) {
if (widget) {
+ TQStyleControlElementData &ceData = *(const_cast<TQWidget*>(widget)->controlElementDataObject());
+ TQStyleControlElementDataPrivate* ceDataPrivate = const_cast<TQWidget*>(widget)->controlElementDataPrivateObject();
+
ceData.isNull = false;
- ceData.widgetObjectTypes = getObjectTypeListForObject(widget);
+ updateObjectTypeListIfNeeded(widget);
+
ceData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields;
if (!populateMinimumNumberOfFields) {
const TQPixmap* erasePixmap = widget->backgroundPixmap();
@@ -316,8 +394,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.name = widget->name();
ceData.caption = widget->caption();
if (!populateMinimumNumberOfFields) {
- if (ceData.widgetObjectTypes.contains(TQPushButton_static_string)) {
- const TQPushButton *button = dynamic_cast<const TQPushButton*>(widget);
+ if (ceDataPrivate->isTQPushButton) {
+ const TQPushButton *button = static_cast<const TQPushButton*>(widget);
if (button) {
TQIconSet* iconSet = 0;
const TQPixmap* fgPixmap = 0;
@@ -331,8 +409,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQToolButton_static_string)) {
- const TQToolButton *button = dynamic_cast<const TQToolButton*>(widget);
+ if (ceDataPrivate->isTQToolButton) {
+ const TQToolButton *button = static_cast<const TQToolButton*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
ceData.iconSet = button->iconSet();
@@ -345,8 +423,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.popupDelay = button->popupDelay();
}
}
- if (ceData.widgetObjectTypes.contains(TQCheckBox_static_string)) {
- const TQCheckBox *button = dynamic_cast<const TQCheckBox*>(widget);
+ if (ceDataPrivate->isTQCheckBox) {
+ const TQCheckBox *button = static_cast<const TQCheckBox*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
fgPixmap = button->pixmap();
@@ -355,8 +433,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQRadioButton_static_string)) {
- const TQRadioButton *button = dynamic_cast<const TQRadioButton*>(widget);
+ if (ceDataPrivate->isTQRadioButton) {
+ const TQRadioButton *button = static_cast<const TQRadioButton*>(widget);
if (button) {
const TQPixmap* fgPixmap = 0;
fgPixmap = button->pixmap();
@@ -365,8 +443,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQButton_static_string)) {
- const TQButton *button = dynamic_cast<const TQButton*>(widget);
+ if (ceDataPrivate->isTQButton) {
+ const TQButton *button = static_cast<const TQButton*>(widget);
if (button) {
ceData.text = button->text();
const TQPixmap* paletteBgPixmap = 0;
@@ -376,8 +454,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQTabBar_static_string)) {
- const TQTabBar *tb = dynamic_cast<const TQTabBar*>(widget);
+ if (ceDataPrivate->isTQTabBar) {
+ const TQTabBar *tb = static_cast<const TQTabBar*>(widget);
if (tb) {
ceData.tabBarData.tabCount = tb->count();
ceData.tabBarData.currentTabIndex = tb->currentTab();
@@ -390,33 +468,38 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.tabBarData.identIndexMap[currentTab->identifier()] = tb->indexOf(currentTab->identifier());
}
}
- const TQTabWidget *tw = dynamic_cast<const TQTabWidget*>(tb->parent());
- if (tw) {
+ updateObjectTypeListIfNeeded(tb->parent());
+ if ((const_cast<TQObject*>(tb->parent())->controlElementDataPrivateObject())->isTQTabWidget) {
+ const TQTabWidget *tw = static_cast<const TQTabWidget*>(tb->parent());
TQWidget *cw;
cw = tw->cornerWidget(TQt::TopLeft);
- if(cw) {
- ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes = (const_cast<TQWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].geometry = cw->geometry();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].rect = cw->rect();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].pos = cw->pos();
}
cw = tw->cornerWidget(TQt::TopRight);
- if(cw) {
- ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].widgetObjectTypes = (const_cast<TQWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].geometry = cw->geometry();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].rect = cw->rect();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopRight].pos = cw->pos();
}
cw = tw->cornerWidget(TQt::BottomLeft);
- if(cw) {
- ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = getObjectTypeListForObject(cw);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].widgetObjectTypes = (const_cast<TQWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].geometry = cw->geometry();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].rect = cw->rect();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomLeft].pos = cw->pos();
}
cw = tw->cornerWidget(TQt::BottomRight);
- if(cw) {
- ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = getObjectTypeListForObject(cw);
+ if (cw) {
+ updateObjectTypeListIfNeeded(cw);
+ ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].widgetObjectTypes = (const_cast<TQWidget*>(cw)->controlElementDataObject())->widgetObjectTypes;
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].geometry = cw->geometry();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].rect = cw->rect();
ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_BottomRight].pos = cw->pos();
@@ -424,8 +507,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQToolBox_static_string)) {
- const TQToolBox *tb = dynamic_cast<const TQToolBox*>(widget);
+ if (ceDataPrivate->isTQToolBox) {
+ const TQToolBox *tb = static_cast<const TQToolBox*>(widget);
if (tb) {
const TQWidget* currentItem = tb->currentItem();
if (currentItem) {
@@ -433,8 +516,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQProgressBar_static_string)) {
- const TQProgressBar *pb = dynamic_cast<const TQProgressBar*>(widget);
+ if (ceDataPrivate->isTQProgressBar) {
+ const TQProgressBar *pb = static_cast<const TQProgressBar*>(widget);
if (pb) {
ceData.currentStep = pb->progress();
ceData.totalSteps = pb->totalSteps();
@@ -443,8 +526,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.orientation = pb->orientation();
}
}
- if (ceData.widgetObjectTypes.contains(TQHeader_static_string)) {
- const TQHeader *header = dynamic_cast<const TQHeader*>(widget);
+ if (ceDataPrivate->isTQHeader) {
+ const TQHeader *header = static_cast<const TQHeader*>(widget);
if (header) {
int section = opt.headerSection();
TQIconSet* iconSet = 0;
@@ -456,8 +539,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
// Complex Controls
- if (ceData.widgetObjectTypes.contains(TQScrollBar_static_string)) {
- const TQScrollBar *sb = dynamic_cast<const TQScrollBar*>(widget);
+ if (ceDataPrivate->isTQScrollBar) {
+ const TQScrollBar *sb = static_cast<const TQScrollBar*>(widget);
if (sb) {
ceData.orientation = sb->orientation();
ceData.minSteps = sb->minValue();
@@ -471,8 +554,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQSlider_static_string)) {
- const TQSlider *sl = dynamic_cast<const TQSlider*>(widget);
+ if (ceDataPrivate->isTQSlider) {
+ const TQSlider *sl = static_cast<const TQSlider*>(widget);
if (sl) {
ceData.orientation = sl->orientation();
ceData.minSteps = sl->minValue();
@@ -488,8 +571,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQDialogButtons_static_string)) {
- const TQDialogButtons *dlgbtns = dynamic_cast<const TQDialogButtons*>(widget);
+ if (ceDataPrivate->isTQDialogButtons) {
+ const TQDialogButtons *dlgbtns = static_cast<const TQDialogButtons*>(widget);
if (dlgbtns) {
ceData.orientation = dlgbtns->orientation();
ceData.dlgVisibleButtons = dlgbtns->visibleButtons();
@@ -499,11 +582,11 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.dlgVisibleSizeHints[btns[i]] = dlgbtns->sizeHint(btns[i]);
}
}
-
+
}
}
- if (ceData.widgetObjectTypes.contains(TQTitleBar_static_string)) {
- const TQTitleBar *tb = dynamic_cast<const TQTitleBar*>(widget);
+ if (ceDataPrivate->isTQTitleBar) {
+ const TQTitleBar *tb = static_cast<const TQTitleBar*>(widget);
if (tb) {
ceData.titleBarData.hasWindow = !!(tb->window());
if (populateReliantFields) {
@@ -515,8 +598,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.titleBarData.visibleText = tb->visibleText();
}
}
- if (ceData.widgetObjectTypes.contains(TQSpinWidget_static_string)) {
- const TQSpinWidget *sw = dynamic_cast<const TQSpinWidget*>(widget);
+ if (ceDataPrivate->isTQSpinWidget) {
+ const TQSpinWidget *sw = static_cast<const TQSpinWidget*>(widget);
if (sw) {
ceData.spinWidgetData.buttonSymbols = sw->buttonSymbols();
ceData.spinWidgetData.upRect = sw->upRect();
@@ -525,14 +608,15 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.spinWidgetData.downEnabled = sw->isDownEnabled();
}
}
- if (ceData.widgetObjectTypes.contains(TQListView_static_string)) {
- const TQListView *lv = dynamic_cast<const TQListView*>(widget);
+ if (ceDataPrivate->isTQListView) {
+ const TQListView *lv = static_cast<const TQListView*>(widget);
if (lv) {
ceData.listViewData.rootDecorated = lv->rootIsDecorated();
ceData.listViewData.itemMargin = lv->itemMargin();
TQWidget* viewport = lv->viewport();
if (viewport) {
- ceData.viewportData.widgetObjectTypes = getObjectTypeListForObject(viewport);
+ updateObjectTypeListIfNeeded(viewport);
+ ceData.viewportData.widgetObjectTypes = (const_cast<TQWidget*>(viewport)->controlElementDataObject())->widgetObjectTypes;
ceData.viewportData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields;
const TQPixmap* erasePixmap = viewport->backgroundPixmap();
if (erasePixmap) {
@@ -567,29 +651,31 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
- if (ceData.widgetObjectTypes.contains(TQComboBox_static_string)) {
- const TQComboBox *cb = dynamic_cast<const TQComboBox*>(widget);
+ if (ceDataPrivate->isTQComboBox) {
+ const TQComboBox *cb = static_cast<const TQComboBox*>(widget);
if (cb) {
const TQLineEdit* lineEdit = cb->lineEdit();
if (lineEdit) {
- ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, ceData.widgetObjectTypes, TQStyleOption::Default);
+ ceData.comboBoxLineEditFlags = getControlElementFlagsForObject(lineEdit, TQStyleOption::Default);
}
const TQListBox* listBox = cb->listBox();
if (listBox) {
- ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, ceData.widgetObjectTypes, TQStyleOption::Default);
+ ceData.comboBoxListBoxFlags = getControlElementFlagsForObject(listBox, TQStyleOption::Default);
}
}
}
- if (ceData.widgetObjectTypes.contains(TQFrame_static_string)) {
- const TQFrame *frame = dynamic_cast<const TQFrame*>(widget);
+ if (ceDataPrivate->isTQFrame) {
+ const TQFrame *frame = static_cast<const TQFrame*>(widget);
if (frame) {
ceData.frameStyle = frame->frameStyle();
}
}
-
+
const TQWidget* parentWidget = widget->parentWidget();
if (parentWidget) {
- ceData.parentWidgetData.widgetObjectTypes = getObjectTypeListForObject(parentWidget);
+ updateObjectTypeListIfNeeded(parentWidget);
+ ceData.parentWidgetData.widgetObjectTypes = (const_cast<TQWidget*>(parentWidget)->controlElementDataObject())->widgetObjectTypes;
+ TQStyleControlElementDataPrivate* parentWidgetCEDataPrivate = const_cast<TQWidget*>(parentWidget)->controlElementDataPrivateObject();
ceData.parentWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields;
const TQPixmap* erasePixmap = parentWidget->backgroundPixmap();
if (erasePixmap) {
@@ -621,9 +707,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.parentWidgetData.font = parentWidget->font();
ceData.parentWidgetData.name = parentWidget->name();
ceData.parentWidgetData.caption = parentWidget->caption();
-
- const TQDockWindow * dw = dynamic_cast<const TQDockWindow*>(parentWidget);
- if (dw) {
+
+ if (parentWidgetCEDataPrivate->isTQDockWindow) {
+ const TQDockWindow * dw = static_cast<const TQDockWindow*>(parentWidget);
if (dw->area()) {
ceData.dwData.hasDockArea = true;
ceData.dwData.areaOrientation = dw->area()->orientation();
@@ -633,15 +719,17 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
ceData.dwData.closeEnabled = dw->isCloseEnabled();
}
- const TQToolBar * toolbar = dynamic_cast<const TQToolBar*>(parentWidget);
- if (toolbar) {
+ if (parentWidgetCEDataPrivate->isTQToolBar) {
+ const TQToolBar * toolbar = static_cast<const TQToolBar*>(parentWidget);
ceData.toolBarData.orientation = toolbar->orientation();
}
- ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, ceData.parentWidgetData.widgetObjectTypes, TQStyleOption::Default, populateReliantFields);
+ ceData.parentWidgetFlags = getControlElementFlagsForObject(parentWidget, TQStyleOption::Default, populateReliantFields);
}
const TQWidget* topLevelWidget = widget->topLevelWidget();
if (topLevelWidget) {
- ceData.topLevelWidgetData.widgetObjectTypes = getObjectTypeListForObject(topLevelWidget);
+ updateObjectTypeListIfNeeded(topLevelWidget);
+ ceData.topLevelWidgetData.widgetObjectTypes = (const_cast<TQWidget*>(topLevelWidget)->controlElementDataObject())->widgetObjectTypes;
+ TQStyleControlElementDataPrivate* topLevelWidgetCEDataPrivate = const_cast<TQWidget*>(topLevelWidget)->controlElementDataPrivateObject();
ceData.topLevelWidgetData.allDataPopulated = populateReliantFields & populateMinimumNumberOfFields;
const TQPixmap* erasePixmap = topLevelWidget->backgroundPixmap();
if (erasePixmap) {
@@ -673,9 +761,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.topLevelWidgetData.font = topLevelWidget->font();
ceData.topLevelWidgetData.name = topLevelWidget->name();
ceData.topLevelWidgetData.caption = topLevelWidget->caption();
-
- const TQDockWindow * dw = dynamic_cast<const TQDockWindow*>(topLevelWidget);
- if (dw) {
+
+ if (topLevelWidgetCEDataPrivate->isTQDockWindow) {
+ const TQDockWindow * dw = static_cast<const TQDockWindow*>(topLevelWidget);
if (dw->area()) {
ceData.dwData.hasDockArea = true;
ceData.dwData.areaOrientation = dw->area()->orientation();
@@ -685,13 +773,13 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
ceData.dwData.closeEnabled = dw->isCloseEnabled();
}
- const TQToolBar * toolbar = dynamic_cast<const TQToolBar*>(topLevelWidget);
- if (toolbar) {
+ if (topLevelWidgetCEDataPrivate->isTQToolBar) {
+ const TQToolBar * toolbar = static_cast<const TQToolBar*>(topLevelWidget);
ceData.toolBarData.orientation = toolbar->orientation();
}
- ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, ceData.topLevelWidgetData.widgetObjectTypes, TQStyleOption::Default, populateReliantFields);
+ ceData.topLevelWidgetFlags = getControlElementFlagsForObject(topLevelWidget, TQStyleOption::Default, populateReliantFields);
}
-
+
TQCheckListItem *item = opt.checkListItem();
if (item) {
ceData.checkListItemData.dataValid = true;
@@ -703,16 +791,24 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.checkListItemData.dataValid = false;
}
}
- }
- return ceData;
+ return ceData;
+ }
+ else {
+ if (!TQStyleControlElementData_null) {
+ TQStyleControlElementData_null = new TQStyleControlElementData();
+ }
+ TQStyleControlElementData &ceData = *TQStyleControlElementData_null;
+ return ceData;
+ }
}
-TQStyleControlElementData populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption&, bool) {
- TQStyleControlElementData ceData;
+const TQStyleControlElementData &populateControlElementDataFromApplication(const TQApplication* app, const TQStyleOption&, bool) {
+ TQStyleControlElementData &ceData = *(const_cast<TQApplication*>(app)->controlElementDataObject());
if (app) {
- ceData.widgetObjectTypes = getObjectTypeListForObject(app);
+ updateObjectTypeListIfNeeded(app);
+ ceData.widgetObjectTypes = (const_cast<TQApplication*>(app)->controlElementDataObject())->widgetObjectTypes;
ceData.palette = app->palette();
ceData.font = app->font();
}
@@ -1179,7 +1275,7 @@ void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
activePainter = 0;
}
-void qt_style_erase_region(TQPainter* p, const TQRegion& region, TQStyleControlElementData ceData) {
+void qt_style_erase_region(TQPainter* p, const TQRegion& region, const TQStyleControlElementData &ceData) {
TQRegion reg = region;
TQPoint offset = ceData.bgOffset;
@@ -2797,7 +2893,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
if ( ceData.wflags & WStyle_Tool ) {
ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 16 );
#ifndef QT_NO_MAINWINDOW
- } else if ( ceData.widgetObjectTypes.contains(TQDockWindow_static_string) ) {
+ } else if ( ceData.widgetObjectTypes.containsYesNo(TQDockWindow_static_string) ) {
ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 13 );
#endif
} else {
@@ -2945,7 +3041,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
#ifndef QT_NO_TABBAR
case PM_TabBarTabVSpace:
{
- if ( ceData.widgetObjectTypes.contains(TQTabBar_static_string) && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
+ if ( ceData.widgetObjectTypes.containsYesNo(TQTabBar_static_string) && ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
ceData.tabBarData.shape == TQTabBar::RoundedBelow ) )
ret = 10;
else
diff --git a/src/tools/ntqvaluelist.h b/src/tools/ntqvaluelist.h
index 91d50c942..fd14437b5 100644
--- a/src/tools/ntqvaluelist.h
+++ b/src/tools/ntqvaluelist.h
@@ -250,6 +250,7 @@ public:
NodePtr find( NodePtr start, const T& x ) const;
int findIndex( NodePtr start, const T& x ) const;
uint contains( const T& x ) const;
+ bool containsYesNo( const T& x ) const;
uint remove( const T& x );
NodePtr at( size_type i ) const;
void clear();
@@ -355,6 +356,19 @@ Q_INLINE_TEMPLATES uint TQValueListPrivate<T>::contains( const T& x ) const
}
template <class T>
+Q_INLINE_TEMPLATES bool TQValueListPrivate<T>::containsYesNo( const T& x ) const
+{
+ Iterator first = Iterator( node->next );
+ Iterator last = Iterator( node );
+ while( first != last) {
+ if ( *first == x )
+ return true;
+ ++first;
+ }
+ return false;
+}
+
+template <class T>
Q_INLINE_TEMPLATES uint TQValueListPrivate<T>::remove( const T& _x )
{
const T x = _x;
@@ -547,6 +561,7 @@ public:
const_iterator find ( const_iterator it, const T& x ) const { return const_iterator( sh->find( it.node, x ) ); }
int findIndex( const T& x ) const { return sh->findIndex( sh->node->next, x) ; }
size_type contains( const T& x ) const { return sh->contains( x ); }
+ bool containsYesNo( const T& x ) const { return sh->containsYesNo( x ); }
size_type count() const { return sh->nodes; }
diff --git a/src/widgets/qdockarea.cpp b/src/widgets/qdockarea.cpp
index 14c63885f..e0764a32a 100644
--- a/src/widgets/qdockarea.cpp
+++ b/src/widgets/qdockarea.cpp
@@ -204,13 +204,15 @@ static int dock_strut( TQDockWindow *w, TQt::Orientation o )
{
if ( o != TQt::Horizontal ) {
int wid;
- if ( ( wid = w->fixedExtent().width() ) != -1 )
+ if ( ( wid = w->fixedExtent().width() ) != -1 ) {
return TQMAX( wid, TQMAX( w->minimumSize().width(), w->minimumSizeHint().width() ) );
+ }
return TQMAX( w->sizeHint().width(), TQMAX( w->minimumSize().width(), w->minimumSizeHint().width() ) );
} else {
int hei;
- if ( ( hei = w->fixedExtent().height() ) != -1 )
+ if ( ( hei = w->fixedExtent().height() ) != -1 ) {
return TQMAX( hei, TQMAX( w->minimumSizeHint().height(), w->minimumSize().height() ) );
+ }
return TQMAX( w->sizeHint().height(), TQMAX( w->minimumSizeHint().height(), w->minimumSize().height() ) );
}
}
diff --git a/src/widgets/qprogressbar.cpp b/src/widgets/qprogressbar.cpp
index bf40d9e45..d1300d3e2 100644
--- a/src/widgets/qprogressbar.cpp
+++ b/src/widgets/qprogressbar.cpp
@@ -429,8 +429,10 @@ void TQProgressBar::drawContents( TQPainter *p )
TQWMatrix oldMatrix = buffer.painter()->worldMatrix();
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(this, TQStyleOption());
- TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, ceData.widgetObjectTypes, TQStyleOption());
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(this, TQStyleOption());
+ TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, TQStyleOption());
+
+ TQRect ceDataRectOrig = ceData.rect;
// Draw contents
if (m_orientation == TQt::Vertical) {
@@ -447,7 +449,7 @@ void TQProgressBar::drawContents( TQPainter *p )
buffer.painter()->setWorldMatrix(m, TRUE);
- ceData.rect = TQRect(ceData.rect.y(), ceData.rect.x(), ceData.rect.height(), ceData.rect.width());
+ const_cast<TQStyleControlElementData&>(ceData).rect = TQRect(ceData.rect.y(), ceData.rect.x(), ceData.rect.height(), ceData.rect.width());
}
style().drawControl(TQStyle::CE_ProgressBarContents, buffer.painter(), ceData, elementFlags,
@@ -461,6 +463,8 @@ void TQProgressBar::drawContents( TQPainter *p )
TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarLabel, this), this ),
colorGroup(), flags);
}
+
+ const_cast<TQStyleControlElementData&>(ceData).rect = ceDataRectOrig;
}
#endif