diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-30 23:26:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-30 23:26:07 +0000 |
commit | e5e5db14bf9a12b17fefe650fface82bb250aaec (patch) | |
tree | 04c3848e58635eaa773ef7d85a4ed24597be33dd /qtinterface/tqt4 | |
parent | f7c45454128a78405313e1ebb86ef5f597481ebe (diff) | |
download | tqtinterface-e5e5db14bf9a12b17fefe650fface82bb250aaec.tar.gz tqtinterface-e5e5db14bf9a12b17fefe650fface82bb250aaec.zip |
* More TQt/Qt4 features
* Various compilation fixes for Slackware
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/tqtinterface@1170159 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtinterface/tqt4')
-rw-r--r-- | qtinterface/tqt4/Qt/q3whatsthis.h | 90 | ||||
-rw-r--r-- | qtinterface/tqt4/Qt/qicon.h | 157 | ||||
-rw-r--r-- | qtinterface/tqt4/Qt/qlist.h | 6 | ||||
-rw-r--r-- | qtinterface/tqt4/Qt/qtabbar.h | 1 | ||||
-rw-r--r-- | qtinterface/tqt4/Qt/qtextcodec.h | 205 |
5 files changed, 456 insertions, 3 deletions
diff --git a/qtinterface/tqt4/Qt/q3whatsthis.h b/qtinterface/tqt4/Qt/q3whatsthis.h new file mode 100644 index 0000000..c6c6086 --- /dev/null +++ b/qtinterface/tqt4/Qt/q3whatsthis.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** 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 Q3WHATSTHIS_H +#define Q3WHATSTHIS_H + +#include <QtGui/qcursor.h> +#include <QtGui/qwhatsthis.h> +#include <QtGui/qwidget.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Qt3SupportLight) + +#ifndef QT_NO_WHATSTHIS + +class QToolButton; + +class Q_COMPAT_EXPORT Q3WhatsThis: public QObject +{ + Q_OBJECT +public: + Q3WhatsThis(QWidget *); + ~Q3WhatsThis(); + bool eventFilter(QObject *, QEvent *); + + static inline void enterWhatsThisMode() { QWhatsThis::enterWhatsThisMode(); } + static inline bool inWhatsThisMode() { return QWhatsThis::inWhatsThisMode(); } + + static inline void add(QWidget *w, const QString &s) { w->setWhatsThis(s); } + static inline void remove(QWidget *w) { w->setWhatsThis(QString()); } + static QToolButton * whatsThisButton(QWidget * parent); + static inline void leaveWhatsThisMode(const QString& text = QString(), const QPoint& pos = QCursor::pos(), QWidget* w = 0) + { QWhatsThis::showText(pos, text, w); } + static inline void display(const QString& text, const QPoint& pos = QCursor::pos(), QWidget* w = 0) + { QWhatsThis::showText(pos, text, w); } + + virtual QString text(const QPoint &); + virtual bool clicked(const QString& href); + + static QString textFor( QWidget *, const QPoint & pos = QPoint(), bool includeParents = FALSE ); +}; + +#endif // QT_NO_WHATSTHIS + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q3WHATSTHIS_H diff --git a/qtinterface/tqt4/Qt/qicon.h b/qtinterface/tqt4/Qt/qicon.h new file mode 100644 index 0000000..7485a9a --- /dev/null +++ b/qtinterface/tqt4/Qt/qicon.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** 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 QICON_H +#define QICON_H + +#include <QtCore/qglobal.h> +#include <QtCore/qsize.h> +#include <QtCore/qlist.h> +#include <QtGui/qpixmap.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QIconPrivate; +class QIconEngine; +class QIconEngineV2; +class TQIconFactory; + +class Q_GUI_EXPORT QIcon +{ +public: + enum Mode { Normal, Disabled, Active, Selected }; + enum State { On, Off }; + + QIcon(); + QIcon(const QPixmap &pixmap); + QIcon(const QIcon &other); + explicit QIcon(const QString &fileName); // file or resource name + explicit QIcon(QIconEngine *engine); + explicit QIcon(QIconEngineV2 *engine); + ~QIcon(); + QIcon &operator=(const QIcon &other); + operator QVariant() const; + + QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const; + inline QPixmap pixmap(int w, int h, Mode mode = Normal, State state = Off) const + { return pixmap(QSize(w, h), mode, state); } + inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const + { return pixmap(QSize(extent, extent), mode, state); } + + QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const; + + void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const; + inline void paint(QPainter *painter, int x, int y, int w, int h, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const + { paint(painter, QRect(x, y, w, h), alignment, mode, state); } + + bool isNull() const; + bool isDetached() const; + void detach(); + + int serialNumber() const; + qint64 cacheKey() const; + + void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off); + void addFile(const QString &fileName, const QSize &size = QSize(), Mode mode = Normal, State state = Off); + + QList<QSize> availableSizes(Mode mode = Normal, State state = Off) const; + + static QIcon fromTheme(const QString &name, const QIcon &fallback = QIcon()); + static bool hasThemeIcon(const QString &name); + + static QStringList themeSearchPaths(); + static void setThemeSearchPaths(const QStringList &searchpath); + + static QString themeName(); + static void setThemeName(const QString &path); + + +#ifdef QT3_SUPPORT + enum Size { Small, Large, Automatic = Small }; + static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size); + static QT3_SUPPORT QSize pixmapSize(Size which); + inline QT3_SUPPORT void reset(const QPixmap &pixmap, Size /*size*/) { *this = QIcon(pixmap); } + inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap, Size, Mode mode = Normal, State state = Off) + { addPixmap(pixmap, mode, state); } + inline QT3_SUPPORT void setPixmap(const QString &fileName, Size, Mode mode = Normal, State state = Off) + { addPixmap(QPixmap(fileName), mode, state); } + QT3_SUPPORT QPixmap pixmap(Size size, Mode mode, State state = Off) const; + QT3_SUPPORT QPixmap pixmap(Size size, bool enabled, State state = Off) const; + QT3_SUPPORT QPixmap pixmap() const; + + void installIconFactory( TQIconFactory *factory ); +#endif + + Q_DUMMY_COMPARISON_OPERATOR(QIcon) + +private: + QIconPrivate *d; +#if !defined(QT_NO_DATASTREAM) + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); +#endif + +public: + typedef QIconPrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QIcon) +Q_DECLARE_TYPEINFO(QIcon, Q_MOVABLE_TYPE); + +#if !defined(QT_NO_DATASTREAM) +Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); +Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); +#endif + +#ifdef QT3_SUPPORT +typedef QIcon QIconSet; +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QICON_H diff --git a/qtinterface/tqt4/Qt/qlist.h b/qtinterface/tqt4/Qt/qlist.h index 39e44d9..9a16b9e 100644 --- a/qtinterface/tqt4/Qt/qlist.h +++ b/qtinterface/tqt4/Qt/qlist.h @@ -163,8 +163,8 @@ public: inline uint containsRef( const T &t ) { return count(t); }; int count(const T &t) const; - inline T next() { current_index++; return *this[current_index]; } - inline T prev() { current_index--; return *this[current_index]; } + inline T next() { current_index++; return this[current_index]; } + inline T prev() { current_index--; return this[current_index]; } class const_iterator; @@ -448,7 +448,7 @@ inline void QList<T>::insert(iterator pos, int n, const T &x) { int q; for (q=0;q<n;q++) { - this.insert(pos, x); + this->insert(pos, x); } } diff --git a/qtinterface/tqt4/Qt/qtabbar.h b/qtinterface/tqt4/Qt/qtabbar.h index c05497f..216f8c9 100644 --- a/qtinterface/tqt4/Qt/qtabbar.h +++ b/qtinterface/tqt4/Qt/qtabbar.h @@ -140,6 +140,7 @@ public: QRect tabRect(int index) const; int tabAt(const QPoint &pos) const; int tabAt(const int &pos) const; +// QTab * tabAt( int ) const; int currentIndex() const; int count() const; diff --git a/qtinterface/tqt4/Qt/qtextcodec.h b/qtinterface/tqt4/Qt/qtextcodec.h new file mode 100644 index 0000000..100b50c --- /dev/null +++ b/qtinterface/tqt4/Qt/qtextcodec.h @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** 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 QTEXTCODEC_H +#define QTEXTCODEC_H + +#include <QtCore/qstring.h> +#include <QtCore/qlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +#ifndef QT_NO_TEXTCODEC + +class QTextCodec; +class QIODevice; + +class QTextDecoder; +class QTextEncoder; + +class Q_CORE_EXPORT QTextCodec +{ + Q_DISABLE_COPY(QTextCodec) +public: + static QTextCodec* codecForName(const QByteArray &name); + static QTextCodec* codecForName(const char *name) { return codecForName(QByteArray(name)); } + static QTextCodec* codecForMib(int mib); + + static QList<QByteArray> availableCodecs(); + static QList<int> availableMibs(); + + static QTextCodec* codecForLocale(); + static void setCodecForLocale(QTextCodec *c); + + static QTextCodec* codecForTr(); + static void setCodecForTr(QTextCodec *c); + + static QTextCodec* codecForCStrings(); + static void setCodecForCStrings(QTextCodec *c); + + static QTextCodec *codecForHtml(const QByteArray &ba); + static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec); + + static QTextCodec *codecForUtfText(const QByteArray &ba); + static QTextCodec *codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec); + + QTextDecoder* makeDecoder() const; + QTextEncoder* makeEncoder() const; + + bool canEncode(QChar) const; + bool canEncode(const QString&) const; + + QString toUnicode(const QByteArray&) const; + QString toUnicode(const char* chars) const; + QByteArray fromUnicode(const QString& uc) const; + enum ConversionFlag { + DefaultConversion, + ConvertInvalidToNull = 0x80000000, + IgnoreHeader = 0x1, + FreeFunction = 0x2 + }; + Q_DECLARE_FLAGS(ConversionFlags, ConversionFlag) + + struct Q_CORE_EXPORT ConverterState { + ConverterState(ConversionFlags f = DefaultConversion) + : flags(f), remainingChars(0), invalidChars(0), d(0) { state_data[0] = state_data[1] = state_data[2] = 0; } + ~ConverterState(); + ConversionFlags flags; + int remainingChars; + int invalidChars; + uint state_data[3]; + void *d; + private: + Q_DISABLE_COPY(ConverterState) + }; + + QString toUnicode(const char *in, int length, ConverterState *state = 0) const + { return convertToUnicode(in, length, state); } + QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = 0) const + { return convertFromUnicode(in, length, state); } + + virtual QByteArray name() const = 0; + virtual QList<QByteArray> aliases() const; + virtual int mibEnum() const = 0; + virtual int heuristicNameMatch(const char* hint) const; + +#ifndef QT_NO_CODECS + static QTextCodec* loadCharmap(QIODevice*); + static QTextCodec* loadCharmapFile(QString filename); +#endif //QT_NO_CODECS + +protected: + virtual QString convertToUnicode(const char *in, int length, ConverterState *state) const = 0; + virtual QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const = 0; + + static int simpleHeuristicNameMatch(const char* name, const char* hint); + + QTextCodec(); + virtual ~QTextCodec(); + +public: +#ifdef QT3_SUPPORT + static QT3_SUPPORT QTextCodec* codecForContent(const char*, int) { return 0; } + static QT3_SUPPORT const char* locale(); + static QT3_SUPPORT QTextCodec* codecForName(const char* hint, int) { return codecForName(QByteArray(hint)); } + QT3_SUPPORT QByteArray fromUnicode(const QString& uc, int& lenInOut) const; + QT3_SUPPORT QString toUnicode(const QByteArray&, int len) const; + QT3_SUPPORT QByteArray mimeName() const { return name(); } + static QT3_SUPPORT QTextCodec *codecForIndex(int i) { return codecForName(availableCodecs().value(i)); } +#endif + +private: + friend class QTextCodecCleanup; + static QTextCodec *cftr; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags) + +inline QTextCodec* QTextCodec::codecForTr() { return cftr; } +inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } +inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; } +inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; } + +class Q_CORE_EXPORT QTextEncoder { + Q_DISABLE_COPY(QTextEncoder) +public: + explicit QTextEncoder(const QTextCodec *codec) : c(codec), state() {} + ~QTextEncoder(); + QByteArray fromUnicode(const QString& str); + QByteArray fromUnicode(const QChar *uc, int len); +#ifdef QT3_SUPPORT + QT3_SUPPORT QByteArray fromUnicode(const QString& uc, int& lenInOut); +#endif + bool hasFailure() const; +private: + const QTextCodec *c; + QTextCodec::ConverterState state; + + friend class QXmlStreamWriter; + friend class QXmlStreamWriterPrivate; + friend class QCoreXmlStreamWriter; + friend class QCoreXmlStreamWriterPrivate; +}; + +class Q_CORE_EXPORT QTextDecoder { + Q_DISABLE_COPY(QTextDecoder) +public: + explicit QTextDecoder(const QTextCodec *codec) : c(codec), state() {} + ~QTextDecoder(); + QString toUnicode(const char* chars, int len); + QString toUnicode(const QByteArray &ba); + void toUnicode(QString *target, const char *chars, int len); + bool hasFailure() const; +private: + const QTextCodec *c; + QTextCodec::ConverterState state; +}; + +#endif // QT_NO_TEXTCODEC + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTEXTCODEC_H |