diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
commit | a374efce3a207b39514be3c52264091400ce297e (patch) | |
tree | 77bdf654b55826d4f59b53a5621310206bcaead1 /libkdeedu/extdate/extdatetimeedit.h | |
parent | f81a494f3957d5cf38c787973415597941934727 (diff) | |
download | tdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip |
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdeedu/extdate/extdatetimeedit.h')
-rw-r--r-- | libkdeedu/extdate/extdatetimeedit.h | 140 |
1 files changed, 87 insertions, 53 deletions
diff --git a/libkdeedu/extdate/extdatetimeedit.h b/libkdeedu/extdate/extdatetimeedit.h index 4bcf78c8..3aad17d9 100644 --- a/libkdeedu/extdate/extdatetimeedit.h +++ b/libkdeedu/extdate/extdatetimeedit.h @@ -5,7 +5,7 @@ ** ** Created : 001103 ** -** Original QDateTimeEdit Copyright (C) 2000 Trolltech AS. All rights reserved. +** Original TQDateTimeEdit Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** >> modifications to introduce ExtDate (C) 2004 Jason Harris <jharris@30doradus.org> ** >> ExtDate modifications are licensed under the GPL: http://www.gnu.org/licenses/gpl.html @@ -25,23 +25,24 @@ #ifndef EXTDATETIMEEDIT_H #define EXTDATETIMEEDIT_H -#ifndef QT_H +#ifndef TQT_H #include <tqwidget.h> #include <tqstring.h> -#endif // QT_H +#endif // TQT_H #include "extdatetime.h" -#ifndef QT_NO_DATETIMEEDIT +#ifndef TQT_NO_DATETIMEEDIT -class QTimeEdit; +class TQTimeEdit; -class ExtDateTimeEditBase : public QWidget +class ExtDateTimeEditBase : public TQWidget { Q_OBJECT + TQ_OBJECT public: - ExtDateTimeEditBase( TQWidget* parent=0, const char* name=0 ) - : TQWidget( parent, name ) {} + ExtDateTimeEditBase( TQWidget* tqparent=0, const char* name=0 ) + : TQWidget( tqparent, name ) {} virtual bool setFocusSection( int sec ) = 0; virtual TQString sectionFormattedText( int sec ) = 0; @@ -53,7 +54,7 @@ public slots: virtual void stepDown() = 0; private: -#if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator= ExtDateTimeEditBase( const ExtDateTimeEditBase & ); ExtDateTimeEditBase &operator=( const ExtDateTimeEditBase & ); #endif @@ -64,16 +65,17 @@ class ExtDateEditPrivate; class KDE_EXPORT ExtDateEdit : public ExtDateTimeEditBase { Q_OBJECT + TQ_OBJECT Q_ENUMS( Order ) - Q_PROPERTY( Order order READ order WRITE setOrder ) -// Q_PROPERTY( ExtDate date READ date WRITE setDate ) - Q_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance ) -// Q_PROPERTY( ExtDate maxValue READ maxValue WRITE setMaxValue ) -// Q_PROPERTY( ExtDate minValue READ minValue WRITE setMinValue ) + TQ_PROPERTY( Order order READ order WRITE setOrder ) +// TQ_PROPERTY( ExtDate date READ date WRITE setDate ) + TQ_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance ) +// TQ_PROPERTY( ExtDate maxValue READ maxValue WRITE setMaxValue ) +// TQ_PROPERTY( ExtDate minValue READ minValue WRITE setMinValue ) public: - ExtDateEdit( TQWidget* parent=0, const char* name=0 ); - ExtDateEdit( const ExtDate& date, TQWidget* parent=0, const char* name=0 ); + ExtDateEdit( TQWidget* tqparent=0, const char* name=0 ); + ExtDateEdit( const ExtDate& date, TQWidget* tqparent=0, const char* name=0 ); ~ExtDateEdit(); enum Order { DMY /**< Day-Month-Year */, @@ -81,8 +83,8 @@ public: YMD /**< Year-Month-Day, also the default */, YDM /**< Year-Day-Month @deprecated Included for completeness. */ }; - TQSize sizeHint() const; - TQSize minimumSizeHint() const; + TQSize tqsizeHint() const; + TQSize tqminimumSizeHint() const; public slots: virtual void setDate( const ExtDate& date ); @@ -136,23 +138,24 @@ private: TQString sectionText( int sec ) const; ExtDateEditPrivate* d; -#if defined(Q_DISABLE_COPY) +#if defined(TQ_DISABLE_COPY) ExtDateEdit( const ExtDateEdit & ); ExtDateEdit &operator=( const ExtDateEdit & ); #endif }; -// class QTimeEditPrivate; +// class TQTimeEditPrivate; // -// class Q_EXPORT QTimeEdit : public ExtDateTimeEditBase +// class TQ_EXPORT TQTimeEdit : public ExtDateTimeEditBase // { // Q_OBJECT -// Q_SETS( Display ) -// Q_PROPERTY( TQTime time READ time WRITE setTime ) -// Q_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance ) -// Q_PROPERTY( TQTime maxValue READ maxValue WRITE setMaxValue ) -// Q_PROPERTY( TQTime minValue READ minValue WRITE setMinValue ) -// Q_PROPERTY( Display display READ display WRITE setDisplay ) +// TQ_OBJECT +// TQ_SETS( Display ) +// TQ_PROPERTY( TQTime time READ time WRITE setTime ) +// TQ_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance ) +// TQ_PROPERTY( TQTime maxValue READ maxValue WRITE setMaxValue ) +// TQ_PROPERTY( TQTime minValue READ minValue WRITE setMinValue ) +// TQ_PROPERTY( Display display READ display WRITE setDisplay ) // // public: // enum Display { @@ -163,12 +166,12 @@ private: // AMPM = 0x10 // }; // -// QTimeEdit( TQWidget* parent=0, const char* name=0 ); -// QTimeEdit( const TQTime& time, TQWidget* parent=0, const char* name=0 ); -// ~QTimeEdit(); +// TQTimeEdit( TQWidget* tqparent=0, const char* name=0 ); +// TQTimeEdit( const TQTime& time, TQWidget* tqparent=0, const char* name=0 ); +// ~TQTimeEdit(); // -// TQSize sizeHint() const; -// TQSize minimumSizeHint() const; +// TQSize tqsizeHint() const; +// TQSize tqminimumSizeHint() const; // // public slots: // virtual void setTime( const TQTime& time ); @@ -217,30 +220,31 @@ private: // private: // void init(); // TQString sectionText( int sec ); -// QTimeEditPrivate* d; +// TQTimeEditPrivate* d; // -// #if defined(Q_DISABLE_COPY) -// QTimeEdit( const QTimeEdit & ); -// QTimeEdit &operator=( const QTimeEdit & ); +// #if defined(TQ_DISABLE_COPY) +// TQTimeEdit( const TQTimeEdit & ); +// TQTimeEdit &operator=( const TQTimeEdit & ); // #endif // }; // class ExtDateTimeEditPrivate; -class KDE_EXPORT ExtDateTimeEdit : public QWidget +class KDE_EXPORT ExtDateTimeEdit : public TQWidget { Q_OBJECT -// Q_PROPERTY( ExtDateTime dateTime READ dateTime WRITE setDateTime ) + TQ_OBJECT +// TQ_PROPERTY( ExtDateTime dateTime READ dateTime WRITE setDateTime ) public: - ExtDateTimeEdit( TQWidget* parent=0, const char* name=0 ); - ExtDateTimeEdit( const ExtDateTime& datetime, TQWidget* parent=0, + ExtDateTimeEdit( TQWidget* tqparent=0, const char* name=0 ); + ExtDateTimeEdit( const ExtDateTime& datetime, TQWidget* tqparent=0, const char* name=0 ); ~ExtDateTimeEdit(); - TQSize sizeHint() const; - TQSize minimumSizeHint() const; + TQSize tqsizeHint() const; + TQSize tqminimumSizeHint() const; public slots: virtual void setDateTime( const ExtDateTime & dt ); @@ -249,7 +253,7 @@ public: ExtDateTime dateTime() const; ExtDateEdit* dateEdit() { return de; } - QTimeEdit* timeEdit() { return te; } + TQTimeEdit* timeEdit() { return te; } virtual void setAutoAdvance( bool advance ); bool autoAdvance() const; @@ -258,31 +262,31 @@ signals: void valueChanged( const ExtDateTime& datetime ); protected: - // ### make init() private in Qt 4.0 + // ### make init() private in TQt 4.0 void init(); void resizeEvent( TQResizeEvent * ); protected slots: - // ### make these two functions private in Qt 4.0, + // ### make these two functions private in TQt 4.0, // and merge them into one with no parameter void newValue( const ExtDate& d ); void newValue( const TQTime& t ); private: ExtDateEdit* de; - QTimeEdit* te; + TQTimeEdit* te; ExtDateTimeEditPrivate* d; -#if defined(Q_DISABLE_COPY) +#if defined(TQ_DISABLE_COPY) ExtDateTimeEdit( const ExtDateTimeEdit & ); ExtDateTimeEdit &operator=( const ExtDateTimeEdit & ); #endif }; -class QNumberSection +class TQNumberSection { public: - QNumberSection( int selStart = 0, int selEnd = 0, bool separat = TRUE, int actual = -1 ) + TQNumberSection( int selStart = 0, int selEnd = 0, bool separat = TRUE, int actual = -1 ) : selstart( selStart ), selend( selEnd ), act( actual ), sep( separat ) {} int selectionStart() const { return selstart; } @@ -292,7 +296,7 @@ public: int width() const { return selend - selstart; } int index() const { return act; } bool separator() const { return sep; } - Q_DUMMY_COMPARISON_OPERATOR( QNumberSection ) + TQ_DUMMY_COMPARISON_OPERATOR( TQNumberSection ) private: int selstart :12; int selend :12; @@ -302,11 +306,12 @@ private: class ExtDateTimeEditorPrivate; -class ExtDateTimeEditor : public QWidget +class ExtDateTimeEditor : public TQWidget { Q_OBJECT + TQ_OBJECT public: - ExtDateTimeEditor( ExtDateTimeEditBase * parent=0, + ExtDateTimeEditor( ExtDateTimeEditBase * tqparent=0, const char * name=0 ); ~ExtDateTimeEditor(); @@ -318,7 +323,7 @@ public: int focusSection() const; bool setFocusSection( int s ); - void appendSection( const QNumberSection& sec ); + void appendSection( const TQNumberSection& sec ); void clearSections(); void setSectionSelection( int sec, int selstart, int selend ); bool eventFilter( TQObject *o, TQEvent *e ); @@ -337,5 +342,34 @@ private: ExtDateTimeEditorPrivate* d; }; +class ExtDateTimeSpinWidget : public TQSpinWidget +{ + Q_OBJECT + TQ_OBJECT +public: + ExtDateTimeSpinWidget( TQWidget *tqparent, const char *name ) + : TQSpinWidget( tqparent, name ) + { + } + +protected: +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent *e ) + { + ExtDateTimeEditor *editor = (ExtDateTimeEditor*)editWidget()->qt_cast( "ExtDateTimeEditor" ); + Q_ASSERT( editor ); + if ( !editor ) + return; + + int section = editor->sectionAt( e->pos() ); + editor->setFocusSection( section ); + + if ( section == -1 ) + return; + TQSpinWidget::wheelEvent( e ); + } +#endif +}; + #endif #endif |