diff options
Diffstat (limited to 'qtinterface')
28 files changed, 2676 insertions, 27 deletions
diff --git a/qtinterface/convert_qt_tqt2 b/qtinterface/convert_qt_tqt2 index 7e99f06..f6c6171 100755 --- a/qtinterface/convert_qt_tqt2 +++ b/qtinterface/convert_qt_tqt2 @@ -986,6 +986,9 @@ find ./ -type f -iname "*.c*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; # Convert a few items that have changed too subtly to override in the TQT interface layer find ./ -type f -iname "*.c*" -exec sed -i 's/->children()/->tqchildren()/g' {} \; find ./ -type f -iname "*.c*" -exec sed -i 's/access != QMetaData::/tqaccess != QMetaData::/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/colorTable()/ptrColorTable()/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/QStyleOption::Default/QStyleOption::TQSO_Default/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/::qt_cast/tqqt_cast/g' {} \; # Back out some common mistakes find ./ -type f -iname "*.c*" -exec sed -i 's/\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)TQ/\1Q/g' {} \; diff --git a/qtinterface/private/tqucomextra_p.cpp b/qtinterface/private/tqucomextra_p.cpp index a7b09fa..c9fc62b 100644 --- a/qtinterface/private/tqucomextra_p.cpp +++ b/qtinterface/private/tqucomextra_p.cpp @@ -21,3 +21,7 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <private/tqucomextra_p.h> + +#ifdef USE_QT4 + +#endif
\ No newline at end of file diff --git a/qtinterface/private/tqucomextra_p.h b/qtinterface/private/tqucomextra_p.h index d22f1c1..5f9b7de 100644 --- a/qtinterface/private/tqucomextra_p.h +++ b/qtinterface/private/tqucomextra_p.h @@ -29,7 +29,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QUComExtra_P class // For Qt3, no changes are needed -#include <private/tqucomextra_p.h> +#include <tqucomextra_p.h> #endif // USE_QT3 @@ -38,7 +38,10 @@ Boston, MA 02110-1301, USA. // Reimplement the QUComExtra_P class // For Qt4, some changes are needed -//#include <Qt/q3asciidict.h> +class QUObject: public QObject { +public: +// bool qt_invoke(); +}; #endif // USE_QT4 diff --git a/qtinterface/tqcleanuphandler.h b/qtinterface/tqcleanuphandler.h index 1a5b6e8..faabf35 100644 --- a/qtinterface/tqcleanuphandler.h +++ b/qtinterface/tqcleanuphandler.h @@ -40,6 +40,92 @@ Boston, MA 02110-1301, USA. //#include <Qt/qcleanuphandler.h> +#include "tqptrlist.h" + +template<class Type> +class TQCleanupHandler +{ +public: + TQCleanupHandler() : cleanupObjects( 0 ) {} + ~TQCleanupHandler() { clear(); } + + Type* add( Type **object ) { + if ( !cleanupObjects ) + cleanupObjects = new Q3PtrList<Type*>; + cleanupObjects->insert( 0, object ); + return *object; + } + + void remove( Type **object ) { + if ( !cleanupObjects ) + return; + if ( cleanupObjects->findRef( object ) >= 0 ) + (void) cleanupObjects->take(); + } + + bool isEmpty() const { + return cleanupObjects ? cleanupObjects->isEmpty() : TRUE; + } + + void clear() { + if ( !cleanupObjects ) + return; + Q3PtrListIterator<Type*> it( *cleanupObjects ); + Type **object; + while ( ( object = it.current() ) ) { + delete *object; + *object = 0; + cleanupObjects->remove( object ); + } + delete cleanupObjects; + cleanupObjects = 0; + } + +private: + Q3PtrList<Type*> *cleanupObjects; +}; + +template<class Type> +class TQSingleCleanupHandler +{ +public: + TQSingleCleanupHandler() : object( 0 ) {} + ~TQSingleCleanupHandler() { + if ( object ) { + delete *object; + *object = 0; + } + } + Type* set( Type **o ) { + object = o; + return *object; + } + void reset() { object = 0; } +private: + Type **object; +}; + +template<class Type> +class TQSharedCleanupHandler +{ +public: + TQSharedCleanupHandler() : object( 0 ) {} + ~TQSharedCleanupHandler() { + if ( object ) { + if ( (*object)->deref() ) + delete *object; + *object = 0; + } + } + Type* set( Type **o ) { + object = o; + return *object; + } + void reset() { object = 0; } +private: + Type **object; +}; + #endif // USE_QT4 #endif /* TQCLEANUPHANDLER_H */
\ No newline at end of file diff --git a/qtinterface/tqcommonstyle.h b/qtinterface/tqcommonstyle.h index 187a9e3..4b6e51e 100644 --- a/qtinterface/tqcommonstyle.h +++ b/qtinterface/tqcommonstyle.h @@ -38,6 +38,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QCommonStyle class // For Qt4, some changes are needed +#include <tqstyle.h> #include <Qt/qcommonstyle.h> #endif // USE_QT4 diff --git a/qtinterface/tqeventloop.cpp b/qtinterface/tqeventloop.cpp index 85dc0da..ef322ca 100644 --- a/qtinterface/tqeventloop.cpp +++ b/qtinterface/tqeventloop.cpp @@ -29,4 +29,8 @@ static TQEventLoop *eventLoop () return static_cast<TQEventLoop *>(QAbstractEventDispatcher::instance()); } +bool TQEventLoop::processEvents( ProcessEventsFlags flags ) { + return QEventLoop::processEvents((ProcessEventsFlag)flags); +} + #endif
\ No newline at end of file diff --git a/qtinterface/tqeventloop.h b/qtinterface/tqeventloop.h index 8ae2c8f..c84284f 100644 --- a/qtinterface/tqeventloop.h +++ b/qtinterface/tqeventloop.h @@ -41,10 +41,21 @@ Boston, MA 02110-1301, USA. #include <Qt/qeventloop.h> #include <Qt/qabstracteventdispatcher.h> -class TQEventLoop : public QAbstractEventDispatcher { +class TQEventLoop : public QAbstractEventDispatcher, QEventLoop { public: static TQEventLoop *eventLoop (); - //void WaitForMore (); + + enum ProcessEvents { + AllEvents = QEventLoop::AllEvents, + ExcludeUserInput = QEventLoop::ExcludeUserInputEvents, + ExcludeSocketNotifiers = QEventLoop::ExcludeSocketNotifiers, + WaitForMore = QEventLoop::WaitForMoreEvents + }; + + typedef uint ProcessEventsFlags; + + bool processEvents( ProcessEventsFlags flags ); + }; #endif // USE_QT4 diff --git a/qtinterface/tqimage.cpp b/qtinterface/tqimage.cpp index 19cb941..21f8773 100644 --- a/qtinterface/tqimage.cpp +++ b/qtinterface/tqimage.cpp @@ -21,3 +21,49 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqimage.h> + +#ifdef USE_QT4 + +QRgb *QImage::ptrColorTable() const { + return colorTable().data(); +} + +TQImageIO::TQImageIO() { + m_imageReader = new QImageReader(); + m_imageWriter = new QImageWriter(); +} + +TQImageIO::TQImageIO( QIODevice *ioDevice, const char *format ) { + m_imageReader = new QImageReader(ioDevice, format); + m_imageWriter = new QImageWriter(ioDevice, format); +} + +TQImageIO::TQImageIO( const QString &fileName, const char* format ) { + m_imageReader = new QImageReader(fileName, format); + m_imageWriter = new QImageWriter(fileName, format); +} +TQImageIO::~TQImageIO() { + delete m_imageReader; + delete m_imageWriter; +} + +bool TQImageIO::read() { + m_currentImage = m_imageReader->read(); + if (m_currentImage.isNull() == true) + return false; + return true; +} + +bool TQImageIO::write() { + return m_imageWriter->write(m_currentImage); +} + +const QImage &TQImageIO::image() const { + return m_currentImage; +} + +void TQImageIO::setImage( const QImage & image ) { + m_currentImage = image; +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqimage.h b/qtinterface/tqimage.h index f20d7ce..0e93bb1 100644 --- a/qtinterface/tqimage.h +++ b/qtinterface/tqimage.h @@ -38,7 +38,29 @@ Boston, MA 02110-1301, USA. // Reimplement the QImage class // For Qt4, some changes are needed -#include <Qt/qimage.h> +#include <tqt4/Qt/qimage.h> +#include <Qt/qimagereader.h> +#include <Qt/qimagewriter.h> + +class TQImageIO { +public: + TQImageIO(); + TQImageIO( QIODevice *ioDevice, const char *format ); + TQImageIO( const QString &fileName, const char* format ); + ~TQImageIO(); + + bool read(); + bool write(); + + const QImage &image() const; + void setImage( const QImage & ); + +protected: + QImageReader *m_imageReader; + QImageWriter *m_imageWriter; + + QImage m_currentImage; +}; #endif // USE_QT4 diff --git a/qtinterface/tqmetaobject.cpp b/qtinterface/tqmetaobject.cpp index 5df02d0..448470b 100644 --- a/qtinterface/tqmetaobject.cpp +++ b/qtinterface/tqmetaobject.cpp @@ -34,7 +34,7 @@ Boston, MA 02110-1301, USA. int QMetaObject::numSlots( bool super ) const // number of slots { int i; - int n; + int n=0; for (i=0;i<methodCount();i++) { if (method(i).methodType() == QMetaMethod::Slot) { n++; @@ -56,7 +56,7 @@ int QMetaObject::numSlots( bool super ) const // number of slots int QMetaObject::numSignals( bool super ) const // number of signals { int i; - int n; + int n=0; for (i=0;i<methodCount();i++) { if (method(i).methodType() == QMetaMethod::Signal) { n++; @@ -125,12 +125,14 @@ const QMetaMethod* QMetaObject::signal( int index, bool super ) const If \a super is TRUE, inherited signals are included. */ -QStringList QMetaObject::signalNames( bool super ) const +TQT_QT_STRING_LIST_TYPE QMetaObject::signalNames( bool super ) const { - QStringList l( FALSE ); - int n = numSignals( super ); + TQT_QT_STRING_LIST_TYPE l( FALSE ); + int n = methodCount(); for( int i = 0; i < n; ++i ) { - l.append( signal(i, super)->signature() ); + if (method(i).methodType() == QMetaMethod::Signal) { + l.append( normalizedSignature(signal(i, super)->signature()) ); + } } return l; } @@ -142,13 +144,160 @@ QStringList QMetaObject::signalNames( bool super ) const \sa numSlots() */ -QStringList QMetaObject::slotNames( bool super ) const +TQT_QT_STRING_LIST_TYPE QMetaObject::slotNames( bool super ) const { - QStringList l( FALSE ); - int n = numSlots( super ); + TQT_QT_STRING_LIST_TYPE l( FALSE ); + int n = methodCount(); for( int i = 0; i < n; ++i ) - l.append( slot( i, super)->signature() ); + if (method(i).methodType() == QMetaMethod::Slot) { + l.append( normalizedSignature(slot( i, super)->signature()) ); + } return l; } +/*! \internal + Returns the index of the slot with name \n or -1 if no such slot exists. + + If \a super is TRUE, inherited slots are included. + + FIXME: Superclass handling is badly broken + */ +int QMetaObject::findSlot( const char* n, bool super ) const +{ + TQT_QT_STRING_LIST_TYPE l( FALSE ); + int m = methodCount(); + for( int i = 0; i < m; ++i ) { + if ( normalizedSignature(slot( i, super)->signature()) == QByteArray(n) ) { + if (method(i).methodType() == QMetaMethod::Slot) { + return i; + } + } + } + return -1; +} + +/*! \internal + Returns the index of the signal with name \n or -1 if no such signal exists. + + If \a super is TRUE, inherited signals are included. + + FIXME: Superclass handling is badly broken +*/ +int QMetaObject::findSignal( const char* n, bool super ) const +{ + TQT_QT_STRING_LIST_TYPE l( FALSE ); + int m = methodCount(); + for( int i = 0; i < m; ++i ) { + if ( normalizedSignature(signal( i, super)->signature()) == QByteArray(n) ) { + if (method(i).methodType() == QMetaMethod::Signal) { + return i; + } + } + } + return -1; +} + +#ifndef QT_NO_PROPERTIES + +/*! + Returns the number of properties for this class. + + If \a super is TRUE, inherited properties are included. + + \sa propertyNames() + */ +int QMetaObject::numProperties( bool super ) const // number of signals +{ + int i; + int n=0; + for (i=0;i<propertyCount();i++) { +// if (property(i).propertyType() == QMetaProperty::Property) { + n++; +// } + } + + if ( !super || !superClass() ) + return n; + return n + superClass()->numProperties( super ); +} + +/*! + Returns the property meta data for the property at index \a index + or 0 if no such property exists. + + If \a super is TRUE, inherited properties are included. + + \sa propertyNames() + + FIXME: Superclass handling is badly broken + */ +const QMetaProperty* QMetaObject::property( int index, bool super ) const +{ + QMetaProperty mp; + const QMetaProperty *pr; + int idx = index - ( super ? propertyOffset() : 0 ); +// if ( d->propData && idx >= 0 && idx < (int)d->numPropData ) + if ( idx >= 0 && idx < numProperties(true) ) + mp = property(idx); + pr = ∓ + return pr; + if ( !super || !superClass() ) + return 0; + return superClass()->property( index, super ); +} + +/*! + Returns a list with the names of all this class's properties. + + If \a super is TRUE, inherited properties are included. + + \sa property() +*/ +TQT_QT_STRING_LIST_TYPE QMetaObject::propertyNames( bool super ) const +{ +// TQT_QT_STRING_LIST_TYPE l( FALSE ); +// +// if ( superclass && super ) { +// QStrList sl = superclass->propertyNames( super ); +// for ( QStrListIterator slit( sl ); slit.current(); ++slit ) +// l.append( slit.current() ); +// } +// +// for( int i = 0; i < d->numPropData; ++i ) { +// if ( d->propData[i].isValid() ) +// l.append( d->propData[i].name() ); +// } +// +// return l; + + TQT_QT_STRING_LIST_TYPE l( FALSE ); + int n = numProperties( super ); + for( int i = 0; i < n; ++i ) + l.append( property( i, super)->name() ); + return l; +} + +/*! + Returns the index for the property with name \a name or -1 if no + such property exists. + + If \a super is TRUE, inherited properties are included. + + \sa property(), propertyNames() + + FIXME: Superclass handling is badly broken +*/ + +int QMetaObject::findProperty( const char *name, bool super ) const +{ + return indexOfProperty( name ); +} + +#endif // QT_NO_PROPERTIES + +bool QMetaProperty::writable() const +{ + return isWritable(); +} + #endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqmetaobject.h b/qtinterface/tqmetaobject.h index 1c35e26..9f6ac91 100644 --- a/qtinterface/tqmetaobject.h +++ b/qtinterface/tqmetaobject.h @@ -41,7 +41,7 @@ Boston, MA 02110-1301, USA. // For Qt4, some changes are needed #include <tqt4/Qt/qobjectdefs.h> -#include <Qt/qmetaobject.h> +#include <tqt4/Qt/qmetaobject.h> #endif // USE_QT4 diff --git a/qtinterface/tqobject.cpp b/qtinterface/tqobject.cpp index 8fb45d9..22df8ac 100644 --- a/qtinterface/tqobject.cpp +++ b/qtinterface/tqobject.cpp @@ -40,8 +40,15 @@ static const QObjectList *objectTrees() { const QObjectList *QObject::ptrchildren() const { QObjectList ql; + QObjectList *qlr; ql = this->children(); - return &ql; + qlr = &ql; + return qlr; +} + +bool QObject::qt_invoke(int slot, QUObject* uo) { + QMetaMethod method = uo->metaObject()->method(slot); + return method.invoke(this, Qt::DirectConnection); } #endif
\ No newline at end of file diff --git a/qtinterface/tqpixmap.cpp b/qtinterface/tqpixmap.cpp index 31359db..a7f52d2 100644 --- a/qtinterface/tqpixmap.cpp +++ b/qtinterface/tqpixmap.cpp @@ -21,3 +21,11 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqpixmap.h> + +#ifdef USE_QT4 + +bool QPixmap::convertFromImage(const QImage &img, int flags) { + return convertFromImage(img, (Qt::ImageConversionFlags)flags); +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqpixmap.h b/qtinterface/tqpixmap.h index 2fac3e2..e5dab4c 100644 --- a/qtinterface/tqpixmap.h +++ b/qtinterface/tqpixmap.h @@ -38,7 +38,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QPixmap class // For Qt4, some changes are needed -#include <Qt/qpixmap.h> +#include <tqt4/Qt/qpixmap.h> #endif // USE_QT4 diff --git a/qtinterface/tqpointarray.cpp b/qtinterface/tqpointarray.cpp index 46eedec..10a9285 100644 --- a/qtinterface/tqpointarray.cpp +++ b/qtinterface/tqpointarray.cpp @@ -21,3 +21,20 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqpointarray.h> + +#ifdef USE_QT4 + +/*! + \internal + Constructs a point array with \a nPoints points, taken from the + \a points array. + + Equivalent to setPoints(nPoints, points). +*/ + +Q3PointArray::Q3PointArray( int nPoints, const QCOORD *points ) +{ + setPoints( nPoints, points ); +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqpointarray.h b/qtinterface/tqpointarray.h index 5d3805b..3bd335f 100644 --- a/qtinterface/tqpointarray.h +++ b/qtinterface/tqpointarray.h @@ -38,7 +38,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QAccel class // For Qt4, some changes are needed -#include <Qt/q3pointarray.h> +#include <tqt4/Qt/q3pointarray.h> #endif // USE_QT4 diff --git a/qtinterface/tqstyle.cpp b/qtinterface/tqstyle.cpp index 56e16da..16c9de2 100644 --- a/qtinterface/tqstyle.cpp +++ b/qtinterface/tqstyle.cpp @@ -21,3 +21,9 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqstyle.h> + +#ifdef USE_QT4 + +TQStyle::TQStyle() : QStyle() {} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqstyle.h b/qtinterface/tqstyle.h index f1e1afe..ecb1a85 100644 --- a/qtinterface/tqstyle.h +++ b/qtinterface/tqstyle.h @@ -39,6 +39,13 @@ Boston, MA 02110-1301, USA. // For Qt4, some changes are needed #include <Qt/qstyle.h> +#include <Qt/qstyleoption.h> + +class TQStyle : public QStyle { +public: + TQStyle(); + virtual ~TQStyle(); +}; #endif // USE_QT4 diff --git a/qtinterface/tqt.h b/qtinterface/tqt.h index b11ebf4..8db5e27 100644 --- a/qtinterface/tqt.h +++ b/qtinterface/tqt.h @@ -50,6 +50,32 @@ Boston, MA 02110-1301, USA. #ifdef USE_QT3 #define tqchildren children #define tqaccess access +#define tqcolorTable colorTable +#define TQSO_Default Default +#define tqqt_cast ::qt_cast + +#define TQAlignCenter AlignCenter +#define TQNoBrush NoBrush + +#define tqred red +#define tqgreen green +#define tqblue blue +#define tqcyan cyan +#define tqmagenta magenta +#define tqyellow yellow +#define tqdarkRed darkRed +#define tqdarkGreen darkGreen +#define tqdarkBlue darkBlue +#define tqdarkCyan darkCyan +#define tqdarkMagenta darkMagenta +#define tqdarkYellow darkYellow +#define tqwhite white +#define tqlightGray lightGray +#define tqgray gray +#define tqdarkGray darkGray +#define tqblack black +#define tqcolor0 color0 +#define tqcolor1 color1 #define TQAccel QAccel #define TQAccessible QAccessible @@ -531,21 +557,170 @@ Boston, MA 02110-1301, USA. #endif #ifdef USE_QT4 + +//#define TQT_QT_STRING_LIST_TYPE QStringList +#define TQT_QT_STRING_LIST_TYPE Q3StrList + +#ifdef __cplusplus +class TQT_QT_STRING_LIST_TYPE; +class QUObject; + #include <tqt4/Qt/qobjectdefs.h> #include <tqt4/Qt/qlist.h> #include <tqt4/Qt/qbytearray.h> #include <tqt4/Qt/qobject.h> +#include <tqucomextra_p.h> +#include <tqt4/Qt/qmetaobject.h> #include <tqeventloop.h> +#include <tqt4/Qt/qimage.h> +#include <tqt4/Qt/qpixmap.h> +#include <tqt4/Qt/qwidget.h> #include <tqt4/Qt/qapplication.h> #include <tqt4/Qt/q3cstring.h> +#include <tqt4/Qt/q3pointarray.h> + +#include <Qt/q3strlist.h> + +#include <Qt/q3popupmenu.h> #include <tqlistiterator.h> +#endif // __cplusplus #define tqchildren ptrchildren #define tqaccess access() +#define tqcolorTable ptrColorTable +#define TQSO_Default SO_Default +#define tqqt_cast qobject_cast + +#define TQAlignCenter Qt::AlignCenter +#define TQNoBrush Qt::NoBrush #define QMetaData QMetaMethod +#define ColorOnly Qt::ColorOnly +#define MonoOnly Qt::MonoOnly +#define ColorMode_Mask Qt::ColorMode_Mask + +#define tqred Qt::red +#define tqgreen Qt::green +#define tqblue Qt::blue +#define tqcyan Qt::cyan +#define tqmagenta Qt::magenta +#define tqyellow Qt::yellow +#define tqdarkRed Qt::darkRed +#define tqdarkGreen Qt::darkGreen +#define tqdarkBlue Qt::darkBlue +#define tqdarkCyan Qt::darkCyan +#define tqdarkMagenta Qt::darkMagenta +#define tqdarkYellow Qt::darkYellow +#define tqwhite Qt::white +#define tqlightGray Qt::lightGray +#define tqgray Qt::gray +#define tqdarkGray Qt::darkGray +#define tqblack Qt::black +#define tqcolor0 Qt::color0 +#define tqcolor1 Qt::color1 + +#define SubRect SubElement +#define SR_PushButtonContents SE_PushButtonContents +#define SR_PushButtonFocusRect SE_PushButtonFocusRect +#define SR_CheckBoxIndicator SE_CheckBoxIndicator +#define SR_CheckBoxContents SE_CheckBoxContents +#define SR_CheckBoxFocusRect SE_CheckBoxFocusRect +#define SR_RadioButtonIndicator SE_RadioButtonIndicator +#define SR_RadioButtonContents SE_RadioButtonContents +#define SR_RadioButtonFocusRect SE_RadioButtonFocusRect +#define SR_ComboBoxFocusRect SE_ComboBoxFocusRect +#define SR_SliderFocusRect SE_SliderFocusRect +#define SR_DockWindowHandleRect SE_DockWindowHandleRect +#define SR_ProgressBarGroove SE_ProgressBarGroove +#define SR_ProgressBarContents SE_ProgressBarContents +#define SR_ProgressBarLabel SE_ProgressBarLabel +#define SR_ToolButtonContents SE_ToolButtonContents +#define SR_DialogButtonAccept SE_DialogButtonAccept +#define SR_DialogButtonReject SE_DialogButtonReject +#define SR_DialogButtonApply SE_DialogButtonApply +#define SR_DialogButtonHelp SE_DialogButtonHelp +#define SR_DialogButtonAll SE_DialogButtonAll +#define SR_DialogButtonAbort SE_DialogButtonAbort +#define SR_DialogButtonIgnore SE_DialogButtonIgnore +#define SR_DialogButtonRetry SE_DialogButtonRetry +#define SR_DialogButtonCustom SE_DialogButtonCustom +#define SR_ToolBoxTabContents SE_ToolBoxTabContents +#define SR_CustomBase SE_CustomBase + +#define StylePixmap StandardPixmap +// #define SP_TitleBarMinButton SC_TitleBarMinButton +// #define SP_TitleBarMaxButton SC_TitleBarMaxButton +// #define SP_TitleBarCloseButton SC_TitleBarCloseButton +// #define SP_TitleBarNormalButton SC_TitleBarNormalButton +// #define SP_TitleBarShadeButton SC_TitleBarShadeButton +// #define SP_TitleBarUnshadeButton SC_TitleBarUnshadeButton +// #define SP_DockWindowCloseButton SC_DockWindowCloseButton +// #define SP_MessageBoxInformation SC_MessageBoxInformation +// #define SP_MessageBoxWarning SC_MessageBoxWarning +// #define SP_MessageBoxCritical SC_MessageBoxCritical +// #define SP_MessageBoxQuestion SC_MessageBoxQuestion +// #define SP_CustomBase SC_CustomBase + +#define StyleFlags StateFlags +#define Style_Default QStyle::State_Default +#define Style_Enabled QStyle::State_Enabled +#define Style_Raised QStyle::State_Raised +#define Style_Sunken QStyle::State_Sunken +#define Style_Off QStyle::State_Off +#define Style_NoChange QStyle::State_NoChange +#define Style_On QStyle::State_On +#define Style_Down QStyle::State_DownArrow +#define Style_Horizontal QStyle::State_Horizontal +#define Style_HasFocus QStyle::State_HasFocus +#define Style_To QStyle::State_To +#define Style_Bottom QStyle::State_Bottom +#define Style_FocusAtBorder QStyle::State_FocusAtBorder +#define Style_AutoRaise QStyle::State_AutoRaise +#define Style_MouseOver QStyle::State_MouseOver +#define Style_Up QStyle::State_UpArrow +#define Style_Selected QStyle::State_Selected +#define Style_Active QStyle::State_Active +#define Style_ButtonDefault QStyle::State_ButtonDefault + +#define PE_ArrowDown PE_IndicatorArrowDown +#define PE_ArrowUp PE_IndicatorArrowUp +#define PE_ButtonTool PE_PanelButtonTool +#define PE_DockWindowHandle PE_IndicatorToolBarHandle +#define PE_DockWindowSeparator PE_Q3DockWindowSeparator +// Verify this one -------------v +#define PE_FocusRect PE_FrameFocusRect +#define PE_Panel PE_Frame +#define PE_RubberBand CE_RubberBand +#define PE_ScrollBarAddLine CE_ScrollBarAddLine +#define PE_ScrollBarAddPage CE_ScrollBarAddPage +#define PE_ScrollBarFirst CE_ScrollBarFirst +#define PE_ScrollBarLast CE_ScrollBarLast +#define PE_ScrollBarSlider CE_ScrollBarSlider +#define PE_ScrollBarSubLine CE_ScrollBarSubLine +#define PE_ScrollBarSubPage CE_ScrollBarSubPage + +#define SC_ListView SC_Q3ListView +#define SC_ListViewBranch SC_Q3ListViewBranch +#define SC_ListViewExpand SC_Q3ListViewExpand + +#define WState Qt::WidgetAttribute +#define WState_Polished Qt::WA_WState_Polished + +#define SH_PopupMenu_Scrollable SH_Menu_Scrollable +#define SH_PopupMenu_SloppySubMenus SH_Menu_SloppySubMenus +#define SH_PopupMenu_SubMenuPopupDelay SH_Menu_SubMenuPopupDelay +#define SH_PopupMenu_AllowActiveAndDisabled SH_Menu_AllowActiveAndDisabled +#define SH_PopupMenu_MouseTracking SH_Menu_MouseTracking + +#define CE_PopupMenuScroller CE_MenuScroller + +#define PM_DockWindowHandleExtent PM_DockWidgetHandleExtent +#define PM_MenuBarFrameWidth PM_ToolBarFrameWidth +#define PM_DockWindowFrameWidth PM_DockWidgetFrameWidth +#define PM_PopupMenuScrollerHeight PM_MenuScrollerHeight + #define TQAccel Q3Accel #define TQAccessible QAccessible #define TQAccessibleObject QAccessibleObject @@ -599,9 +774,9 @@ Boston, MA 02110-1301, USA. #define TQCanvasText Q3CanvasText #define TQCDEStyle QCDEStyle #define TQCheckBox QCheckBox -#define TQCleanupHandler QCleanupHandler -#define TQSingleCleanupHandler QSingleCleanupHandler -#define TQSharedCleanupHandler QSharedCleanupHandler +// #define TQCleanupHandler QCleanupHandler +// #define TQSingleCleanupHandler QSingleCleanupHandler +// #define TQSharedCleanupHandler QSharedCleanupHandler #define TQShared Q3Shared #define TQColor QColor #define TQColorDialog QColorDialog @@ -760,7 +935,7 @@ Boston, MA 02110-1301, USA. #define TQImageFormatPlugin QImageFormatPlugin #define TQImageTextKeyLang QImageTextKeyLang #define TQImage QImage -#define TQImageIO QImageIO +//#define TQImageIO QImageIO #define TQInputContextFactory QInputContextFactory #define TQInputContext QInputContext #define TQIntCache Q3IntCache @@ -932,7 +1107,7 @@ Boston, MA 02110-1301, USA. #define TQStrIVec QStrIVec #define TQStyleFactory QStyleFactory #define TQStyleOption QStyleOption -#define TQStyle QStyle +//#define TQStyle QStyle #define TQStyleHintReturn QStyleHintReturn #define TQStylePlugin QStylePlugin #define TQStyleSheetItem Q3StyleSheetItem diff --git a/qtinterface/tqt4/Qt/q3pointarray.h b/qtinterface/tqt4/Qt/q3pointarray.h new file mode 100644 index 0000000..c11c8a4 --- /dev/null +++ b/qtinterface/tqt4/Qt/q3pointarray.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt3Support module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q3POINTARRAY_H +#define Q3POINTARRAY_H + +#include <QtGui/qpolygon.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +class Q_COMPAT_EXPORT Q3PointArray : public QPolygon +{ +public: + inline Q3PointArray() : QPolygon() {} + inline Q3PointArray(const QRect &r, bool closed=false) : QPolygon(r, closed) {} + inline Q3PointArray(const QPolygon& a) : QPolygon(a) {} + Q3PointArray( int nPoints, const QCOORD *points ); + + inline Q3PointArray copy() const { return *this; } + inline bool isNull() { return isEmpty(); } + void makeEllipse(int x, int y, int w, int h); +#ifndef QT_NO_WMATRIX + void makeArc(int x, int y, int w, int h, int a1, int a2); + void makeArc(int x, int y, int w, int h, int a1, int a2, const QMatrix &matrix); +#endif + Q3PointArray cubicBezier() const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3POINTARRAY_H diff --git a/qtinterface/tqt4/Qt/qimage.h b/qtinterface/tqt4/Qt/qimage.h new file mode 100644 index 0000000..f2cd539 --- /dev/null +++ b/qtinterface/tqt4/Qt/qimage.h @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIMAGE_H +#define QIMAGE_H + +#include <QtGui/qtransform.h> +#include <QtGui/qpaintdevice.h> +#include <QtGui/qrgb.h> +#include <QtCore/qbytearray.h> +#include <QtCore/qrect.h> +#include <QtCore/qstring.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIODevice; +class QStringList; +class QMatrix; +class QTransform; +class QVariant; +template <class T> class QList; +template <class T> class QVector; + +struct QImageData; +class QImageDataMisc; // internal +#ifndef QT_NO_IMAGE_TEXT +class Q_GUI_EXPORT QImageTextKeyLang { +public: + QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } + QImageTextKeyLang() { } + + QByteArray key; + QByteArray lang; + + bool operator< (const QImageTextKeyLang& other) const + { return key < other.key || (key==other.key && lang < other.lang); } + bool operator== (const QImageTextKeyLang& other) const + { return key==other.key && lang==other.lang; } + inline bool operator!= (const QImageTextKeyLang &other) const + { return !operator==(other); } +}; +#endif //QT_NO_IMAGE_TEXT + + +class Q_GUI_EXPORT QImage : public QPaintDevice +{ +public: + enum InvertMode { InvertRgb, InvertRgba }; + enum Format { + Format_Invalid, + Format_Mono, + Format_MonoLSB, + Format_Indexed8, + Format_RGB32, + Format_ARGB32, + Format_ARGB32_Premultiplied, + Format_RGB16, + Format_ARGB8565_Premultiplied, + Format_RGB666, + Format_ARGB6666_Premultiplied, + Format_RGB555, + Format_ARGB8555_Premultiplied, + Format_RGB888, + Format_RGB444, + Format_ARGB4444_Premultiplied, +#if 0 + // reserved for future use + Format_RGB15, + Format_Grayscale16, + Format_Grayscale8, + Format_Grayscale4, + Format_Grayscale4LSB, + Format_Grayscale2, + Format_Grayscale2LSB +#endif +#ifndef qdoc + NImageFormats +#endif + }; + + QImage(); + QImage(const QSize &size, Format format); + QImage(int width, int height, Format format); + QImage(uchar *data, int width, int height, Format format); + QImage(const uchar *data, int width, int height, Format format); + QImage(uchar *data, int width, int height, int bytesPerLine, Format format); + QImage(const uchar *data, int width, int height, int bytesPerLine, Format format); + +#ifndef QT_NO_IMAGEFORMAT_XPM + explicit QImage(const char * const xpm[]); +#endif + explicit QImage(const QString &fileName, const char *format = 0); +#ifndef QT_NO_CAST_FROM_ASCII + explicit QImage(const char *fileName, const char *format = 0); +#endif + + QImage(const QImage &); + ~QImage(); + + QImage &operator=(const QImage &); + bool isNull() const; + + int devType() const; + + bool operator==(const QImage &) const; + bool operator!=(const QImage &) const; + operator QVariant() const; + void detach(); + bool isDetached() const; + + QImage copy(const QRect &rect = QRect()) const; + inline QImage copy(int x, int y, int w, int h) const + { return copy(QRect(x, y, w, h)); } + + Format format() const; + + QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT; + QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const Q_REQUIRED_RESULT; + + int width() const; + int height() const; + QSize size() const; + QRect rect() const; + + int depth() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numColors() const; +#endif + int colorCount() const; + + QRgb color(int i) const; + void setColor(int i, QRgb c); +#ifdef QT_DEPRECATED + QT_DEPRECATED void setNumColors(int); +#endif + void setColorCount(int); + + bool allGray() const; + bool isGrayscale() const; + + uchar *bits(); + const uchar *bits() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numBytes() const; +#endif + int byteCount() const; + + uchar *scanLine(int); + uchar *scanLine(int) const; + int bytesPerLine() const; + + bool valid(int x, int y) const; + bool valid(const QPoint &pt) const; + + int pixelIndex(int x, int y) const; + int pixelIndex(const QPoint &pt) const; + + QRgb pixel(int x, int y) const; + QRgb pixel(const QPoint &pt) const; + + void setPixel(int x, int y, uint index_or_rgb); + void setPixel(const QPoint &pt, uint index_or_rgb); + + QVector<QRgb> colorTable() const; + QRgb *ptrColorTable() const; + void setColorTable(const QVector<QRgb> colors); + + void fill(uint pixel); + + bool hasAlphaChannel() const; + void setAlphaChannel(const QImage &alphaChannel); + QImage alphaChannel() const; + QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const; +#ifndef QT_NO_IMAGE_HEURISTIC_MASK + QImage createHeuristicMask(bool clipTight = true) const; +#endif + QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const; + + inline QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const + { return scaled(QSize(w, h), aspectMode, mode); } + QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QMatrix trueMatrix(const QMatrix &, int w, int h); + QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &, int w, int h); + QImage mirrored(bool horizontally = false, bool vertically = true) const; + QImage rgbSwapped() const; + void invertPixels(InvertMode = InvertRgb); + + + bool load(QIODevice *device, const char* format); + bool load(const QString &fileName, const char* format=0); + bool loadFromData(const uchar *buf, int len, const char *format = 0); + inline bool loadFromData(const QByteArray &data, const char* aformat=0) + { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); } + + bool save(const QString &fileName, const char* format=0, int quality=-1) const; + bool save(QIODevice *device, const char* format=0, int quality=-1) const; + + static QImage fromData(const uchar *data, int size, const char *format = 0); + inline static QImage fromData(const QByteArray &data, const char *format = 0) + { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); } + + int serialNumber() const; + qint64 cacheKey() const; + + QPaintEngine *paintEngine() const; + + // Auxiliary data + int dotsPerMeterX() const; + int dotsPerMeterY() const; + void setDotsPerMeterX(int); + void setDotsPerMeterY(int); + QPoint offset() const; + void setOffset(const QPoint&); +#ifndef QT_NO_IMAGE_TEXT + QStringList textKeys() const; + QString text(const QString &key = QString()) const; + void setText(const QString &key, const QString &value); + + // The following functions are obsolete as of 4.1 + QString text(const char* key, const char* lang=0) const; + QList<QImageTextKeyLang> textList() const; + QStringList textLanguages() const; + QString text(const QImageTextKeyLang&) const; + void setText(const char* key, const char* lang, const QString&); +#endif + +#ifdef QT3_SUPPORT + enum Endian { BigEndian, LittleEndian, IgnoreEndian }; + QT3_SUPPORT_CONSTRUCTOR QImage(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT_CONSTRUCTOR QImage(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, const QRgb *colortable, int numColors, Endian bitOrder); +#ifdef Q_WS_QWS + QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, int pbl, const QRgb *colortable, int numColors, Endian bitOrder); +#endif + inline QT3_SUPPORT Endian bitOrder() const { + Format f = format(); + return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian); + } + QT3_SUPPORT QImage convertDepth(int, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QT3_SUPPORT QImage convertDepthWithPalette(int, QRgb* p, int pc, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QT3_SUPPORT QImage convertBitOrder(Endian) const; + QT3_SUPPORT bool hasAlphaBuffer() const; + QT3_SUPPORT void setAlphaBuffer(bool); + QT3_SUPPORT uchar **jumpTable(); + QT3_SUPPORT const uchar * const *jumpTable() const; + inline QT3_SUPPORT void reset() { *this = QImage(); } + static inline QT3_SUPPORT Endian systemByteOrder() + { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; } + inline QT3_SUPPORT QImage swapRGB() const { return rgbSwapped(); } + inline QT3_SUPPORT QImage mirror(bool horizontally = false, bool vertically = true) const + { return mirrored(horizontally, vertically); } + QT3_SUPPORT bool create(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + QT3_SUPPORT bool create(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); + inline QT3_SUPPORT QImage xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } + inline QT3_SUPPORT QImage smoothScale(int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const + { return scaled(QSize(w, h), mode, Qt::SmoothTransformation); } + inline QImage QT3_SUPPORT smoothScale(const QSize &s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const + { return scaled(s, mode, Qt::SmoothTransformation); } + inline QT3_SUPPORT QImage scaleWidth(int w) const { return scaledToWidth(w); } + inline QT3_SUPPORT QImage scaleHeight(int h) const { return scaledToHeight(h); } + inline QT3_SUPPORT void invertPixels(bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); } + inline QT3_SUPPORT QImage copy(int x, int y, int w, int h, Qt::ImageConversionFlags) const + { return copy(QRect(x, y, w, h)); } + inline QT3_SUPPORT QImage copy(const QRect &rect, Qt::ImageConversionFlags) const + { return copy(rect); } + static QT3_SUPPORT Endian systemBitOrder(); + inline QT3_SUPPORT_CONSTRUCTOR QImage(const QByteArray &data) + { d = 0; *this = QImage::fromData(data); } +#endif + +protected: + virtual int metric(PaintDeviceMetric metric) const; + +private: + friend class QWSOnScreenSurface; + QImageData *d; + + friend class QRasterPixmapData; + friend class QPixmapCacheEntry; + friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image); + friend const QVector<QRgb> *qt_image_colortable(const QImage &image); + +public: + typedef QImageData * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QImage) +Q_DECLARE_TYPEINFO(QImage, Q_MOVABLE_TYPE); + +// Inline functions... + +Q_GUI_EXPORT_INLINE bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); } +Q_GUI_EXPORT_INLINE int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());} +Q_GUI_EXPORT_INLINE QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); } +Q_GUI_EXPORT_INLINE void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); } + +// QImage stream functions + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &); +#endif + +#ifdef QT3_SUPPORT +Q_GUI_EXPORT QT3_SUPPORT void bitBlt(QImage* dst, int dx, int dy, const QImage* src, + int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags = Qt::AutoColor); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QIMAGE_H diff --git a/qtinterface/tqt4/Qt/qmetaobject.h b/qtinterface/tqt4/Qt/qmetaobject.h new file mode 100644 index 0000000..9a662a5 --- /dev/null +++ b/qtinterface/tqt4/Qt/qmetaobject.h @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMETAOBJECT_H +#define QMETAOBJECT_H + +#include <QtCore/qobjectdefs.h> +#include <QtCore/qvariant.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +template <typename T> class QList; + +class Q_CORE_EXPORT QMetaMethod +{ +public: + inline QMetaMethod() : mobj(0),handle(0) {} + + const char *signature() const; + const char *typeName() const; + QList<QByteArray> parameterTypes() const; + QList<QByteArray> parameterNames() const; + const char *tag() const; + enum Access { Private, Protected, Public }; + Access access() const; + enum MethodType { Method, Signal, Slot, Constructor }; + MethodType methodType() const; + enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 }; + int attributes() const; + int methodIndex() const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + + bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + inline bool invoke(QObject *object, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, returnValue, + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, connectionType, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + QGenericArgument val0 = QGenericArgument(0), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE); + +class Q_CORE_EXPORT QMetaEnum +{ +public: + inline QMetaEnum() : mobj(0),handle(0) {} + + const char *name() const; + bool isFlag() const; + + int keyCount() const; + const char *key(int index) const; + int value(int index) const; + + const char *scope() const; + + int keyToValue(const char *key) const; + const char* valueToKey(int value) const; + int keysToValue(const char * keys) const; + QByteArray valueToKeys(int value) const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + + inline bool isValid() const { return name() != 0; } +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE); + +class Q_CORE_EXPORT QMetaProperty +{ +public: + QMetaProperty(); + + const char *name() const; + const char *typeName() const; + QVariant::Type type() const; + int userType() const; + int propertyIndex() const; + + bool isReadable() const; + bool isWritable() const; + bool isResettable() const; + bool isDesignable(const QObject *obj = 0) const; + bool isScriptable(const QObject *obj = 0) const; + bool isStored(const QObject *obj = 0) const; + bool isEditable(const QObject *obj = 0) const; + bool isUser(const QObject *obj = 0) const; + bool isConstant() const; + bool isFinal() const; + + bool isFlagType() const; + bool isEnumType() const; + QMetaEnum enumerator() const; + + bool hasNotifySignal() const; + QMetaMethod notifySignal() const; + int notifySignalIndex() const; + + QVariant read(const QObject *obj) const; + bool write(QObject *obj, const QVariant &value) const; + bool reset(QObject *obj) const; + + bool hasStdCppSet() const; + inline bool isValid() const { return isReadable(); } + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + +private: + const QMetaObject *mobj; + uint handle; + int idx; + QMetaEnum menum; + friend struct QMetaObject; + +public: + bool writable() const; +}; + +class Q_CORE_EXPORT QMetaClassInfo +{ +public: + inline QMetaClassInfo() : mobj(0),handle(0) {} + const char *name() const; + const char *value() const; + inline const QMetaObject *enclosingMetaObject() const { return mobj; } +private: + const QMetaObject *mobj; + uint handle; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMETAOBJECT_H diff --git a/qtinterface/tqt4/Qt/qobject.h b/qtinterface/tqt4/Qt/qobject.h index 558c368..9da8eab 100644 --- a/qtinterface/tqt4/Qt/qobject.h +++ b/qtinterface/tqt4/Qt/qobject.h @@ -191,6 +191,7 @@ public: inline const QObjectList &children() const { return d_ptr->children; } const QObjectList *ptrchildren() const; static const QObjectList *objectTrees(); + bool qt_invoke(int slot, QUObject *uo); void setParent(QObject *); void installEventFilter(QObject *); diff --git a/qtinterface/tqt4/Qt/qobjectdefs.h b/qtinterface/tqt4/Qt/qobjectdefs.h index 32f9b80..3a50a14 100644 --- a/qtinterface/tqt4/Qt/qobjectdefs.h +++ b/qtinterface/tqt4/Qt/qobjectdefs.h @@ -450,8 +450,16 @@ struct Q_CORE_EXPORT QMetaObject int numSignals( bool super = FALSE ) const; const QMetaMethod *slot( int index, bool super = FALSE ) const; const QMetaMethod *signal( int index, bool super = FALSE ) const; - QStringList slotNames( bool super = FALSE ) const; - QStringList signalNames( bool super = FALSE ) const; + TQT_QT_STRING_LIST_TYPE slotNames( bool super = FALSE ) const; + TQT_QT_STRING_LIST_TYPE signalNames( bool super = FALSE ) const; + int findSlot( const char *, bool super = FALSE ) const; + int findSignal( const char *, bool super = FALSE ) const; +#ifndef QT_NO_PROPERTIES + int numProperties( bool super = FALSE ) const; + const QMetaProperty *property( int index, bool super ) const; + TQT_QT_STRING_LIST_TYPE propertyNames( bool super = FALSE ) const; + int findProperty( const char *name, bool super ) const; +#endif struct { // private data const QMetaObject *superdata; diff --git a/qtinterface/tqt4/Qt/qpixmap.h b/qtinterface/tqt4/Qt/qpixmap.h new file mode 100644 index 0000000..b973318 --- /dev/null +++ b/qtinterface/tqt4/Qt/qpixmap.h @@ -0,0 +1,330 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPIXMAP_H +#define QPIXMAP_H + +#include <QtGui/qpaintdevice.h> +#include <QtGui/qcolor.h> +#include <QtCore/qnamespace.h> +#include <QtCore/qstring.h> // char*->QString conversion +#include <QtCore/qsharedpointer.h> +#include <QtGui/qimage.h> +#include <QtGui/qtransform.h> + +QT_BEGIN_HEADER + +#if defined(Q_OS_SYMBIAN) +class CFbsBitmap; +class RSgImage; +#endif + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QImageWriter; +class QColor; +class QVariant; +class QX11Info; +class QPixmapData; + +class Q_GUI_EXPORT QPixmap : public QPaintDevice +{ +public: + QPixmap(); + explicit QPixmap(QPixmapData *data); + QPixmap(int w, int h); + QPixmap(const QSize &); + QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); +#ifndef QT_NO_IMAGEFORMAT_XPM + QPixmap(const char * const xpm[]); +#endif + QPixmap(const QPixmap &); + ~QPixmap(); + + QPixmap &operator=(const QPixmap &); + operator QVariant() const; + + bool isNull() const; // ### Qt 5: make inline + int devType() const; + + int width() const; // ### Qt 5: make inline + int height() const; // ### Qt 5: make inline + QSize size() const; + QRect rect() const; + int depth() const; + + static int defaultDepth(); + + void fill(const QColor &fillColor = Qt::white); + void fill(const QWidget *widget, const QPoint &ofs); + inline void fill(const QWidget *widget, int xofs, int yofs) { fill(widget, QPoint(xofs, yofs)); } + + QBitmap mask() const; + void setMask(const QBitmap &); + + QPixmap alphaChannel() const; + void setAlphaChannel(const QPixmap &); + + bool hasAlpha() const; + bool hasAlphaChannel() const; + +#ifndef QT_NO_IMAGE_HEURISTIC_MASK + QBitmap createHeuristicMask(bool clipTight = true) const; +#endif + QBitmap createMaskFromColor(const QColor &maskColor) const; // ### Qt 5: remove + QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const; + + static QPixmap grabWindow(WId, int x=0, int y=0, int w=-1, int h=-1); + static QPixmap grabWidget(QWidget *widget, const QRect &rect); + static inline QPixmap grabWidget(QWidget *widget, int x=0, int y=0, int w=-1, int h=-1) + { return grabWidget(widget, QRect(x, y, w, h)); } + + + inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const + { return scaled(QSize(w, h), aspectMode, mode); } + QPixmap scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, + Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QMatrix trueMatrix(const QMatrix &m, int w, int h); + QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &m, int w, int h); + + QImage toImage() const; + static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + + bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + inline bool loadFromData(const QByteArray &data, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool save(const QString& fileName, const char* format = 0, int quality = -1) const; + bool save(QIODevice* device, const char* format = 0, int quality = -1) const; + +#if defined(Q_WS_WIN) + enum HBitmapFormat { + NoAlpha, + PremultipliedAlpha, + Alpha + }; + + HBITMAP toWinHBITMAP(HBitmapFormat format = NoAlpha) const; + HICON toWinHICON() const; + + static QPixmap fromWinHBITMAP(HBITMAP hbitmap, HBitmapFormat format = NoAlpha); + static QPixmap fromWinHICON(HICON hicon); +#endif + +#if defined(Q_WS_MAC) + CGImageRef toMacCGImageRef() const; + static QPixmap fromMacCGImageRef(CGImageRef image); +#endif + +#if defined(Q_OS_SYMBIAN) + CFbsBitmap *toSymbianCFbsBitmap() const; + static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap); + RSgImage* toSymbianRSgImage() const; + static QPixmap fromSymbianRSgImage(RSgImage *sgImage); +#endif + + inline QPixmap copy(int x, int y, int width, int height) const; + QPixmap copy(const QRect &rect = QRect()) const; + + inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = 0); + void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0); + + int serialNumber() const; + qint64 cacheKey() const; + + bool isDetached() const; + void detach(); + + bool isQBitmap() const; + +#if defined(Q_WS_QWS) + const uchar *qwsBits() const; + int qwsBytesPerLine() const; + QRgb *clut() const; +#ifdef QT_DEPRECATED + QT_DEPRECATED int numCols() const; +#endif + int colorCount() const; +#elif defined(Q_WS_MAC) + Qt::HANDLE macQDHandle() const; + Qt::HANDLE macQDAlphaHandle() const; + Qt::HANDLE macCGHandle() const; +#elif defined(Q_WS_X11) + enum ShareMode { ImplicitlyShared, ExplicitlyShared }; + + static QPixmap fromX11Pixmap(Qt::HANDLE pixmap, ShareMode mode = ImplicitlyShared); + static int x11SetDefaultScreen(int screen); + void x11SetScreen(int screen); + const QX11Info &x11Info() const; + Qt::HANDLE x11PictureHandle() const; +#endif + +#if defined(Q_WS_X11) || defined(Q_WS_QWS) + Qt::HANDLE handle() const; +#endif + + QPaintEngine *paintEngine() const; + + inline bool operator!() const { return isNull(); } + +protected: + int metric(PaintDeviceMetric) const; + +#ifdef QT3_SUPPORT +public: + enum ColorMode { Auto, Color, Mono }; + QT3_SUPPORT_CONSTRUCTOR QPixmap(const QString& fileName, const char *format, ColorMode mode); + QT3_SUPPORT bool load(const QString& fileName, const char *format, ColorMode mode); + QT3_SUPPORT bool loadFromData(const uchar *buf, uint len, const char* format, ColorMode mode); + QT3_SUPPORT_CONSTRUCTOR QPixmap(const QImage& image); + QT3_SUPPORT QPixmap &operator=(const QImage &); + inline QT3_SUPPORT QImage convertToImage() const { return toImage(); } + QT3_SUPPORT bool convertFromImage(const QImage &, ColorMode mode); + QT3_SUPPORT bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor) + { (*this) = fromImage(img, flags); return !isNull(); } + QT3_SUPPORT bool convertFromImage(const QImage &img, int flags); + inline QT3_SUPPORT operator QImage() const { return toImage(); } + inline QT3_SUPPORT QPixmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } + inline QT3_SUPPORT bool selfMask() const { return false; } +private: + void resize_helper(const QSize &s); +public: + inline QT3_SUPPORT void resize(const QSize &s) { resize_helper(s); } + inline QT3_SUPPORT void resize(int width, int height) { resize_helper(QSize(width, height)); } +#endif + +private: + QExplicitlySharedDataPointer<QPixmapData> data; + + bool doImageIO(QImageWriter *io, int quality) const; + + // ### Qt5: remove the following three lines + enum Type { PixmapType, BitmapType }; // must match QPixmapData::PixelType + QPixmap(const QSize &s, Type); + void init(int, int, Type = PixmapType); + + QPixmap(const QSize &s, int type); + void init(int, int, int); + void deref(); +#if defined(Q_WS_WIN) + void initAlphaPixmap(uchar *bytes, int length, struct tagBITMAPINFO *bmi); +#endif + Q_DUMMY_COMPARISON_OPERATOR(QPixmap) +#ifdef Q_WS_MAC + friend CGContextRef qt_mac_cg_context(const QPaintDevice*); + friend CGImageRef qt_mac_create_imagemask(const QPixmap&, const QRectF&); + friend IconRef qt_mac_create_iconref(const QPixmap&); + friend quint32 *qt_mac_pixmap_get_base(const QPixmap*); + friend int qt_mac_pixmap_get_bytes_per_line(const QPixmap*); +#endif + friend class QPixmapData; + friend class QX11PixmapData; + friend class QMacPixmapData; + friend class QS60PixmapData; + friend class QBitmap; + friend class QPaintDevice; + friend class QPainter; + friend class QGLWidget; + friend class QX11PaintEngine; + friend class QCoreGraphicsPaintEngine; + friend class QWidgetPrivate; + friend class QRasterPaintEngine; + friend class QRasterBuffer; + friend class QPixmapCacheEntry; +#if !defined(QT_NO_DATASTREAM) + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); +#endif + friend Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap); + +public: + QPixmapData* pixmapData() const; + +public: + typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; + inline DataPtr &data_ptr() { return data; } +}; + +Q_DECLARE_SHARED(QPixmap) + +inline QPixmap QPixmap::copy(int ax, int ay, int awidth, int aheight) const +{ + return copy(QRect(ax, ay, awidth, aheight)); +} + +inline void QPixmap::scroll(int dx, int dy, int ax, int ay, int awidth, int aheight, QRegion *exposed) +{ + scroll(dx, dy, QRect(ax, ay, awidth, aheight), exposed); +} + +inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format, + Qt::ImageConversionFlags flags) +{ + return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), buf.size(), format, flags); +} + +/***************************************************************************** + QPixmap stream functions +*****************************************************************************/ + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); +#endif + +/***************************************************************************** + QPixmap (and QImage) helper functions +*****************************************************************************/ +#ifdef QT3_SUPPORT +QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, const QPixmap *src, + int sx=0, int sy=0, int sw=-1, int sh=-1); +#endif // QT3_SUPPORT + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPIXMAP_H diff --git a/qtinterface/tqt4/Qt/qwidget.h b/qtinterface/tqt4/Qt/qwidget.h new file mode 100644 index 0000000..c709689 --- /dev/null +++ b/qtinterface/tqt4/Qt/qwidget.h @@ -0,0 +1,1076 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIDGET_H +#define QWIDGET_H + +#include <QtGui/qwindowdefs.h> +#include <QtCore/qobject.h> +#include <QtCore/qmargins.h> +#include <QtGui/qpaintdevice.h> +#include <QtGui/qpalette.h> +#include <QtGui/qfont.h> +#include <QtGui/qfontmetrics.h> +#include <QtGui/qfontinfo.h> +#include <QtGui/qsizepolicy.h> +#include <QtGui/qregion.h> +#include <QtGui/qbrush.h> +#include <QtGui/qcursor.h> +#include <QtGui/qkeysequence.h> + +#ifdef QT_INCLUDE_COMPAT +#include <QtGui/qevent.h> +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QLayout; +class QWSRegionManager; +class QStyle; +class QAction; +class QVariant; + +class QActionEvent; +class QMouseEvent; +class QWheelEvent; +class QHoverEvent; +class QKeyEvent; +class QFocusEvent; +class QPaintEvent; +class QMoveEvent; +class QResizeEvent; +class QCloseEvent; +class QContextMenuEvent; +class QInputMethodEvent; +class QTabletEvent; +class QDragEnterEvent; +class QDragMoveEvent; +class QDragLeaveEvent; +class QDropEvent; +class QShowEvent; +class QHideEvent; +class QInputContext; +class QIcon; +class QWindowSurface; +class QLocale; +class QGraphicsProxyWidget; +class QGraphicsEffect; +#if defined(Q_WS_X11) +class QX11Info; +#endif + +class QWidgetData +{ +public: + WId winid; + uint widget_attributes; + Qt::WindowFlags window_flags; + uint window_state : 4; + uint focus_policy : 4; + uint sizehint_forced :1; + uint is_closing :1; + uint in_show : 1; + uint in_set_window_state : 1; + mutable uint fstrut_dirty : 1; + uint context_menu_policy : 3; + uint window_modality : 2; + uint in_destructor : 1; + uint unused : 13; + QRect crect; + mutable QPalette pal; + QFont fnt; +#if defined(Q_WS_QWS) +// QRegion req_region; // Requested region +// mutable QRegion paintable_region; // Paintable region +// mutable bool paintable_region_dirty;// needs to be recalculated +// mutable QRegion alloc_region; // Allocated region +// mutable bool alloc_region_dirty; // needs to be recalculated +// mutable int overlapping_children; // Handle overlapping children + + int alloc_region_index; +// int alloc_region_revision; +#endif + QRect wrect; +}; + +class QWidgetPrivate; + +class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWidget) + + Q_PROPERTY(bool modal READ isModal) + Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) + Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) + Q_PROPERTY(QRect frameGeometry READ frameGeometry) + Q_PROPERTY(QRect normalGeometry READ normalGeometry) + Q_PROPERTY(int x READ x) + Q_PROPERTY(int y READ y) + Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false) + Q_PROPERTY(QSize frameSize READ frameSize) + Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false) + Q_PROPERTY(int width READ width) + Q_PROPERTY(int height READ height) + Q_PROPERTY(QRect rect READ rect) + Q_PROPERTY(QRect childrenRect READ childrenRect) + Q_PROPERTY(QRegion childrenRegion READ childrenRegion) + Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) + Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) + Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false) + Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false) + Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement) + Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize) + Q_PROPERTY(QPalette palette READ palette WRITE setPalette) + Q_PROPERTY(QFont font READ font WRITE setFont) +#ifndef QT_NO_CURSOR + Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) +#endif + Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking) + Q_PROPERTY(bool isActiveWindow READ isActiveWindow) + Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) + Q_PROPERTY(bool focus READ hasFocus) + Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy) + Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false) + Q_PROPERTY(bool minimized READ isMinimized) + Q_PROPERTY(bool maximized READ isMaximized) + Q_PROPERTY(bool fullScreen READ isFullScreen) + Q_PROPERTY(QSize sizeHint READ sizeHint) + Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint) + Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops) + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow) + Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow) + Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow) + Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow) + Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow) +#ifndef QT_NO_TOOLTIP + Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) +#endif +#ifndef QT_NO_STATUSTIP + Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip) +#endif +#ifndef QT_NO_WHATSTHIS + Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) +#endif +#ifndef QT_NO_ACCESSIBILITY + Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName) + Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription) +#endif + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) + QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) + Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground) +#ifndef QT_NO_STYLE_STYLESHEET + Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) +#endif + Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale) + Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow) + Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) + +public: + enum RenderFlag { + DrawWindowBackground = 0x1, + DrawChildren = 0x2, + IgnoreMask = 0x4 + }; + Q_DECLARE_FLAGS(RenderFlags, RenderFlag) + + explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); +#ifdef QT3_SUPPORT + QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0); +#endif + ~QWidget(); + + int devType() const; + + WId winId() const; + void createWinId(); // internal, going away + inline WId internalWinId() const { return data->winid; } + WId effectiveWinId() const; + + // GUI style setting + QStyle *style() const; + void setStyle(QStyle *); + // Widget types and states + + bool isTopLevel() const; + bool isWindow() const; + + bool isModal() const; + Qt::WindowModality windowModality() const; + void setWindowModality(Qt::WindowModality windowModality); + + bool isEnabled() const; + bool isEnabledTo(QWidget*) const; + bool isEnabledToTLW() const; + + Qt::WidgetAttribute testWState( Qt::WidgetAttribute s ) const; + +public Q_SLOTS: + void setEnabled(bool); + void setDisabled(bool); + void setWindowModified(bool); + + // Widget coordinates + +public: + QRect frameGeometry() const; + const QRect &geometry() const; + QRect normalGeometry() const; + + int x() const; + int y() const; + QPoint pos() const; + QSize frameSize() const; + QSize size() const; + inline int width() const; + inline int height() const; + inline QRect rect() const; + QRect childrenRect() const; + QRegion childrenRegion() const; + + QSize minimumSize() const; + QSize maximumSize() const; + int minimumWidth() const; + int minimumHeight() const; + int maximumWidth() const; + int maximumHeight() const; + void setMinimumSize(const QSize &); + void setMinimumSize(int minw, int minh); + void setMaximumSize(const QSize &); + void setMaximumSize(int maxw, int maxh); + void setMinimumWidth(int minw); + void setMinimumHeight(int minh); + void setMaximumWidth(int maxw); + void setMaximumHeight(int maxh); + +#ifdef Q_QDOC + void setupUi(QWidget *widget); +#endif + + QSize sizeIncrement() const; + void setSizeIncrement(const QSize &); + void setSizeIncrement(int w, int h); + QSize baseSize() const; + void setBaseSize(const QSize &); + void setBaseSize(int basew, int baseh); + + void setFixedSize(const QSize &); + void setFixedSize(int w, int h); + void setFixedWidth(int w); + void setFixedHeight(int h); + + // Widget coordinate mapping + + QPoint mapToGlobal(const QPoint &) const; + QPoint mapFromGlobal(const QPoint &) const; + QPoint mapToParent(const QPoint &) const; + QPoint mapFromParent(const QPoint &) const; + QPoint mapTo(QWidget *, const QPoint &) const; + QPoint mapFrom(QWidget *, const QPoint &) const; + + QWidget *window() const; + QWidget *nativeParentWidget() const; + inline QWidget *topLevelWidget() const { return window(); } + + // Widget appearance functions + const QPalette &palette() const; + void setPalette(const QPalette &); + + void setBackgroundRole(QPalette::ColorRole); + QPalette::ColorRole backgroundRole() const; + + void setForegroundRole(QPalette::ColorRole); + QPalette::ColorRole foregroundRole() const; + + const QFont &font() const; + void setFont(const QFont &); + QFontMetrics fontMetrics() const; + QFontInfo fontInfo() const; + +#ifndef QT_NO_CURSOR + QCursor cursor() const; + void setCursor(const QCursor &); + void unsetCursor(); +#endif + + void setMouseTracking(bool enable); + bool hasMouseTracking() const; + bool underMouse() const; + + void setMask(const QBitmap &); + void setMask(const QRegion &); + QRegion mask() const; + void clearMask(); + + void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(), + const QRegion &sourceRegion = QRegion(), + RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); + + void render(QPainter *painter, const QPoint &targetOffset = QPoint(), + const QRegion &sourceRegion = QRegion(), + RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); + +#ifndef QT_NO_GRAPHICSEFFECT + QGraphicsEffect *graphicsEffect() const; + void setGraphicsEffect(QGraphicsEffect *effect); +#endif //QT_NO_GRAPHICSEFFECT + + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); + +public Q_SLOTS: + void setWindowTitle(const QString &); +#ifndef QT_NO_STYLE_STYLESHEET + void setStyleSheet(const QString& styleSheet); +#endif +public: +#ifndef QT_NO_STYLE_STYLESHEET + QString styleSheet() const; +#endif + QString windowTitle() const; + void setWindowIcon(const QIcon &icon); + QIcon windowIcon() const; + void setWindowIconText(const QString &); + QString windowIconText() const; + void setWindowRole(const QString &); + QString windowRole() const; + void setWindowFilePath(const QString &filePath); + QString windowFilePath() const; + + void setWindowOpacity(qreal level); + qreal windowOpacity() const; + + bool isWindowModified() const; +#ifndef QT_NO_TOOLTIP + void setToolTip(const QString &); + QString toolTip() const; +#endif +#ifndef QT_NO_STATUSTIP + void setStatusTip(const QString &); + QString statusTip() const; +#endif +#ifndef QT_NO_WHATSTHIS + void setWhatsThis(const QString &); + QString whatsThis() const; +#endif +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName() const; + void setAccessibleName(const QString &name); + QString accessibleDescription() const; + void setAccessibleDescription(const QString &description); +#endif + + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + void unsetLayoutDirection(); + + void setLocale(const QLocale &locale); + QLocale locale() const; + void unsetLocale(); + + inline bool isRightToLeft() const { return layoutDirection() == Qt::RightToLeft; } + inline bool isLeftToRight() const { return layoutDirection() == Qt::LeftToRight; } + +public Q_SLOTS: + inline void setFocus() { setFocus(Qt::OtherFocusReason); } + +public: + bool isActiveWindow() const; + void activateWindow(); + void clearFocus(); + + void setFocus(Qt::FocusReason reason); + Qt::FocusPolicy focusPolicy() const; + void setFocusPolicy(Qt::FocusPolicy policy); + bool hasFocus() const; + static void setTabOrder(QWidget *, QWidget *); + void setFocusProxy(QWidget *); + QWidget *focusProxy() const; + Qt::ContextMenuPolicy contextMenuPolicy() const; + void setContextMenuPolicy(Qt::ContextMenuPolicy policy); + + // Grab functions + void grabMouse(); +#ifndef QT_NO_CURSOR + void grabMouse(const QCursor &); +#endif + void releaseMouse(); + void grabKeyboard(); + void releaseKeyboard(); +#ifndef QT_NO_SHORTCUT + int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut); + void releaseShortcut(int id); + void setShortcutEnabled(int id, bool enable = true); + void setShortcutAutoRepeat(int id, bool enable = true); +#endif + static QWidget *mouseGrabber(); + static QWidget *keyboardGrabber(); + + // Update/refresh functions + inline bool updatesEnabled() const; + void setUpdatesEnabled(bool enable); + +#if 0 //def Q_WS_QWS + void repaintUnclipped(const QRegion &, bool erase = true); +#endif + +#ifndef QT_NO_GRAPHICSVIEW + QGraphicsProxyWidget *graphicsProxyWidget() const; +#endif + +public Q_SLOTS: + void update(); + void repaint(); + +public: + inline void update(int x, int y, int w, int h); + void update(const QRect&); + void update(const QRegion&); + + void repaint(int x, int y, int w, int h); + void repaint(const QRect &); + void repaint(const QRegion &); + +public Q_SLOTS: + // Widget management functions + + virtual void setVisible(bool visible); + inline void setHidden(bool hidden) { setVisible(!hidden); } +#ifndef Q_WS_WINCE + inline void show() { setVisible(true); } +#else + void show(); +#endif + inline void hide() { setVisible(false); } + inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); } + + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + + bool close(); + void raise(); + void lower(); + +public: + void stackUnder(QWidget*); + void move(int x, int y); + void move(const QPoint &); + void resize(int w, int h); + void resize(const QSize &); + inline void setGeometry(int x, int y, int w, int h); + void setGeometry(const QRect &); + QByteArray saveGeometry() const; + bool restoreGeometry(const QByteArray &geometry); + void adjustSize(); + bool isVisible() const; + bool isVisibleTo(QWidget*) const; + // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const + inline bool isHidden() const; + + bool isMinimized() const; + bool isMaximized() const; + bool isFullScreen() const; + + Qt::WindowStates windowState() const; + void setWindowState(Qt::WindowStates state); + void overrideWindowState(Qt::WindowStates state); + + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + + QSizePolicy sizePolicy() const; + void setSizePolicy(QSizePolicy); + inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical); + virtual int heightForWidth(int) const; + + QRegion visibleRegion() const; + + void setContentsMargins(int left, int top, int right, int bottom); + void setContentsMargins(const QMargins &margins); + void getContentsMargins(int *left, int *top, int *right, int *bottom) const; + QMargins contentsMargins() const; + + QRect contentsRect() const; + +public: + QLayout *layout() const; + void setLayout(QLayout *); + void updateGeometry(); + + void setParent(QWidget *parent); + void setParent(QWidget *parent, Qt::WindowFlags f); + + void scroll(int dx, int dy); + void scroll(int dx, int dy, const QRect&); + + // Misc. functions + + QWidget *focusWidget() const; + QWidget *nextInFocusChain() const; + QWidget *previousInFocusChain() const; + + // drag and drop + bool acceptDrops() const; + void setAcceptDrops(bool on); + +#ifndef QT_NO_ACTION + //actions + void addAction(QAction *action); + void addActions(QList<QAction*> actions); + void insertAction(QAction *before, QAction *action); + void insertActions(QAction *before, QList<QAction*> actions); + void removeAction(QAction *action); + QList<QAction*> actions() const; +#endif + + QWidget *parentWidget() const; + + void setWindowFlags(Qt::WindowFlags type); + inline Qt::WindowFlags windowFlags() const; + void overrideWindowFlags(Qt::WindowFlags type); + + inline Qt::WindowType windowType() const; + + static QWidget *find(WId); +#ifdef QT3_SUPPORT + static QT3_SUPPORT QWidgetMapper *wmapper(); +#endif + inline QWidget *childAt(int x, int y) const; + QWidget *childAt(const QPoint &p) const; + +#if defined(Q_WS_X11) + const QX11Info &x11Info() const; + Qt::HANDLE x11PictureHandle() const; +#endif + +#if defined(Q_WS_MAC) + Qt::HANDLE macQDHandle() const; + Qt::HANDLE macCGHandle() const; +#endif + +#if defined(Q_WS_WIN) + HDC getDC() const; + void releaseDC(HDC) const; +#else + Qt::HANDLE handle() const; +#endif + + void setAttribute(Qt::WidgetAttribute, bool on = true); + inline bool testAttribute(Qt::WidgetAttribute) const; + + QPaintEngine *paintEngine() const; + + void ensurePolished() const; + + QInputContext *inputContext(); + void setInputContext(QInputContext *); + + bool isAncestorOf(const QWidget *child) const; + +#ifdef QT_KEYPAD_NAVIGATION + bool hasEditFocus() const; + void setEditFocus(bool on); +#endif + + bool autoFillBackground() const; + void setAutoFillBackground(bool enabled); + + void setWindowSurface(QWindowSurface *surface); + QWindowSurface *windowSurface() const; + +Q_SIGNALS: + void customContextMenuRequested(const QPoint &pos); + +protected: + // Event handlers + bool event(QEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *); +#endif + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void enterEvent(QEvent *); + virtual void leaveEvent(QEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void moveEvent(QMoveEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void closeEvent(QCloseEvent *); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QContextMenuEvent *); +#endif +#ifndef QT_NO_TABLETEVENT + virtual void tabletEvent(QTabletEvent *); +#endif +#ifndef QT_NO_ACTION + virtual void actionEvent(QActionEvent *); +#endif + +#ifndef QT_NO_DRAGANDDROP + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); +#endif + + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + +#if defined(Q_WS_MAC) + virtual bool macEvent(EventHandlerCallRef, EventRef); +#endif +#if defined(Q_WS_WIN) + virtual bool winEvent(MSG *message, long *result); +#endif +#if defined(Q_WS_X11) + virtual bool x11Event(XEvent *); +#endif +#if defined(Q_WS_QWS) + virtual bool qwsEvent(QWSEvent *); +#endif + + // Misc. protected functions + virtual void changeEvent(QEvent *); + + int metric(PaintDeviceMetric) const; + + virtual void inputMethodEvent(QInputMethodEvent *); +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + +protected: + void resetInputContext(); +protected Q_SLOTS: + void updateMicroFocus(); +protected: + + void create(WId = 0, bool initializeWindow = true, + bool destroyOldWindow = true); + void destroy(bool destroyWindow = true, + bool destroySubWindows = true); + + virtual bool focusNextPrevChild(bool next); + inline bool focusNextChild() { return focusNextPrevChild(true); } + inline bool focusPreviousChild() { return focusNextPrevChild(false); } + +protected: + QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f); +private: + + bool testAttribute_helper(Qt::WidgetAttribute) const; + + QLayout *takeLayout(); + + friend class QBackingStoreDevice; + friend class QWidgetBackingStore; + friend class QApplication; + friend class QApplicationPrivate; + friend class QBaseApplication; + friend class QPainter; + friend class QPainterPrivate; + friend class QPixmap; // for QPixmap::fill() + friend class QFontMetrics; + friend class QFontInfo; + friend class QETWidget; + friend class QLayout; + friend class QWidgetItem; + friend class QWidgetItemV2; + friend class QGLContext; + friend class QGLWidget; + friend class QGLWindowSurface; + friend class QX11PaintEngine; + friend class QWin32PaintEngine; + friend class QShortcutPrivate; + friend class QShortcutMap; + friend class QWindowSurface; + friend class QGraphicsProxyWidget; + friend class QGraphicsProxyWidgetPrivate; + friend class QStyleSheetStyle; + friend struct QWidgetExceptionCleaner; + friend class QGestureManager; + friend class QWinNativePanGestureRecognizer; + friend class QWidgetEffectSourcePrivate; + +#ifdef Q_WS_MAC + friend class QCoreGraphicsPaintEnginePrivate; + friend QPoint qt_mac_posInWindow(const QWidget *w); + friend OSWindowRef qt_mac_window_for(const QWidget *w); + friend bool qt_mac_is_metal(const QWidget *w); + friend OSViewRef qt_mac_nativeview_for(const QWidget *w); + friend void qt_event_request_window_change(QWidget *widget); + friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref); +#endif +#ifdef Q_WS_QWS + friend class QWSBackingStore; + friend class QWSManager; + friend class QWSManagerPrivate; + friend class QDecoration; + friend class QWSWindowSurface; + friend class QScreen; + friend class QVNCScreen; + friend bool isWidgetOpaque(const QWidget *); + friend class QGLWidgetPrivate; +#endif +#ifdef Q_OS_SYMBIAN + friend class QSymbianControl; + friend class QS60WindowSurface; +#endif +#ifdef Q_WS_X11 + friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp); + friend void qt_net_remove_user_time(QWidget *tlw); +#endif + + friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); + friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); + +private: + Q_DISABLE_COPY(QWidget) + Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) +#ifdef Q_OS_SYMBIAN + Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId)) +#endif + + QWidgetData *data; + +#ifdef QT3_SUPPORT +public: + inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); } + QT3_SUPPORT QStyle *setStyle(const QString&); + inline QT3_SUPPORT bool isVisibleToTLW() const; + QT3_SUPPORT QRect visibleRect() const; + inline QT3_SUPPORT void iconify() { showMinimized(); } + inline QT3_SUPPORT void constPolish() const { ensurePolished(); } + inline QT3_SUPPORT void polish() { ensurePolished(); } + inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false) + { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false) + { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false) + { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); } + inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw) + { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);} + inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); } +#ifndef QT_NO_CURSOR + inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); } +#endif + inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); } + inline QT3_SUPPORT void unsetFont() { setFont(QFont()); } + inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); } + inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); } + Qt::BackgroundMode QT3_SUPPORT backgroundMode() const; + void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground); + const QT3_SUPPORT QColor &eraseColor() const; + void QT3_SUPPORT setEraseColor(const QColor &); + const QT3_SUPPORT QColor &foregroundColor() const; + const QT3_SUPPORT QPixmap *erasePixmap() const; + void QT3_SUPPORT setErasePixmap(const QPixmap &); + const QT3_SUPPORT QColor &paletteForegroundColor() const; + void QT3_SUPPORT setPaletteForegroundColor(const QColor &); + const QT3_SUPPORT QColor &paletteBackgroundColor() const; + void QT3_SUPPORT setPaletteBackgroundColor(const QColor &); + const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const; + void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &); + const QT3_SUPPORT QBrush& backgroundBrush() const; + const QT3_SUPPORT QColor &backgroundColor() const; + const QT3_SUPPORT QPixmap *backgroundPixmap() const; + void QT3_SUPPORT setBackgroundPixmap(const QPixmap &); + QT3_SUPPORT void setBackgroundColor(const QColor &); + QT3_SUPPORT QColorGroup colorGroup() const; + QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const; + inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); } + inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); } + inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); } + enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin }; + inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {} + inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; } + inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); } + inline QT3_SUPPORT void repaint(bool) { repaint(); } + inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); } + inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); } + inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); } + QT3_SUPPORT void erase(); + inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); } + QT3_SUPPORT void erase(const QRect &); + QT3_SUPPORT void erase(const QRegion &); + QT3_SUPPORT void drawText(const QPoint &p, const QString &s) + { drawText_helper(p.x(), p.y(), s); } + inline QT3_SUPPORT void drawText(int x, int y, const QString &s) + { drawText_helper(x, y, s); } + QT3_SUPPORT bool close(bool); + inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const + { + QWidget *w = childAt(x, y); + return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0); + } + inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const + { + QWidget *w = childAt(p); + return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0); + } + inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); } + QT3_SUPPORT void setIcon(const QPixmap &i); + inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); } + inline QT3_SUPPORT QString caption() const { return windowTitle(); } + QT3_SUPPORT const QPixmap *icon() const; + inline QT3_SUPPORT QString iconText() const { return windowIconText(); } + inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); } + inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); } + inline QT3_SUPPORT void setActiveWindow() { activateWindow(); } + inline QT3_SUPPORT bool isShown() const { return !isHidden(); } + inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; } + inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; } + inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; } + + +private: + void drawText_helper(int x, int y, const QString &); + void erase_helper(int x, int y, int w, int h); +#endif // QT3_SUPPORT + +protected: + virtual void styleChange(QStyle&); // compat + virtual void enabledChange(bool); // compat + virtual void paletteChange(const QPalette &); // compat + virtual void fontChange(const QFont &); // compat + virtual void windowActivationChange(bool); // compat + virtual void languageChange(); // compat +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags) + +#if defined Q_CC_MSVC && _MSC_VER < 1300 +template <> inline QWidget *qobject_cast_helper<QWidget*>(QObject *o, QWidget *) +{ + if (!o || !o->isWidgetType()) return 0; + return (QWidget*)(o); +} +#else +template <> inline QWidget *qobject_cast<QWidget*>(QObject *o) +{ + if (!o || !o->isWidgetType()) return 0; + return static_cast<QWidget*>(o); +} +template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o) +{ + if (!o || !o->isWidgetType()) return 0; + return static_cast<const QWidget*>(o); +} +#endif + +inline QWidget *QWidget::childAt(int ax, int ay) const +{ return childAt(QPoint(ax, ay)); } + +inline Qt::WindowType QWidget::windowType() const +{ return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); } +inline Qt::WindowFlags QWidget::windowFlags() const +{ return data->window_flags; } + +inline bool QWidget::isTopLevel() const +{ return (windowType() & Qt::Window); } + +inline bool QWidget::isWindow() const +{ return (windowType() & Qt::Window); } + +inline bool QWidget::isEnabled() const +{ return !testAttribute(Qt::WA_Disabled); } + +inline bool QWidget::isModal() const +{ return data->window_modality != Qt::NonModal; } + +inline bool QWidget::isEnabledToTLW() const +{ return isEnabled(); } + +inline int QWidget::minimumWidth() const +{ return minimumSize().width(); } + +inline int QWidget::minimumHeight() const +{ return minimumSize().height(); } + +inline int QWidget::maximumWidth() const +{ return maximumSize().width(); } + +inline int QWidget::maximumHeight() const +{ return maximumSize().height(); } + +inline void QWidget::setMinimumSize(const QSize &s) +{ setMinimumSize(s.width(),s.height()); } + +inline void QWidget::setMaximumSize(const QSize &s) +{ setMaximumSize(s.width(),s.height()); } + +inline void QWidget::setSizeIncrement(const QSize &s) +{ setSizeIncrement(s.width(),s.height()); } + +inline void QWidget::setBaseSize(const QSize &s) +{ setBaseSize(s.width(),s.height()); } + +inline const QFont &QWidget::font() const +{ return data->fnt; } + +inline QFontMetrics QWidget::fontMetrics() const +{ return QFontMetrics(data->fnt); } + +inline QFontInfo QWidget::fontInfo() const +{ return QFontInfo(data->fnt); } + +inline void QWidget::setMouseTracking(bool enable) +{ setAttribute(Qt::WA_MouseTracking, enable); } + +inline bool QWidget::hasMouseTracking() const +{ return testAttribute(Qt::WA_MouseTracking); } + +inline bool QWidget::underMouse() const +{ return testAttribute(Qt::WA_UnderMouse); } + +inline bool QWidget::updatesEnabled() const +{ return !testAttribute(Qt::WA_UpdatesDisabled); } + +inline void QWidget::update(int ax, int ay, int aw, int ah) +{ update(QRect(ax, ay, aw, ah)); } + +inline bool QWidget::isVisible() const +{ return testAttribute(Qt::WA_WState_Visible); } + +inline bool QWidget::isHidden() const +{ return testAttribute(Qt::WA_WState_Hidden); } + +inline void QWidget::move(int ax, int ay) +{ move(QPoint(ax, ay)); } + +inline void QWidget::resize(int w, int h) +{ resize(QSize(w, h)); } + +inline void QWidget::setGeometry(int ax, int ay, int aw, int ah) +{ setGeometry(QRect(ax, ay, aw, ah)); } + +inline QRect QWidget::rect() const +{ return QRect(0,0,data->crect.width(),data->crect.height()); } + +inline const QRect &QWidget::geometry() const +{ return data->crect; } + +inline QSize QWidget::size() const +{ return data->crect.size(); } + +inline int QWidget::width() const +{ return data->crect.width(); } + +inline int QWidget::height() const +{ return data->crect.height(); } + +inline QWidget *QWidget::parentWidget() const +{ return static_cast<QWidget *>(QObject::parent()); } + +inline void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver) +{ setSizePolicy(QSizePolicy(hor, ver)); } + +inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const +{ + if (attribute < int(8*sizeof(uint))) + return data->widget_attributes & (1<<attribute); + return testAttribute_helper(attribute); +} + +#ifdef QT3_SUPPORT +inline bool QWidget::isVisibleToTLW() const +{ return isVisible(); } +inline QWidget *QWidget::parentWidget(bool sameWindow) const +{ + if (sameWindow && isWindow()) + return 0; + return static_cast<QWidget *>(QObject::parent()); +} +inline QColorGroup QWidget::colorGroup() const +{ return QColorGroup(palette()); } +inline void QWidget::setPaletteForegroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); } +inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); } +inline void QWidget::setBackgroundPixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline const QPixmap *QWidget::backgroundPixmap() const { return 0; } +inline void QWidget::setBackgroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); } +inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());} +inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); } +inline void QWidget::setEraseColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QPixmap *QWidget::erasePixmap() const { return 0; } +inline void QWidget::setErasePixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());} +inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); } +inline void QWidget::setPaletteBackgroundColor(const QColor &c) +{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); } +inline const QPixmap *QWidget::paletteBackgroundPixmap() const +{ return 0; } +inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm) +{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); } +inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); } +inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); } +#endif + +#define QWIDGETSIZE_MAX ((1<<24)-1) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWIDGET_H diff --git a/qtinterface/tqwidget.cpp b/qtinterface/tqwidget.cpp index 2eacecc..69c48bc 100644 --- a/qtinterface/tqwidget.cpp +++ b/qtinterface/tqwidget.cpp @@ -21,3 +21,11 @@ Boston, MA 02110-1301, USA. #include <tqt.h> #include <tqwidget.h> + +#ifdef USE_QT4 + +Qt::WidgetAttribute QWidget::testWState( Qt::WidgetAttribute s ) const { + return (Qt::WidgetAttribute)(data->widget_attributes & s); +} + +#endif // USE_QT4
\ No newline at end of file diff --git a/qtinterface/tqwidget.h b/qtinterface/tqwidget.h index 8430cd2..c3b361b 100644 --- a/qtinterface/tqwidget.h +++ b/qtinterface/tqwidget.h @@ -38,7 +38,7 @@ Boston, MA 02110-1301, USA. // Reimplement the QWidget class // For Qt4, some changes are needed -#include <Qt/qwidget.h> +#include <tqt4/Qt/qwidget.h> #endif // USE_QT4 |