diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/ntqobject.h | 6 | ||||
-rw-r--r-- | src/kernel/ntqstyle.h | 14 | ||||
-rw-r--r-- | src/kernel/qobject.cpp | 52 | ||||
-rw-r--r-- | src/kernel/qstyle.cpp | 78 | ||||
-rw-r--r-- | src/kernel/qthread_unix.cpp | 2 |
5 files changed, 111 insertions, 41 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)) { |