diff options
149 files changed, 1540 insertions, 737 deletions
@@ -2717,7 +2717,6 @@ if [ "$PLATFORM_MAC" = "yes" ]; then # Build commmand line arguments we can pass to the compiler during configure tests # by prefixing each arch with "-arch". CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}" - CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/i386_64/x86_64}" for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH" done diff --git a/doc/src/datastreamformat.qdoc b/doc/src/datastreamformat.qdoc index 3c651fb..15ac062 100644 --- a/doc/src/datastreamformat.qdoc +++ b/doc/src/datastreamformat.qdoc @@ -69,6 +69,10 @@ the application happens to be running on. \table + \row \o bool + \o \list + \o boolean + \endlist \row \o qint8 \o \list \o signed byte @@ -297,6 +301,10 @@ \o \list \o Milliseconds since midnight (quint32) \endlist + \row \o QUrl + \o \list + \o Holds an URL (QString) + \endlist \row \o QVariant \o \list \o The type of the data (quint32) diff --git a/doc/src/properties.qdoc b/doc/src/properties.qdoc index 0775b12..d934f13 100644 --- a/doc/src/properties.qdoc +++ b/doc/src/properties.qdoc @@ -89,7 +89,12 @@ and QWidget::setCursor(), and it also has a \c RESET function, QWidget::unsetCursor(), since no call to QWidget::setCursor() can mean \e {reset to the context specific cursor}. The \c RESET - function musrt return void and take no parameters. + function must return void and take no parameters. + + \o A \c NOTIFY signal is optional. If defined, the signal will be + emitted whenever the value of the property changes. The signal must + take one parameter, which must be of the same type as the property; the + parameter will take the new value of the property. \o The \c DESIGNABLE attribute indicates whether the property should be visible in the property editor of GUI design tool (e.g., diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index b2a7a34..ff56dad 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -1015,6 +1015,7 @@ \o \l{qmake Variable Reference#QT}{QT} \o \l{qmake Variable Reference#RCC_DIR}{RCC_DIR} \o \l{qmake Variable Reference#REQUIRES}{REQUIRES} + \o \l{qmake Variable Reference#RESOURCES}{RESOURCES} \o \l{qmake Variable Reference#SOURCES}{SOURCES} \o \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} \o \l{qmake Variable Reference#TARGET}{TARGET} @@ -2630,6 +2631,12 @@ This is mainly used in Qt's build system for building the examples. + \section1 RESOURCES + + This variable contains the name of the resource collection file (qrc) + for the application. Further information about the resource collection + file can be found at \l{The Qt Resource System}. + \section1 RES_FILE This variable contains the name of the resource file for the application. diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc index ba7f79b..377cc9c 100644 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ b/doc/src/snippets/code/doc_src_properties.qdoc @@ -3,6 +3,7 @@ Q_PROPERTY(type name READ getFunction [WRITE setFunction] [RESET resetFunction] + [NOTIFY notifySignal] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro index 92b4224..d5ad4b8 100644 --- a/examples/opengl/hellogl_es2/hellogl_es2.pro +++ b/examples/opengl/hellogl_es2/hellogl_es2.pro @@ -25,3 +25,9 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 INSTALLS += target sources + + +wince*: { + QMAKE_LIBS += "libGLESv2.lib" + +}
\ No newline at end of file diff --git a/examples/phonon/README b/examples/phonon/README index d0f4462..51213cb 100644 --- a/examples/phonon/README +++ b/examples/phonon/README @@ -1,4 +1,4 @@ -Qt usese the Phonon cross-platform multimedia framework to play common +Qt uses the Phonon cross-platform multimedia framework to play common multimedia formats. Applications can be written to take advantage of the native multimedia diff --git a/mkspecs/common/mac-g++.conf b/mkspecs/common/mac-g++.conf index b764b26..eaae1aa 100644 --- a/mkspecs/common/mac-g++.conf +++ b/mkspecs/common/mac-g++.conf @@ -46,10 +46,10 @@ QMAKE_CXXFLAGS_DWARF2 += $$QMAKE_CFLAGS_DWARF2 QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LINK_C = $$QMAKE_CC +QMAKE_LINK_C_SHLIB = $$QMAKE_CC QMAKE_LFLAGS += -headerpad_max_install_names QMAKE_LFLAGS_RELEASE += QMAKE_LFLAGS_DEBUG += diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index 64ef801..4355073 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -12,9 +12,9 @@ CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/mac-g++.conf) - QMAKE_CC = gcc QMAKE_CXX = g++ +include(../common/mac-g++.conf) + load(qt_config) diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf index e6a3120..06bbdcb 100644 --- a/mkspecs/macx-g++42/qmake.conf +++ b/mkspecs/macx-g++42/qmake.conf @@ -12,10 +12,9 @@ CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/mac-g++.conf) - - QMAKE_CC = gcc-4.2 QMAKE_CXX = g++-4.2 +include(../common/mac-g++.conf) + load(qt_config) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 9990696..b203899 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -514,7 +514,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_4_2 Version 8 (Qt 4.2) \value Qt_4_3 Version 9 (Qt 4.3) \value Qt_4_4 Version 10 (Qt 4.4) - \value Qt_4_5 Version 10 (Qt 4.5) + \value Qt_4_5 Version 11 (Qt 4.5) \omitvalue Qt_4_6 \sa setVersion(), version() diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 0d82c2a..901641c 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -50,6 +50,7 @@ #include "qstring.h" #include "qregexp.h" #include "qvector.h" +#include "qalgorithms.h" #ifdef QT_BUILD_CORE_LIB # include "qresource.h" #endif @@ -190,32 +191,28 @@ QDirPrivate::~QDirPrivate() /* For sorting */ struct QDirSortItem { - QString filename_cache; - QString suffix_cache; + mutable QString filename_cache; + mutable QString suffix_cache; QFileInfo item; }; -static int qt_cmp_si_sort_flags; -#if defined(Q_C_CALLBACKS) -extern "C" { -#endif -#ifdef Q_OS_WINCE -static int __cdecl qt_cmp_si(const void *n1, const void *n2) -#else -static int qt_cmp_si(const void *n1, const void *n2) -#endif -{ - if (!n1 || !n2) - return 0; +class QDirSortItemComparator { + int qt_cmp_si_sort_flags; +public: + QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {} + bool operator()(const QDirSortItem &, const QDirSortItem &); +}; - QDirSortItem* f1 = (QDirSortItem*)n1; - QDirSortItem* f2 = (QDirSortItem*)n2; +bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortItem &n2) +{ + const QDirSortItem* f1 = &n1; + const QDirSortItem* f2 = &n2; if ((qt_cmp_si_sort_flags & QDir::DirsFirst) && (f1->item.isDir() != f2->item.isDir())) - return f1->item.isDir() ? -1 : 1; + return f1->item.isDir(); if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir())) - return f1->item.isDir() ? 1 : -1; + return !f1->item.isDir(); int r = 0; int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask) @@ -264,18 +261,11 @@ static int qt_cmp_si(const void *n1, const void *n2) : f1->filename_cache.compare(f2->filename_cache); } - if (r == 0) // Enforce an order - the order the items appear in the array - r = (char*)n1 - (char*)n2; - if (qt_cmp_si_sort_flags & QDir::Reversed) - return -r; - return r; + return r > 0; + return r < 0; } -#if defined(Q_C_CALLBACKS) -} -#endif - inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l, QStringList *names, QFileInfoList *infos) const { @@ -292,9 +282,8 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l, path += QLatin1Char('/'); si[i].item = QFileInfo(path + l.at(i)); } - qt_cmp_si_sort_flags = sort; if ((sort & QDir::SortByMask) != QDir::Unsorted) - qsort(si, i, sizeof(si[0]), qt_cmp_si); + qStableSort(si, si+i, QDirSortItemComparator(sort)); // put them back in the list(s) for (int j = 0; j<i; j++) { if(infos) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3aea508..e120f28 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -294,6 +294,8 @@ public: QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { } ~QTemporaryFileEngine(); + void setFileName(const QString &file); + bool open(QIODevice::OpenMode flags); bool remove(); bool close(); @@ -304,6 +306,13 @@ QTemporaryFileEngine::~QTemporaryFileEngine() QFSFileEngine::close(); } +void QTemporaryFileEngine::setFileName(const QString &file) +{ + // Really close the file, so we don't leak + QFSFileEngine::close(); + QFSFileEngine::setFileName(file); +} + bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) { Q_D(QFSFileEngine); diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index ed9d0aa..1167671 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -67,8 +67,10 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384; \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 1 Note that you cannot use QTextStream::atEnd(), which returns true when you - have reached the end of the data stream, with stdin. - + have reached the end of the data stream, with stdin. The reason for this is + that as long as stdin doesn't give any input to the QTextStream, \c atEnd() + will return true even if the stdin is open and waiting for more characters. + Besides using QTextStream's constructors, you can also set the device or string QTextStream operates on by calling setDevice() or setString(). You can seek to a position by calling seek(), and diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 1493dce..69c4f2f 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -113,7 +113,7 @@ public: int capacity() const; inline void reserve(int size); - inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;} + inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;} inline const QChar *unicode() const; inline QChar *data(); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 3fd52ee..1f047b8 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -315,7 +315,7 @@ void QVector<T>::detach_helper() { realloc(d->size, d->alloc); } template <typename T> void QVector<T>::reserve(int asize) -{ if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; } +{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; } template <typename T> void QVector<T>::resize(int asize) { realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ? diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index 9753bbe..955f4a0 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -432,9 +432,14 @@ inline void QDBusPendingCallWatcherPrivate::_q_finished() QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent) : QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call) { - if (d) { - if (!d->watcherHelper) + if (d) { // QDBusPendingCall::d + if (!d->watcherHelper) { d->watcherHelper = new QDBusPendingCallWatcherHelper; + if (isFinished()) { + // cause a signal emission anyways + QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection); + } + } d->watcherHelper->add(this); } } @@ -464,6 +469,7 @@ void QDBusPendingCallWatcher::waitForFinished() d->waitForFinished(); // our signals were queued, so deliver them + QCoreApplication::sendPostedEvents(d->watcherHelper, QEvent::MetaCall); QCoreApplication::sendPostedEvents(this, QEvent::MetaCall); } } diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 0dc16c9..5ed8852 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -400,7 +400,7 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect. - In Qt 4.4, it was possible to use the satic functions to show a sheet on + In Qt 4.4, it was possible to use the static functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open(). diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index b911ee0..789b364 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -2145,7 +2145,6 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_COMPLETER completer = new QFSCompletor(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); - completer->sourceModel = model; QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_autoCompleteFileName(QString))); #endif // QT_NO_COMPLETER diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 875cf4d..de7e332 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -97,7 +97,7 @@ class Ui_QFileDialog; */ class QFSCompletor : public QCompleter { public: - QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0) + QFSCompletor(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model) { #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3e8d38f..30c15bc 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1225,8 +1225,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) return; // Flags that alter the geometry of the item (or its children). - int geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); - bool fullUpdate = (flags & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); + const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); + bool fullUpdate = (quint32(flags) & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); if (fullUpdate) d_ptr->fullUpdateHelper(false, true); @@ -1921,7 +1921,7 @@ void QGraphicsItem::setOpacity(qreal opacity) itemChange(ItemOpacityHasChanged, newOpacity); // Update. - d_ptr->fullUpdateHelper(); + d_ptr->fullUpdateHelper(/*childrenOnly=*/false, /*maybeDirtyClipPath=*/false, /*ignoreOpacity=*/true); } /*! @@ -3235,10 +3235,16 @@ bool QGraphicsItem::contains(const QPointF &point) const } /*! - Returns true if this item collides with \a other; otherwise returns false. - The ways items collide is determined by \a mode. The default value for \a - mode is Qt::IntersectsItemShape; \a other collides with this item if it - either intersects, contains, or is contained by this item's shape. + + Returns true if this item collides with \a other; otherwise + returns false. + + The \a mode is applied to \a other, and the resulting shape or + bounding rectangle is then compared to this item's shape. The + default value for \a mode is Qt::IntersectsItemShape; \a other + collides with this item if it either intersects, contains, or is + contained by this item's shape (see Qt::ItemSelectionMode for + details). The default implementation is based on shape intersection, and it calls shape() on both items. Because the complexity of arbitrary shape-shape @@ -3293,6 +3299,11 @@ bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelecti Qt::IntersectsItemShape; \a path collides with this item if it either intersects, contains, or is contained by this item's shape. + Note that this function checks whether the item's shape or + bounding rectangle (depending on \a mode) is contained within \a + path, and not whether \a path is contained within the items shape + or bounding rectangle. + \sa collidesWithItem(), contains(), shape() */ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode) const @@ -3333,11 +3344,12 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection /*! Returns a list of all items that collide with this item. - The way collisions are detected is determined by \a mode. The default - value for \a mode is Qt::IntersectsItemShape; All items whose shape - intersects or is contained by this item's shape are returned. + The way collisions are detected is determined by applying \a mode + to items that are compared to this item, i.e., each item's shape + or bounding rectangle is checked against this item's shape. The + default value for \a mode is Qt::IntersectsItemShape. - \sa QGraphicsScene::collidingItems(), collidesWithItem() + \sa collidesWithItem() */ QList<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode) const { @@ -3621,9 +3633,8 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) \internal Returns true if we can discard an update request; otherwise false. */ -bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, - bool ignoreVisibleBit, - bool ignoreDirtyBit) const +bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit, + bool ignoreDirtyBit, bool ignoreOpacity) const { // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. @@ -3632,7 +3643,7 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, || !scene || (scene->d_func()->updateAll && scene->d_func()->hasSceneRect) || (!ignoreClipping && (childrenClippedToShape() && isClippedAway())) - || (childrenCombineOpacity() && isFullyTransparent()); + || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent()); } /*! @@ -3662,11 +3673,10 @@ void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force, bool may Propagates updates to \a item and all its children. */ -void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath) +void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath, bool ignoreOpacity) { - if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, - /*ignoreVisibleBit=*/false, - /*ignoreDirtyBit=*/true)) { + if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, /*ignoreVisibleBit=*/false, + /*ignoreDirtyBit=*/true, ignoreOpacity)) { return; } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a5871a7..9ce1bbf 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -165,11 +165,10 @@ public: void setPosHelper(const QPointF &pos); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); - bool discardUpdateRequest(bool ignoreClipping = false, - bool ignoreVisibleBit = false, - bool ignoreDirtyBit = false) const; + bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false, + bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool maybeDirtyClipPath = false); - void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false); + void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false, bool ignoreOpacity = false); void updateEffectiveOpacity(); void resolveEffectiveOpacity(qreal effectiveParentOpacity); void resolveDepth(int parentDepth); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index b5a1bdf..05e4907 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1071,8 +1071,12 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg QList<QGraphicsItem *> itemList(scene->items()); int i = 0; while (i < itemList.size()) { + const QGraphicsItem *item = itemList.at(i); // But we only want to include items that are visible - if (!itemList.at(i)->isVisible()) + // The following check is basically the same as item->d_ptr->isInvisible(), except + // that we don't check whether the item clips children to shape or propagates its + // opacity (we loop through all items, so those checks are wrong in this context). + if (!item->isVisible() || item->d_ptr->isClippedAway() || item->d_ptr->isFullyTransparent()) itemList.removeAt(i); else ++i; diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5de39d9..7f36be9 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1337,6 +1337,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device) \row \o TIFF \o Tagged Image File Format \row \o XBM \o X11 Bitmap \row \o XPM \o X11 Pixmap + \row \o SVG \o Scalable Vector Graphics \endtable Reading and writing SVG files is supported through Qt's diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index c8fedfc..56a65be 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5081,6 +5081,137 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy) return true; } +/*! \fn QDecoration &QApplication::qwsDecoration() + Return the QWSDecoration used for decorating windows. + + \warning This method is non-portable. It is only available in + Qt for Embedded Linux. + + \sa QDecoration +*/ + +/*! + \fn void QApplication::qwsSetDecoration(QDecoration *decoration) + + Sets the QDecoration derived class to use for decorating the + windows used by Qt for Embedded Linux to the \a decoration + specified. + + This method is non-portable. It is only available in Qt for Embedded Linux. + + \sa QDecoration +*/ + +/*! \fn QDecoration* QApplication::qwsSetDecoration(const QString &decoration) + \overload + + Requests a QDecoration object for \a decoration from the QDecorationFactory. + + The string must be one of the QDecorationFactory::keys(). Keys are + case insensitive. + + A later call to the QApplication constructor will override the + requested style when a "-style" option is passed in as a commandline + parameter. + + Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object + returned is set as the application's GUI style. +*/ + +/*! + \fn bool QApplication::qwsEventFilter(QWSEvent *event) + + This virtual function is only implemented under Qt for Embedded Linux. + + If you create an application that inherits QApplication and + reimplement this function, you get direct access to all QWS (Q + Window System) events that the are received from the QWS master + process. The events are passed in the \a event parameter. + + Return true if you want to stop the event from being processed. + Return false for normal event dispatching. The default + implementation returns false. +*/ + +/*! \fn void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors) + Set Qt for Embedded Linux custom color table. + + Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube. + The remaining 40 colors may be used by setting a custom color + table in the QWS master process before any clients connect. + + \a colorTable is an array of up to 40 custom colors. \a start is + the starting index (0-39) and \a numColors is the number of colors + to be set (1-40). + + This method is non-portable. It is available \e only in + Qt for Embedded Linux. + + \note The custom colors will not be used by the default screen + driver. To make use of the new colors, implement a custom screen + driver, or use QDirectPainter. +*/ + +/*! \fn int QApplication::qwsProcessEvent(QWSEvent* event) + \internal +*/ + +/*! \fn int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) + \internal +*/ + +/*! \fn int QApplication::x11ProcessEvent(XEvent* event) + This function does the core processing of individual X + \a{event}s, normally by dispatching Qt events to the right + destination. + + It returns 1 if the event was consumed by special handling, 0 if + the \a event was consumed by normal handling, and -1 if the \a + event was for an unrecognized widget. + + \sa x11EventFilter() +*/ + +/*! + \fn bool QApplication::x11EventFilter(XEvent *event) + + \warning This virtual function is only implemented under X11. + + If you create an application that inherits QApplication and + reimplement this function, you get direct access to all X events + that the are received from the X server. The events are passed in + the \a event parameter. + + Return true if you want to stop the event from being processed. + Return false for normal event dispatching. The default + implementation returns false. + + It is only the directly addressed messages that are filtered. + You must install an event filter directly on the event + dispatcher, which is returned by + QAbstractEventDispatcher::instance(), to handle system wide + messages. + + \sa x11ProcessEvent() +*/ + +/*! \fn void QApplication::winFocus(QWidget *widget, bool gotFocus) + \internal + \since 4.1 + + If \a gotFocus is true, \a widget will become the active window. + Otherwise the active window is reset to 0. +*/ + +/*! \fn void QApplication::winMouseButtonUp() + \internal + */ + +/*! \fn void QApplication::syncX() + Synchronizes with the X server in the X11 implementation. + This normally takes some time. Does nothing on other platforms. +*/ + QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 2deda8e..018440f 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -2675,9 +2675,6 @@ void QApplication::alert(QWidget *, int) { } -/*! - \internal -*/ int QApplication::qwsProcessEvent(QWSEvent* event) { Q_D(QApplication); @@ -3056,43 +3053,11 @@ int QApplication::qwsProcessEvent(QWSEvent* event) return 0; } -/*! - \fn bool QApplication::qwsEventFilter(QWSEvent *event) - - This virtual function is only implemented under Qt for Embedded Linux. - - If you create an application that inherits QApplication and - reimplement this function, you get direct access to all QWS (Q - Window System) events that the are received from the QWS master - process. The events are passed in the \a event parameter. - - Return true if you want to stop the event from being processed. - Return false for normal event dispatching. The default - implementation returns false. -*/ bool QApplication::qwsEventFilter(QWSEvent *) { return false; } -/*! - Set Qt for Embedded Linux custom color table. - - Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube. - The remaining 40 colors may be used by setting a custom color - table in the QWS master process before any clients connect. - - \a colorTable is an array of up to 40 custom colors. \a start is - the starting index (0-39) and \a numColors is the number of colors - to be set (1-40). - - This method is non-portable. It is available \e only in - Qt for Embedded Linux. - - \note The custom colors will not be used by the default screen - driver. To make use of the new colors, implement a custom screen - driver, or use QDirectPainter. -*/ void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors) { if (start < 0 || start > 39) { @@ -3111,30 +3076,11 @@ void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors } #ifndef QT_NO_QWS_MANAGER -/*! - Return the QWSDecoration used for decorating windows. - - \warning This method is non-portable. It is only available in - Qt for Embedded Linux. - - \sa QDecoration -*/ QDecoration &QApplication::qwsDecoration() { return *qws_decoration; } -/*! - \fn void QApplication::qwsSetDecoration(QDecoration *decoration) - - Sets the QDecoration derived class to use for decorating the - windows used by Qt for Embedded Linux to the \a decoration - specified. - - This method is non-portable. It is only available in Qt for Embedded Linux. - - \sa QDecoration -*/ void QApplication::qwsSetDecoration(QDecoration *dec) { if (dec) { @@ -3153,21 +3099,6 @@ void QApplication::qwsSetDecoration(QDecoration *dec) } } -/*! - \overload - - Requests a QDecoration object for \a decoration from the QDecorationFactory. - - The string must be one of the QDecorationFactory::keys(). Keys are - case insensitive. - - A later call to the QApplication constructor will override the - requested style when a "-style" option is passed in as a commandline - parameter. - - Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object - returned is set as the application's GUI style. -*/ QDecoration* QApplication::qwsSetDecoration(const QString &decoration) { QDecoration *decore = QDecorationFactory::create(decoration); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bc32c14..f14ad6f 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1371,13 +1371,6 @@ QString QApplicationPrivate::appName() const extern uint qGlobalPostedEventsCount(); -/*! - \internal - \since 4.1 - - If \a gotFocus is true, \a widget will become the active window. - Otherwise the active window is reset to 0. -*/ void QApplication::winFocus(QWidget *widget, bool gotFocus) { if (d_func()->inPopupMode()) // some delayed focus event to ignore @@ -1732,6 +1725,21 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // fall-through intended case WM_KEYUP: case WM_SYSKEYUP: +#if Q_OS_WINCE_WM + case WM_HOTKEY: + if(HIWORD(msg.lParam) == VK_TBACK) { + const bool hotKeyDown = !(LOWORD(msg.lParam) & MOD_KEYUP); + msg.lParam = 0x69 << 16; + msg.wParam = VK_BACK; + if (hotKeyDown) { + msg.message = WM_KEYDOWN; + qt_keymapper_private()->updateKeyMap(msg); + } else { + msg.message = WM_KEYUP; + } + } + // fall-through intended +#endif case WM_IME_CHAR: case WM_IME_KEYDOWN: case WM_CHAR: { @@ -2921,7 +2929,6 @@ void qt_win_eatMouseMove() // In DnD, the mouse release event never appears, so the // mouse button state machine must be manually reset -/*! \internal */ void QApplication::winMouseButtonUp() { qt_button_down = 0; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 15149a5..a3c9406 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2976,11 +2976,6 @@ QWidget *QApplication::topLevelAt(const QPoint &p) #endif } -/*! - Synchronizes with the X server in the X11 implementation. This - normally takes some time. Does nothing on other platforms. -*/ - void QApplication::syncX() { if (X11->display) @@ -3086,9 +3081,6 @@ static QETWidget *qPRFindWidget(Window oldwin) return wPRmapper ? (QETWidget*)wPRmapper->value((int)oldwin, 0) : 0; } -/*! - \internal -*/ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) { if (w && !w->internalWinId()) @@ -3151,17 +3143,6 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) return 0; } -/*! - This function does the core processing of individual X - \a{event}s, normally by dispatching Qt events to the right - destination. - - It returns 1 if the event was consumed by special handling, 0 if - the \a event was consumed by normal handling, and -1 if the \a - event was for an unrecognized widget. - - \sa x11EventFilter() -*/ int QApplication::x11ProcessEvent(XEvent* event) { Q_D(QApplication); @@ -3843,29 +3824,6 @@ int QApplication::x11ProcessEvent(XEvent* event) return 0; } -/*! - \fn bool QApplication::x11EventFilter(XEvent *event) - - \warning This virtual function is only implemented under X11. - - If you create an application that inherits QApplication and - reimplement this function, you get direct access to all X events - that the are received from the X server. The events are passed in - the \a event parameter. - - Return true if you want to stop the event from being processed. - Return false for normal event dispatching. The default - implementation returns false. - - It is only the directly addressed messages that are filtered. - You must install an event filter directly on the event - dispatcher, which is returned by - QAbstractEventDispatcher::instance(), to handle system wide - messages. - - \sa x11ProcessEvent() -*/ - bool QApplication::x11EventFilter(XEvent *) { return false; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index ff36ca1..4ceae3f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -198,6 +198,7 @@ extern "C" { } composing = false; sendKeyEvents = true; + currentCustomTypes = 0; [self setHidden:YES]; return self; } @@ -212,10 +213,16 @@ extern "C" { object:self]; } --(void)registerDragTypes:(bool)accept +-(void)registerDragTypes { QMacCocoaAutoReleasePool pool; - if (accept) { + // Calling registerForDraggedTypes is slow, so only do it once for each widget + // or when the custom types change. + const QStringList& customTypes = qEnabledDraggedTypes(); + if (currentCustomTypes == 0 || *currentCustomTypes != customTypes) { + if (currentCustomTypes == 0) + currentCustomTypes = new QStringList(); + *currentCustomTypes = customTypes; const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, NSStringPboardType, @@ -227,13 +234,10 @@ extern "C" { NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; // Add custom types supported by the application. - const QStringList& customTypes = qEnabledDraggedTypes(); for (int i = 0; i < customTypes.size(); i++) { [supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))]; } [self registerForDraggedTypes:supportedTypes]; - } else { - [self unregisterDraggedTypes]; } } @@ -282,6 +286,8 @@ extern "C" { - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { + if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) + return NSDragOperationNone; [self addDropData:sender]; QMimeData *mimeData = dropData; if (QDragManager::self()->source()) @@ -414,6 +420,8 @@ extern "C" { - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; + delete currentCustomTypes; + [self unregisterDraggedTypes]; [super dealloc]; } diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 9de94d5..983c762 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -83,6 +83,7 @@ Q_GUI_EXPORT bool composing; int composingLength; bool sendKeyEvents; + QStringList *currentCustomTypes; } - (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; - (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; @@ -91,7 +92,7 @@ Q_GUI_EXPORT - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender; - (void)draggingExited:(id < NSDraggingInfo >)sender; - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; -- (void)registerDragTypes:(bool)accept; +- (void)registerDragTypes; - (void)removeDropData; - (void)addDropData:(id <NSDraggingInfo>)sender; - (void)setSupportedActions:(NSDragOperation)actions; diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 1d5a70d..4463aab 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -1028,8 +1028,13 @@ void QLayout::freeze(int w, int h) void QLayout::setMenuBar(QWidget *widget) { Q_D(QLayout); - if (widget) - addChildWidget(widget); + +#ifdef Q_OS_WINCE_WM + if (widget && widget->size().height() > 0) +#else + if (widget) +#endif + addChildWidget(widget); d->menubar = widget; } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index f000292..9165836 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -826,13 +826,28 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev QWidget *qwidget = [theView qt_qwidget]; QWidget *widgetToGetMouse = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); - if (popup && popup != qwidget->window()) - widgetToGetMouse = popup; NSView *tmpView = theView; - if (widgetToGetMouse != qwidget) { - tmpView = qt_mac_nativeview_for(widgetToGetMouse); + + if (popup && popup != qwidget->window()) { + widgetToGetMouse = popup; + tmpView = qt_mac_nativeview_for(popup); windowPoint = [[tmpView window] convertScreenToBase:globalPoint]; + + QPoint qWindowPoint(windowPoint.x, windowPoint.y); + if (widgetToGetMouse->rect().contains(qWindowPoint)) { + // Keeping the mouse pressed on a combobox button will make + // the popup pop in front of the mouse. But all mouse events + // will be sendt to the button. Since we want mouse events + // to be sendt to widgets inside the popup, we search for the + // widget in front of the mouse: + tmpView = [tmpView hitTest:windowPoint]; + if (!tmpView) + return false; + widgetToGetMouse = + [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget]; + } } + NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; QPoint qlocalPoint(localPoint.x, localPoint.y); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f9cf7b7..06f618d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4823,7 +4823,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, Q_ASSERT(engine); QPaintEnginePrivate *enginePriv = engine->d_func(); Q_ASSERT(enginePriv); - QPaintDevice *target = painter->worldMatrixEnabled() ? engine->paintDevice() : painter->device(); + QPaintDevice *target = engine->paintDevice(); Q_ASSERT(target); // Render via a pixmap when dealing with non-opaque painters or printers. @@ -11490,3 +11490,17 @@ void QWidget::clearMask() setMask(QRegion()); } +/*! \fn const QX11Info &QWidget::x11Info() const + Returns information about the configuration of the X display used to display + the widget. + + \warning This function is only available on X11. +*/ + +/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const + Returns the X11 Picture handle of the widget for XRender + support. Use of this function is not portable. This function will + return 0 if XRender support is not compiled into Qt, if the + XRender extension is not supported on the X11 display, or if the + handle could not be created. +*/ diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5abaaf8..b315eaf 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2162,6 +2162,7 @@ void QWidgetPrivate::finishCreateWindow_sys_Carbon(OSWindowRef windowRef) setWindowModified_sys(q->isWindowModified()); updateFrameStrut(); qt_mac_update_sizer(q); + applyMaxAndMinSizeOnWindow(); } #else // QT_MAC_USE_COCOA void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWindowRef) @@ -2247,6 +2248,7 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin syncCocoaMask(); macUpdateIsOpaque(); qt_mac_update_sizer(q); + applyMaxAndMinSizeOnWindow(); } #endif // QT_MAC_USE_COCOA @@ -4001,7 +4003,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) } } -void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h) +void QWidgetPrivate::adjustWithinMaxAndMinSize(int &w, int &h) { if (QWExtra *extra = extraData()) { w = qMin(w, extra->maxw); @@ -4028,6 +4030,26 @@ void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h) } } +void QWidgetPrivate::applyMaxAndMinSizeOnWindow() +{ + Q_Q(QWidget); + const float max_f(20000); +#ifndef QT_MAC_USE_COCOA +#define SF(x) ((x > max_f) ? max_f : x) + HISize max = CGSizeMake(SF(extra->maxw), SF(extra->maxh)); + HISize min = CGSizeMake(SF(extra->minw), SF(extra->minh)); +#undef SF + SetWindowResizeLimits(qt_mac_window_for(q), &min, &max); +#else +#define SF(x) ((x > max_f) ? max_f : x) + NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh)); + NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh)); +#undef SF + [qt_mac_window_for(q) setMinSize:min]; + [qt_mac_window_for(q) setMaxSize:max]; +#endif +} + void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) { Q_Q(QWidget); @@ -4039,17 +4061,18 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QMacCocoaAutoReleasePool pool; bool realWindow = isRealWindow(); - if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen) + if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)){ + adjustWithinMaxAndMinSize(w, h); #ifndef QT_MAC_USE_COCOA - && !(w == 0 && h == 0) -#endif - ){ - applyMaxAndMinSizeConstraints(w, h); - topData()->isSetGeometry = 1; - topData()->isMove = isMove; -#ifndef QT_MAC_USE_COCOA - Rect r; SetRect(&r, x, y, x + w, y + h); - SetWindowBounds(qt_mac_window_for(q), kWindowContentRgn, &r); + if (w != 0 && h != 0) { + topData()->isSetGeometry = 1; + topData()->isMove = isMove; + Rect r; SetRect(&r, x, y, x + w, y + h); + SetWindowBounds(qt_mac_window_for(q), kWindowContentRgn, &r); + topData()->isSetGeometry = 0; + } else { + setGeometry_sys_helper(x, y, w, h, isMove); + } #else NSWindow *window = qt_mac_window_for(q); const QRect &fStrut = frameStrut(); @@ -4077,7 +4100,6 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) [window setFrameOrigin:cocoaFrameRect.origin]; } #endif - topData()->isSetGeometry = 0; } else { setGeometry_sys_helper(x, y, w, h, isMove); } @@ -4102,40 +4124,19 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.crect = QRect(x, y, w, h); if (realWindow) { - if (QWExtra *extra = extraData()) { - applyMaxAndMinSizeConstraints(w, h); - qt_mac_update_sizer(q); + adjustWithinMaxAndMinSize(w, h); + qt_mac_update_sizer(q); - if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { #ifndef QT_MAC_USE_COCOA - OSWindowRef window = qt_mac_window_for(q); - if(extra->maxw && extra->maxh && extra->maxw == extra->minw - && extra->maxh == extra->minh) { - ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute); - } else { - ChangeWindowAttributes(window, kWindowFullZoomAttribute, kWindowNoAttributes); - } -#endif + if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { + OSWindowRef window = qt_mac_window_for(q); + if (extra->maxw && extra->maxh && extra->maxw == extra->minw + && extra->maxh == extra->minh) { + ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute); + } else { + ChangeWindowAttributes(window, kWindowFullZoomAttribute, kWindowNoAttributes); } - - // Update max and min constraints: - const float max_f(20000); -#ifndef QT_MAC_USE_COCOA -#define SF(x) ((x > max_f) ? max_f : x) - HISize max = CGSizeMake(SF(extra->maxw), SF(extra->maxh)); - HISize min = CGSizeMake(SF(extra->minw), SF(extra->minh)); -#undef SF - SetWindowResizeLimits(qt_mac_window_for(q), &min, &max); -#else -#define SF(x) ((x > max_f) ? max_f : x) - NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh)); - NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh)); -#undef SF - [qt_mac_window_for(q) setMinSize:min]; - [qt_mac_window_for(q) setMaxSize:max]; -#endif } -#ifndef QT_MAC_USE_COCOA HIRect bounds = CGRectMake(0, 0, w, h); HIViewSetFrame(qt_mac_nativeview_for(q), &bounds); #else @@ -4181,6 +4182,7 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM void QWidgetPrivate::setConstraints_sys() { updateMaximizeButton_sys(); + applyMaxAndMinSizeOnWindow(); } void QWidgetPrivate::updateMaximizeButton_sys() @@ -4495,8 +4497,8 @@ void QWidgetPrivate::registerDropSite(bool on) SetControlDragTrackingEnabled(qt_mac_nativeview_for(q), on); #else NSView *view = qt_mac_nativeview_for(q); - if ([view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { - [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes:on]; + if (on && [view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { + [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes]; } #endif } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index e26b89c..734e0bd 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -267,7 +267,8 @@ public: void macUpdateIsOpaque(); void setEnabled_helper_sys(bool enable); bool isRealWindow() const; - void applyMaxAndMinSizeConstraints(int &w, int &h); + void adjustWithinMaxAndMinSize(int &w, int &h); + void applyMaxAndMinSizeOnWindow(); #endif #ifdef Q_WS_S60 diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 76734d4..6202b35 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -2747,12 +2747,6 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal opacity) 32, PropModeReplace, (uchar*)&value, 1); } -/*! - Returns information about the configuration of the X display used to display - the widget. - - \warning This function is only available on X11. -*/ const QX11Info &QWidget::x11Info() const { Q_D(const QWidget); @@ -2789,13 +2783,6 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() return new QX11WindowSurface(q_func()); } -/*! - Returns the X11 Picture handle of the widget for XRender - support. Use of this function is not portable. This function will - return 0 if XRender support is not compiled into Qt, if the - XRender extension is not supported on the X11 display, or if the - handle could not be created. -*/ Qt::HANDLE QWidget::x11PictureHandle() const { #ifndef QT_NO_XRENDER diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 8fb7a12..0a3a8dd 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -492,7 +492,8 @@ static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately) return; #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) - if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately) { + if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately + && !widget->testAttribute(Qt::WA_DontShowOnScreen)) { // Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events // are blocked until the mouse button is released. See task 146849. const QRegion rgn(qt_dirtyRegion(widget)); diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index dd7b016..93f11e1 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE -static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; - struct SourceOnlyAlpha { inline uchar alpha(uchar src) const { return src; } @@ -140,14 +138,11 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { template <typename SRC, typename T> void qt_scale_image_16bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &target, + const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, T blender) { - const QRectF targetRect = target.translated(aliasedCoordinateDelta, - aliasedCoordinateDelta); - qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); @@ -618,14 +613,11 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &target, + const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, T blender) { - const QRectF targetRect = target.translated(aliasedCoordinateDelta, - aliasedCoordinateDelta); - qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 36e4300..ed4dd57 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2527,8 +2527,7 @@ static inline int color_burn_op(int dst, int src, int da, int sa) if (src == 0 || src_da + dst_sa <= sa_da) return qt_div_255(temp); - else - return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); + return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); } template <typename T> diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp index 6a68d28..c67be86 100644 --- a/src/gui/painting/qpaintdevice_qws.cpp +++ b/src/gui/painting/qpaintdevice_qws.cpp @@ -81,9 +81,6 @@ int QPaintDevice::metric(PaintDeviceMetric m) const } } -/*! - \internal -*/ QWSDisplay *QPaintDevice::qwsDisplay() { return qt_fbdpy; diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/gui/painting/qpaintdevice_win.cpp index 6cae744..7cd3392 100644 --- a/src/gui/painting/qpaintdevice_win.cpp +++ b/src/gui/painting/qpaintdevice_win.cpp @@ -71,16 +71,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const return 0; } - -/*! \internal -*/ HDC QPaintDevice::getDC() const { return 0; } -/*! \internal -*/ void QPaintDevice::releaseDC(HDC) const { } diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp index 4ea9f57..95cb115 100644 --- a/src/gui/painting/qpaintdevice_x11.cpp +++ b/src/gui/painting/qpaintdevice_x11.cpp @@ -106,33 +106,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const #ifdef QT3_SUPPORT -/*! - Use QX11Info::display() instead. - - \oldcode - Display *display = widget->x11Display(); - \newcode - Display *display = QX11Info::display(); - \endcode - - \sa QWidget::x11Info(), QX11Info::display() -*/ Display *QPaintDevice::x11Display() const { return X11->display; } -/*! - Use QX11Info::screen() instead. - - \oldcode - int screen = widget->x11Screen(); - \newcode - int screen = widget->x11Info().screen(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Screen() const { const QX11Info *info = qt_x11Info(this); @@ -141,17 +119,6 @@ int QPaintDevice::x11Screen() const return QX11Info::appScreen(); } -/*! - Use QX11Info::visual() instead. - - \oldcode - void *visual = widget->x11Visual(); - \newcode - void *visual = widget->x11Info().visual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ void *QPaintDevice::x11Visual() const { const QX11Info *info = qt_x11Info(this); @@ -160,17 +127,6 @@ void *QPaintDevice::x11Visual() const return QX11Info::appVisual(); } -/*! - Use QX11Info::depth() instead. - - \oldcode - int depth = widget->x11Depth(); - \newcode - int depth = widget->x11Info().depth(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Depth() const { const QX11Info *info = qt_x11Info(this); @@ -179,17 +135,6 @@ int QPaintDevice::x11Depth() const return QX11Info::appDepth(); } -/*! - Use QX11Info::cells() instead. - - \oldcode - int cells = widget->x11Cells(); - \newcode - int cells = widget->x11Info().cells(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Cells() const { const QX11Info *info = qt_x11Info(this); @@ -198,17 +143,6 @@ int QPaintDevice::x11Cells() const return QX11Info::appCells(); } -/*! - Use QX11Info::colormap() instead. - - \oldcode - unsigned long screen = widget->x11Colormap(); - \newcode - unsigned long screen = widget->x11Info().colormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11Colormap() const { const QX11Info *info = qt_x11Info(this); @@ -217,17 +151,6 @@ Qt::HANDLE QPaintDevice::x11Colormap() const return QX11Info::appColormap(); } -/*! - Use QX11Info::defaultColormap() instead. - - \oldcode - bool isDefault = widget->x11DefaultColormap(); - \newcode - bool isDefault = widget->x11Info().defaultColormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11DefaultColormap() const { const QX11Info *info = qt_x11Info(this); @@ -236,17 +159,6 @@ bool QPaintDevice::x11DefaultColormap() const return QX11Info::appDefaultColormap(); } -/*! - Use QX11Info::defaultVisual() instead. - - \oldcode - bool isDefault = widget->x11DefaultVisual(); - \newcode - bool isDefault = widget->x11Info().defaultVisual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11DefaultVisual() const { const QX11Info *info = qt_x11Info(this); @@ -255,176 +167,48 @@ bool QPaintDevice::x11DefaultVisual() const return QX11Info::appDefaultVisual(); } -/*! - Use QX11Info::visual() instead. - - \oldcode - void *visual = QPaintDevice::x11AppVisual(screen); - \newcode - void *visual = qApp->x11Info(screen).visual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ void *QPaintDevice::x11AppVisual(int screen) { return QX11Info::appVisual(screen); } -/*! - Use QX11Info::colormap() instead. - - \oldcode - unsigned long colormap = QPaintDevice::x11AppColormap(screen); - \newcode - unsigned long colormap = qApp->x11Info(screen).colormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11AppColormap(int screen) { return QX11Info::appColormap(screen); } -/*! - Use QX11Info::display() instead. - - \oldcode - Display *display = QPaintDevice::x11AppDisplay(); - \newcode - Display *display = qApp->x11Info().display(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Display *QPaintDevice::x11AppDisplay() { return QX11Info::display(); } -/*! - Use QX11Info::screen() instead. - - \oldcode - int screen = QPaintDevice::x11AppScreen(); - \newcode - int screen = qApp->x11Info().screen(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppScreen() { return QX11Info::appScreen(); } -/*! - Use QX11Info::depth() instead. - - \oldcode - int depth = QPaintDevice::x11AppDepth(screen); - \newcode - int depth = qApp->x11Info(screen).depth(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDepth(int screen) { return QX11Info::appDepth(screen); } -/*! - Use QX11Info::cells() instead. - - \oldcode - int cells = QPaintDevice::x11AppCells(screen); - \newcode - int cells = qApp->x11Info(screen).cells(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppCells(int screen) { return QX11Info::appCells(screen); } -/*! - Use QX11Info::appRootWindow() instead. - - \oldcode - unsigned long window = QPaintDevice::x11AppRootWindow(screen); - \newcode - unsigned long window = qApp->x11Info(screen).appRootWindow(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) { return QX11Info::appRootWindow(screen); } -/*! - Use QX11Info::defaultColormap() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDefaultColormap(screen); - \newcode - bool isDefault = qApp->x11Info(screen).defaultColormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11AppDefaultColormap(int screen) { return QX11Info::appDefaultColormap(screen); } -/*! - Use QX11Info::defaultVisual() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDefaultVisual(screen); - \newcode - bool isDefault = qApp->x11Info(screen).defaultVisual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11AppDefaultVisual(int screen) { return QX11Info::appDefaultVisual(screen); } -/*! - Use QX11Info::setAppDpiX() instead. -*/ void QPaintDevice::x11SetAppDpiX(int dpi, int screen) { QX11Info::setAppDpiX(dpi, screen); } -/*! - Use QX11Info::setAppDpiY() instead. -*/ void QPaintDevice::x11SetAppDpiY(int dpi, int screen) { QX11Info::setAppDpiY(dpi, screen); } - -/*! - Use QX11Info::appDpiX() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDpiX(screen); - \newcode - bool isDefault = qApp->x11Info(screen).appDpiX(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDpiX(int screen) { return QX11Info::appDpiX(screen); } -/*! - Use QX11Info::appDpiY() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDpiY(screen); - \newcode - bool isDefault = qApp->x11Info(screen).appDpiY(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDpiY(int screen) { return QX11Info::appDpiY(screen); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index ba8f2a3..1192a58 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2575,7 +2575,12 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe QRasterPaintEngineState *s = state(); const bool aa = s->flags.antialiased || s->flags.bilinear; if (!aa && sr.size() == QSize(1, 1)) { + // as fillRect will apply the aliased coordinate delta we need to + // subtract it here as we don't use it for image drawing + QTransform old = s->matrix; + s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y()))); + s->matrix = old; return; } @@ -2609,6 +2614,18 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe return; d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); + if (!aa && s->matrix.type() == QTransform::TxScale) { + QRectF rr = s->matrix.mapRect(r); + + const int x1 = qRound(rr.x()); + const int y1 = qRound(rr.y()); + const int x2 = qRound(rr.right()); + const int y2 = qRound(rr.bottom()); + + fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); + return; + } + #ifdef QT_FAST_SPANS ensureState(); if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 4b2fbca..9cc9683 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1543,6 +1543,8 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p QX11PaintEnginePrivate::GCMode gcMode, QPaintEngine::PolygonDrawMode mode) { + Q_Q(QX11PaintEngine); + int clippedCount = 0; qt_float_point *clippedPoints = 0; @@ -1617,7 +1619,29 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p } else #endif if (fill.style() != Qt::NoBrush) { - if (clippedCount > 0) { + if (clippedCount > 200000) { + QPolygon poly; + for (int i = 0; i < clippedCount; ++i) + poly << QPoint(qFloor(clippedPoints[i].x), qFloor(clippedPoints[i].y)); + + const QRect bounds = poly.boundingRect(); + const QRect aligned = bounds + & QRect(QPoint(), QSize(pdev->width(), pdev->height())); + + QImage img(aligned.size(), QImage::Format_ARGB32_Premultiplied); + img.fill(0); + + QPainter painter(&img); + painter.translate(-aligned.x(), -aligned.y()); + painter.setPen(Qt::NoPen); + painter.setBrush(fill); + if (gcMode == BrushGC) + painter.setBrushOrigin(q->painter()->brushOrigin()); + painter.drawPolygon(poly); + painter.end(); + + q->drawImage(aligned, img, img.rect(), Qt::AutoColor); + } else if (clippedCount > 0) { QVarLengthArray<XPoint> xpoints(clippedCount); for (int i = 0; i < clippedCount; ++i) { xpoints[i].x = qFloor(clippedPoints[i].x); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index afc4211..baa9ce3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -8571,4 +8571,252 @@ void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivat p->draw_helper(path, operation); } +/*! \fn Display *QPaintDevice::x11Display() const + Use QX11Info::display() instead. + + \oldcode + Display *display = widget->x11Display(); + \newcode + Display *display = QX11Info::display(); + \endcode + + \sa QWidget::x11Info(), QX11Info::display() +*/ + +/*! \fn int QPaintDevice::x11Screen() const + Use QX11Info::screen() instead. + + \oldcode + int screen = widget->x11Screen(); + \newcode + int screen = widget->x11Info().screen(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void *QPaintDevice::x11Visual() const + Use QX11Info::visual() instead. + + \oldcode + void *visual = widget->x11Visual(); + \newcode + void *visual = widget->x11Info().visual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11Depth() const + Use QX11Info::depth() instead. + + \oldcode + int depth = widget->x11Depth(); + \newcode + int depth = widget->x11Info().depth(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11Cells() const + Use QX11Info::cells() instead. + + \oldcode + int cells = widget->x11Cells(); + \newcode + int cells = widget->x11Info().cells(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11Colormap() const + Use QX11Info::colormap() instead. + + \oldcode + unsigned long screen = widget->x11Colormap(); + \newcode + unsigned long screen = widget->x11Info().colormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11DefaultColormap() const + Use QX11Info::defaultColormap() instead. + + \oldcode + bool isDefault = widget->x11DefaultColormap(); + \newcode + bool isDefault = widget->x11Info().defaultColormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11DefaultVisual() const + Use QX11Info::defaultVisual() instead. + + \oldcode + bool isDefault = widget->x11DefaultVisual(); + \newcode + bool isDefault = widget->x11Info().defaultVisual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void *QPaintDevice::x11AppVisual(int screen) + Use QX11Info::visual() instead. + + \oldcode + void *visual = QPaintDevice::x11AppVisual(screen); + \newcode + void *visual = qApp->x11Info(screen).visual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11AppColormap(int screen) + Use QX11Info::colormap() instead. + + \oldcode + unsigned long colormap = QPaintDevice::x11AppColormap(screen); + \newcode + unsigned long colormap = qApp->x11Info(screen).colormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Display *QPaintDevice::x11AppDisplay() + Use QX11Info::display() instead. + + \oldcode + Display *display = QPaintDevice::x11AppDisplay(); + \newcode + Display *display = qApp->x11Info().display(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppScreen() + Use QX11Info::screen() instead. + + \oldcode + int screen = QPaintDevice::x11AppScreen(); + \newcode + int screen = qApp->x11Info().screen(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppDepth(int screen) + Use QX11Info::depth() instead. + + \oldcode + int depth = QPaintDevice::x11AppDepth(screen); + \newcode + int depth = qApp->x11Info(screen).depth(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppCells(int screen) + Use QX11Info::cells() instead. + + \oldcode + int cells = QPaintDevice::x11AppCells(screen); + \newcode + int cells = qApp->x11Info(screen).cells(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) + Use QX11Info::appRootWindow() instead. + + \oldcode + unsigned long window = QPaintDevice::x11AppRootWindow(screen); + \newcode + unsigned long window = qApp->x11Info(screen).appRootWindow(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11AppDefaultColormap(int screen) + Use QX11Info::defaultColormap() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDefaultColormap(screen); + \newcode + bool isDefault = qApp->x11Info(screen).defaultColormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11AppDefaultVisual(int screen) + Use QX11Info::defaultVisual() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDefaultVisual(screen); + \newcode + bool isDefault = qApp->x11Info(screen).defaultVisual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void QPaintDevice::x11SetAppDpiX(int dpi, int screen) + Use QX11Info::setAppDpiX() instead. +*/ + +/*! \fn void QPaintDevice::x11SetAppDpiY(int dpi, int screen) + Use QX11Info::setAppDpiY() instead. +*/ + +/*! \fn int QPaintDevice::x11AppDpiX(int screen) + Use QX11Info::appDpiX() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDpiX(screen); + \newcode + bool isDefault = qApp->x11Info(screen).appDpiX(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppDpiY(int screen) + Use QX11Info::appDpiY() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDpiY(screen); + \newcode + bool isDefault = qApp->x11Info(screen).appDpiY(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn HDC QPaintDevice::getDC() const + \internal +*/ + +/*! \fn void QPaintDevice::releaseDC(HDC) const + \internal +*/ + +/*! \fn QWSDisplay *QPaintDevice::qwsDisplay() + \internal +*/ + QT_END_NAMESPACE diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 4f3e71c..5090b3a 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -284,8 +284,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke to send PostScript or PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default. - - Note that setting parameters like paper size and resolution on an + + Note that setting parameters like paper size and resolution on an invalid printer is undefined. You can use QPrinter::isValid() to verify this before changing any parameters. @@ -744,7 +744,7 @@ void QPrinter::setOutputFormat(OutputFormat format) #ifndef QT_NO_PDF Q_D(QPrinter); - if (d->outputFormat == format) + if (d->validPrinter && d->outputFormat == format) return; d->outputFormat = format; @@ -773,8 +773,8 @@ void QPrinter::setOutputFormat(OutputFormat format) if (def_engine) delete oldPrintEngine; - d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat; - + if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat) + d->validPrinter = true; #else Q_UNUSED(format); #endif diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 7a74fe0..110ba2f 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -142,8 +142,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn) p.fillRect(*it, blank); } } -#endif -#if defined(Q_OS_WINCE) +#else Q_UNUSED(rgn); #endif } @@ -250,6 +249,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // d->image->image.save("flush.png"); + Q_UNUSED(offset); // Get a context for the widget. #ifndef QT_MAC_USE_COCOA CGContextRef context; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index c973b41..7a870fe 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -549,7 +549,6 @@ extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp QMacCGStyle globals *****************************************************************************/ const int qt_mac_hitheme_version = 0; //the HITheme version we speak -const int macSpinBoxSep = 5; // distance between spinwidget and the lineedit const int macItemFrame = 2; // menu item frame width const int macItemHMargin = 3; // menu item hor text margin const int macItemVMargin = 2; // menu item ver text margin @@ -2376,7 +2375,14 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW break; case PM_SpinBoxFrameWidth: GetThemeMetric(kThemeMetricEditTextFrameOutset, &ret); - ret += 2; + switch (d->aquaSizeConstrain(opt, widget)) { + default: + ret += 2; + break; + case QAquaSizeMini: + ret += 1; + break; + } break; case PM_ButtonShiftHorizontal: case PM_ButtonShiftVertical: @@ -5017,11 +5023,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bdi.kind = kThemeIncDecButton; break; case QAquaSizeMini: + bdi.kind = kThemeIncDecButtonMini; + break; case QAquaSizeSmall: - if (aquaSize == QAquaSizeMini) - bdi.kind = kThemeIncDecButtonMini; - else - bdi.kind = kThemeIncDecButtonSmall; + bdi.kind = kThemeIncDecButtonSmall; break; } if (!(sb->stepEnabled & (QAbstractSpinBox::StepUpEnabled @@ -5041,8 +5046,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; - QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, - widget); + QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); + updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); HIRect newRect = qt_hirectForQRect(updown); QRect off_rct; @@ -5053,15 +5058,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex int(outRect.size.width - newRect.size.width), int(outRect.size.height - newRect.size.height)); - // HIThemeGetButtonBackgroundBounds offsets non-focused normal sized - // buttons by one in de y direction, account for that here. - if (bdi.adornment == kThemeAdornmentNone && bdi.kind == kThemeIncDecButton) - off_rct.adjust(0, 1, 0, 0); - - // Adjust the rect for small buttos also. - if (bdi.adornment == kThemeAdornmentFocus && bdi.kind == kThemeIncDecButtonSmall) - off_rct.adjust(0, 0, 0, -1); - newRect = qt_hirectForQRect(updown, off_rct); HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); } @@ -5726,39 +5722,61 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op break; case CC_SpinBox: if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { - const int spinner_w = 14, - fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); + QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); + int spinner_w; + int spinBoxSep; + int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); + switch (aquaSize) { + default: + case QAquaSizeUnknown: + case QAquaSizeLarge: + spinner_w = 14; + spinBoxSep = 2; + break; + case QAquaSizeSmall: + spinner_w = 12; + spinBoxSep = 2; + break; + case QAquaSizeMini: + spinner_w = 10; + spinBoxSep = 1; + break; + } + switch (sc) { case SC_SpinBoxUp: case SC_SpinBoxDown: { if (spin->buttonSymbols == QAbstractSpinBox::NoButtons) break; - const int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); - const int spinner_w = 18; - const int y = frameWidth; - const int x = spin->rect.width() - spinner_w + frameWidth; + + const int y = fw; + const int x = spin->rect.width() - spinner_w; ret.setRect(x + spin->rect.x(), y + spin->rect.y(), spinner_w, spin->rect.height() - y * 2); HIThemeButtonDrawInfo bdi; bdi.version = qt_mac_hitheme_version; bdi.kind = kThemeIncDecButton; - QAquaWidgetSize aquaSize = d->aquaSizeConstrain(opt, widget); + int hackTranslateX; switch (aquaSize) { - case QAquaSizeUnknown: - case QAquaSizeLarge: - bdi.kind = kThemeIncDecButton; - break; - case QAquaSizeMini: - case QAquaSizeSmall: - if (aquaSize == QAquaSizeMini) - bdi.kind = kThemeIncDecButtonMini; - else - bdi.kind = kThemeIncDecButtonSmall; - break; + default: + case QAquaSizeUnknown: + case QAquaSizeLarge: + bdi.kind = kThemeIncDecButton; + hackTranslateX = 0; + break; + case QAquaSizeSmall: + bdi.kind = kThemeIncDecButtonSmall; + hackTranslateX = -2; + break; + case QAquaSizeMini: + bdi.kind = kThemeIncDecButtonMini; + hackTranslateX = -1; + break; } bdi.state = kThemeStateActive; bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; HIRect hirect = qt_hirectForQRect(ret); + HIRect outRect; HIThemeGetButtonBackgroundBounds(&hirect, &bdi, &outRect); ret = qt_qrectForHIRect(outRect); @@ -5773,13 +5791,13 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op Q_ASSERT(0); break; } - ret.translate(-1, -2); // hack: position the buttons correctly (weird that we need this) + ret.translate(hackTranslateX, 0); // hack: position the buttons correctly (weird that we need this) ret = visualRect(spin->direction, spin->rect, ret); break; } case SC_SpinBoxEditField: ret.setRect(fw, fw, - spin->rect.width() - spinner_w - fw * 2 - macSpinBoxSep + 1, + spin->rect.width() - spinner_w - fw * 2 - spinBoxSep, spin->rect.height() - fw * 2); ret = visualRect(spin->direction, spin->rect, ret); break; @@ -5811,8 +5829,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, switch (ct) { case QStyle::CT_SpinBox: - sz.setWidth(sz.width() + macSpinBoxSep); - sz.setHeight(sz.height() - 3); // hack to work around horrible sizeHint() code in QAbstractSpinBox + // hack to work around horrible sizeHint() code in QAbstractSpinBox + sz.setHeight(sz.height() - 3); break; case QStyle::CT_TabBarTab: if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 058660e..714b8c5 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4926,7 +4926,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_LineEdit: #ifndef QT_NO_SPINBOX // ### hopelessly broken QAbstractSpinBox (part 2) - if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w->parentWidget())) { + if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0)) { QRenderRule rule = renderRule(spinBox, opt); if (rule.hasBox() || !rule.hasNativeBorder()) return csz; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index dac01c7..5a97086 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -279,19 +279,15 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "xx-large", Value_XXLarge } }; +//Map id to strings as they appears in the 'values' array above +static const int indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46, + 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16, + 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0, + 51, 44, 43 }; + QString Value::toString() const { - static int indexOfId[NumKnownValues - 1]; - static bool hasCachedIndexes = false; - if (type == KnownIdentifier) { - if (!hasCachedIndexes) { - for (int i = 0; i < NumKnownValues - 1; ++i) - indexOfId[values[i].id] = i; - - hasCachedIndexes = true; - } - return QLatin1String(values[indexOfId[variant.toInt()]].name); } else { return variant.toString(); diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index d691f93..6ee1d03 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -927,7 +927,7 @@ void QFont::setPointSize(int pointSize) void QFont::setPointSizeF(qreal pointSize) { if (pointSize <= 0) { - qWarning("QFont::setPointSizeF: Point size <= 0 (%d), must be greater than 0", pointSize); + qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); return; } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 5a8977d..c2c23ee 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -624,6 +624,45 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q return rgbMask; } +QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) +{ + glyph_metrics_t gm = boundingBox(glyph); + int glyph_x = qFloor(gm.x.toReal()); + int glyph_y = qFloor(gm.y.toReal()); + int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; + int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; + + if (glyph_width <= 0 || glyph_height <= 0) + return QImage(); + QFixedPoint pt; + pt.x = 0; + pt.y = -glyph_y; // the baseline + QPainterPath path; + QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); + im.fill(Qt::transparent); + QPainter p(&im); + p.setRenderHint(QPainter::Antialiasing); + addGlyphsToPath(&glyph, &pt, 1, &path, 0); + p.setPen(Qt::NoPen); + p.setBrush(Qt::black); + p.drawPath(path); + p.end(); + + QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); + QVector<QRgb> colors(256); + for (int i=0; i<256; ++i) + colors[i] = qRgba(0, 0, 0, i); + indexed.setColorTable(colors); + + for (int y=0; y<im.height(); ++y) { + uchar *dst = (uchar *) indexed.scanLine(y); + uint *src = (uint *) im.scanLine(y); + for (int x=0; x<im.width(); ++x) + dst[x] = qAlpha(src[x]); + } + + return indexed; +} void QFontEngine::removeGlyphFromCache(glyph_t) { diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index cb0b436..7a236fd 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1521,6 +1521,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs return false; } +#if !defined(QT_NO_FONTCONFIG) + extern QMutex *qt_fontdatabase_mutex(); + QMutex *mtx = 0; +#endif + bool mirrored = flags & QTextEngine::RightToLeft; int glyph_pos = 0; if (freetype->symbol_map) { @@ -1533,6 +1538,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs if ( !glyphs->glyphs[glyph_pos] ) { glyph_t glyph; #if !defined(QT_NO_FONTCONFIG) + if (!mtx) { + mtx = qt_fontdatabase_mutex(); + mtx->lock(); + } + if (FcCharSetHasChar(freetype->charset, uc)) { #else if (false) { @@ -1561,20 +1571,26 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs if (mirrored) uc = QChar::mirroredChar(uc); glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; - if (!glyphs->glyphs[glyph_pos] + if (!glyphs->glyphs[glyph_pos]) { #if !defined(QT_NO_FONTCONFIG) - && FcCharSetHasChar(freetype->charset, uc) + if (!mtx) { + mtx = qt_fontdatabase_mutex(); + mtx->lock(); + } + + if (FcCharSetHasChar(freetype->charset, uc)) #endif - ) { - redo: - glyph_t glyph = FT_Get_Char_Index(face, uc); - if (!glyph && (uc == 0xa0 || uc == 0x9)) { - uc = 0x20; - goto redo; + { + redo: + glyph_t glyph = FT_Get_Char_Index(face, uc); + if (!glyph && (uc == 0xa0 || uc == 0x9)) { + uc = 0x20; + goto redo; + } + glyphs->glyphs[glyph_pos] = glyph; + if (uc < QFreetypeFace::cmapCacheSize) + freetype->cmapCache[uc] = glyph; } - glyphs->glyphs[glyph_pos] = glyph; - if (uc < QFreetypeFace::cmapCacheSize) - freetype->cmapCache[uc] = glyph; } ++glyph_pos; } @@ -1583,6 +1599,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs *nglyphs = glyph_pos; glyphs->numGlyphs = glyph_pos; +#if !defined(QT_NO_FONTCONFIG) + if (mtx) + mtx->unlock(); +#endif + if (flags & QTextEngine::GlyphIndicesOnly) return true; @@ -1788,9 +1809,11 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g) GlyphFormat glyph_format = antialias ? Format_A8 : Format_Mono; - Glyph *glyph = loadGlyph(g, glyph_format); - if (!glyph) - return QImage(); + Glyph *glyph = defaultGlyphSet.outline_drawing ? 0 : loadGlyph(g, glyph_format); + if (!glyph) { + unlockFace(); + return QFontEngine::alphaMapForGlyph(g); + } const int pitch = antialias ? (glyph->width + 3) & ~3 : ((glyph->width + 31)/32) * 4; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 7382b39..a5aa097 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -182,7 +182,7 @@ public: * Create a qimage with the alpha values for the glyph. * Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque */ - virtual QImage alphaMapForGlyph(glyph_t) = 0; + virtual QImage alphaMapForGlyph(glyph_t); virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t); diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index c327b9f..48963bb 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1074,7 +1074,10 @@ QTextCursor::QTextCursor(const QTextCursor &cursor) } /*! - Makes a copy of \a cursor and assigns it to this QTextCursor. + Makes a copy of \a cursor and assigns it to this QTextCursor. Note + that QTextCursor is an \l{Implicitly Shared Classes}{implicitly + shared} class. + */ QTextCursor &QTextCursor::operator=(const QTextCursor &cursor) { diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index e84b324..873f846 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -287,7 +287,7 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba) that inform connected editor widgets about the state of the undo/redo system. - \sa QTextCursor QTextEdit \link richtext.html Rich Text Processing\endlink + \sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example} */ /*! diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 3f4c8e5..71b68e0 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE objects, you will also need to reimplement QTextDocument::createObject() which acts as a factory method for creating text objects. - \sa QTextDocument + \sa QTextDocument, {Text Object Example} */ /*! diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index e6bc80a..8410a69 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -824,7 +824,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) Q_Q(QCompleter); QString completion; - if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) { + if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) { completion = prefix; } else { QModelIndex si = proxy->mapToSource(index); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 2abc9e8..502c1e9 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -480,9 +480,6 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) oldMenuBar->hide(); oldMenuBar->deleteLater(); } -#ifdef Q_OS_WINCE - if (menuBar && menuBar->size().height() > 0) -#endif d->layout->setMenuBar(menuBar); } diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index ea58d46..847a623 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -58,6 +58,9 @@ #include <QtCore/qlibrary.h> #include <commctrl.h> +#if Q_OS_WINCE_WM +# include <windowsm.h> +#endif #include "qguifunctions_wince.h" @@ -71,6 +74,12 @@ #define SHCMBM_GETSUBMENU (WM_USER + 401) #endif +#ifdef Q_OS_WINCE_WM +# define SHMBOF_NODEFAULT 0x00000001 +# define SHMBOF_NOTIFY 0x00000002 +# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193) +#endif + extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp @@ -204,8 +213,13 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i mbi.dwFlags = flags; mbi.nToolBarId = toolbarID; - if (ptrCreateMenuBar(&mbi)) + if (ptrCreateMenuBar(&mbi)) { + // Tell the menu bar that we want to override hot key behaviour. + LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, + SHMBOF_NODEFAULT | SHMBOF_NOTIFY); + SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); return mbi.hwndMB; + } } return 0; } diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 2e9201d..e563fa1 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -624,7 +624,7 @@ void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx) if (viewport->updatesEnabled() && viewport->isVisible()) { int dy = 0; - if (doc->findBlockByLineNumber(control->topBlock).isValid()) { + if (doc->findBlockByNumber(control->topBlock).isValid()) { dy = (int)(-q->blockBoundingGeometry(block).y()) + verticalOffset() - verticalOffset(blockNumber, lineNumber); } diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index b562b1f..69221ba 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1085,7 +1085,7 @@ void QTabBar::setTabData(int index, const QVariant & data) } /*! - Returns the datad of the tab at position \a index, or a null + Returns the data of the tab at position \a index, or a null variant if \a index is out of range. */ QVariant QTabBar::tabData(int index) const @@ -2222,6 +2222,7 @@ void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget) d->tabList[index].rightWidget = widget; } d->layoutTabs(); + d->refresh(); update(); } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index e921318..e31621c 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -950,6 +950,17 @@ static QDateTime parseDateString(const QByteArray &dateString) */ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieString) { + // cookieString can be a number of set-cookie header strings joined together + // by \n, parse each line separately. + QList<QNetworkCookie> cookies; + QList<QByteArray> list = cookieString.split('\n'); + for (int a = 0; a < list.size(); a++) + cookies += QNetworkCookiePrivate::parseSetCookieHeaderLine(list.at(a)); + return cookies; +} + +QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByteArray &cookieString) +{ // According to http://wp.netscape.com/newsref/std/cookie_spec.html,< // the Set-Cookie response header is of the format: // @@ -967,12 +978,6 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin while (position < length) { QNetworkCookie cookie; - // When there are multiple SetCookie headers they are join with a new line - // \n will always be the start of a new cookie - int endOfSetCookie = cookieString.indexOf('\n', position); - if (endOfSetCookie == -1) - endOfSetCookie = length; - // The first part is always the "NAME=VALUE" part QPair<QByteArray,QByteArray> field = nextField(cookieString, position); if (field.first.isEmpty() || field.second.isNull()) @@ -983,7 +988,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin position = nextNonWhitespace(cookieString, position); bool endOfCookie = false; - while (!endOfCookie && position < endOfSetCookie) + while (!endOfCookie && position < length) { switch (cookieString.at(position++)) { case ',': // end of the cookie @@ -1006,9 +1011,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin position = end; QDateTime dt = parseDateString(dateString.toLower()); if (!dt.isValid()) { - cookie = QNetworkCookie(); - endOfCookie = true; - continue; + return result; } cookie.setExpirationDate(dt); } else if (field.first == "domain") { @@ -1025,8 +1028,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin bool ok = false; int secs = field.second.toInt(&ok); if (!ok) - // invalid cookie string - return QList<QNetworkCookie>(); + return result; cookie.setExpirationDate(now.addSecs(secs)); } else if (field.first == "path") { QString path = QUrl::fromPercentEncoding(field.second); @@ -1040,9 +1042,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin } else if (field.first == "version") { if (field.second != "1") { // oops, we don't know how to handle this cookie - cookie = QNetworkCookie(); - endOfCookie = true; - continue; + return result; } } else { // got an unknown field in the cookie @@ -1050,9 +1050,8 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin } position = nextNonWhitespace(cookieString, position); - if (position > endOfSetCookie) - endOfCookie = true; } + } if (!cookie.name().isEmpty()) result += cookie; diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 83ef14a..0c41322 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -61,6 +61,7 @@ class QNetworkCookiePrivate: public QSharedData { public: inline QNetworkCookiePrivate() : secure(false), httpOnly(false) { } + static QList<QNetworkCookie> parseSetCookieHeaderLine(const QByteArray &cookieString); QDateTime expirationDate; QString domain; diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 93360c8..892929e 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -191,7 +191,11 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) } else { QString templateName = d->tmpCacheFileName(); cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data); - cacheItem->file->open(); + if (!cacheItem->file->open()) { + qWarning() << "QNetworkDiskCache::prepare() unable to open temporary file"; + delete cacheItem; + return 0; + } cacheItem->writeHeader(cacheItem->file); device = cacheItem->file; } @@ -229,7 +233,7 @@ void QNetworkDiskCachePrivate::storeItem(QCacheItem *cacheItem) if (QFile::exists(fileName)) { if (!QFile::remove(fileName)) { - qWarning() << "QNetworkDiskCache: could't remove the cache file " << fileName; + qWarning() << "QNetworkDiskCache: couldn't remove the cache file " << fileName; return; } } diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index f4ece97..62bdfc7 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -86,10 +86,11 @@ The SOCKS5 support in Qt 4 is based on \l{RFC 1928} and \l{RFC 1929}. The supported authentication methods are no authentication and username/password authentication. Both IPv4 and IPv6 are - supported, but domain name resolution via the SOCKS server is not - supported; i.e. all domain names are resolved locally. There are - several things to remember when using SOCKS5 with QUdpSocket and - QTcpServer: + supported. Domain names are resolved through the SOCKS5 server if + the QNetworkProxy::HostNameLookupCapability is enabled, otherwise + they are resolved locally and the IP address is sent to the + server. There are several things to remember when using SOCKS5 + with QUdpSocket and QTcpServer: With QUdpSocket, a call to \l {QUdpSocket::bind()}{bind()} may fail with a timeout error. If a port number other than 0 is passed to @@ -365,7 +366,8 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro int(QNetworkProxy::HostNameLookupCapability)), }; - Q_ASSERT(int(type) >= 0 && int(type) <= int(QNetworkProxy::FtpCachingProxy)); + if (int(type) < 0 && int(type) > int(QNetworkProxy::FtpCachingProxy)) + type = QNetworkProxy::DefaultProxy; return QNetworkProxy::Capabilities(defaults[int(type)]); } @@ -378,6 +380,7 @@ public: QNetworkProxy::Capabilities capabilities; quint16 port; QNetworkProxy::ProxyType type; + bool capabilitiesSet; inline QNetworkProxyPrivate(QNetworkProxy::ProxyType t = QNetworkProxy::DefaultProxy, const QString &h = QString(), quint16 p = 0, @@ -387,7 +390,8 @@ public: password(pw), capabilities(defaultCapabilitiesForType(t)), port(p), - type(t) + type(t), + capabilitiesSet(false) { } inline bool operator==(const QNetworkProxyPrivate &other) const @@ -490,13 +494,16 @@ QNetworkProxy &QNetworkProxy::operator=(const QNetworkProxy &other) Sets the proxy type for this instance to be \a type. Note that changing the type of a proxy does not change - the set of capabilities this QNetworkProxy object holds. + the set of capabilities this QNetworkProxy object holds if any + capabilities have been set with setCapabilities(). \sa type(), setCapabilities() */ void QNetworkProxy::setType(QNetworkProxy::ProxyType type) { d->type = type; + if (!d->capabilitiesSet) + d->capabilities = defaultCapabilitiesForType(type); } /*! @@ -519,6 +526,7 @@ QNetworkProxy::ProxyType QNetworkProxy::type() const void QNetworkProxy::setCapabilities(Capabilities capabilities) { d->capabilities = capabilities; + d->capabilitiesSet = true; } /*! diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp index 505c662..7fec2df 100644 --- a/src/network/ssl/qsslcipher.cpp +++ b/src/network/ssl/qsslcipher.cpp @@ -64,9 +64,9 @@ #ifndef QT_NO_DEBUG_STREAM #include <QtCore/qdebug.h> +#endif QT_BEGIN_NAMESPACE -#endif /*! Constructs an empty QSslCipher object. diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index e09e764..42c09f5 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -364,11 +364,14 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() // DT_RPATH tags on our library header as well as other system-specific search // paths. See the man page for dlopen(3) on your system for more information. +#ifdef Q_OS_OPENBSD + libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint); +#endif #ifdef SHLIB_VERSION_NUMBER // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER> libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER)); libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER)); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found return pair; } else { @@ -380,7 +383,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() // second attempt: find the development files libssl.so and libcrypto.so libssl->setFileNameAndVersion(QLatin1String("ssl"), -1); libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.0 and libcrypto.so.0 found return pair; } else { @@ -395,7 +398,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() crypto.replace(QLatin1String("ssl"), QLatin1String("crypto")); libssl->setFileNameAndVersion(ssl, -1); libcrypto->setFileNameAndVersion(crypto, -1); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.0 and libcrypto.so.0 found return pair; } else { diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm index 9a679b1..e95e36b 100644 --- a/src/opengl/qglpixelbuffer_mac.mm +++ b/src/opengl/qglpixelbuffer_mac.mm @@ -299,9 +299,8 @@ void QGLPixelBuffer::releaseFromDynamicTexture() GLuint QGLPixelBuffer::generateDynamicTexture() const { - Q_D(const QGLPixelBuffer); - #ifdef QT_MAC_USE_COCOA + Q_D(const QGLPixelBuffer); NSOpenGLContext *oldContext = [NSOpenGLContext currentContext]; if (d->share_ctx != oldContext) [static_cast<NSOpenGLContext *>(d->share_ctx) makeCurrentContext]; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index ec6e33b..5a212f5 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -5068,9 +5068,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte // fall back to drawing a polygon if the scale factor is large, or // we use a gradient pen - if (ti.fontEngine->fontDef.pixelSize >= 64 - || (d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern - && d->pen_brush_style <= Qt::ConicalGradientPattern)) { + if ((d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern + && d->pen_brush_style <= Qt::ConicalGradientPattern)) { QPaintEngine::drawTextItem(p, textItem); return; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 6d8f617..91a60e7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -80,7 +80,7 @@ template <typename T> inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr<bool>(const bool &) { return 0; } template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - QDirectFBPaintEnginePrivate::Scale scale, bool matrixRotShear, bool simplePen, + int scale, bool matrixRotShear, bool simplePen, bool dfbHandledClip, bool forceRasterPrimitives, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, @@ -211,6 +211,8 @@ static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { public: + enum Scale { NoScale, Scaled, NegativeScale }; + QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); ~QDirectFBPaintEnginePrivate(); @@ -266,7 +268,7 @@ private: bool simplePen; bool matrixRotShear; - enum Scale { NoScale, Scaled, NegativeScale } scale; + Scale scale; SurfaceCache *surfaceCache; QTransform transform; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 25e24fd..f571d1b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -818,7 +818,7 @@ static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags -static void printDirectFBInfo(IDirectFB *fb) +static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) { DFBResult result; DFBGraphicsDeviceDescription dev; @@ -829,10 +829,14 @@ static void printDirectFBInfo(IDirectFB *fb) return; } - qDebug("Device: %s (%s), Driver: %s v%i.%i (%s)\n" + DFBSurfacePixelFormat pixelFormat; + primarySurface->GetPixelFormat(primarySurface, &pixelFormat); + + qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n" "acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n", dev.name, dev.vendor, dev.driver.name, dev.driver.major, - dev.driver.minor, dev.driver.vendor, dev.acceleration_mask, + dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat), + QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask, ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(), dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(), dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(), @@ -883,9 +887,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec) return false; } - if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) - printDirectFBInfo(d_ptr->dfb); - if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive)) d_ptr->directFBFlags |= VideoOnly; @@ -952,6 +953,9 @@ bool QDirectFBScreen::connect(const QString &displaySpec) return false; } + if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) + printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface); + // Work out what format we're going to use for surfaces with an alpha channel d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface); setPixelFormat(d_ptr->alphaPixmapFormat); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index f1e3c84..cd8796b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -178,15 +178,7 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask) "Unable to get DirectFB handle!"); } - DFBSurfaceDescription description; - description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | - DSDESC_HEIGHT | - DSDESC_PIXELFORMAT); - description.width = rect.width(); - description.height = rect.height(); - QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, - screen->pixelFormat()); - dfbSurface = screen->createDFBSurface(description, false); + dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { Q_ASSERT(dfbSurface); @@ -340,7 +332,7 @@ inline bool isWidgetOpaque(const QWidget *w) return false; } void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) + const QPoint &offset) { Q_UNUSED(widget); #ifdef QT_NO_DIRECTFB_WM diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 9eeb41d..6834d9a 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -871,7 +871,7 @@ QIBaseResult::~QIBaseResult() bool QIBaseResult::prepare(const QString& query) { - //qDebug("prepare: %s\n", qPrintable(query)); +// qDebug("prepare: %s", qPrintable(query)); if (!driver() || !driver()->isOpen() || driver()->isOpenError()) return false; d->cleanup(); @@ -1025,7 +1025,7 @@ bool QIBaseResult::exec() } if (ok) { - if (colCount()) { + if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) { isc_dsql_free_statement(d->status, &d->stmt, DSQL_close); if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement"))) return false; @@ -1039,7 +1039,7 @@ bool QIBaseResult::exec() return false; // Not all stored procedures necessarily return values. - if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda->sqld == 0) + if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda && d->sqlda->sqld == 0) delDA(d->sqlda); if (d->sqlda) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 9932463..ee500a0 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -563,7 +563,6 @@ QChar QODBCDriverPrivate::quoteChar() const static QChar quote = QChar::fromLatin1('"'); if (!isQuoteInitialized) { char driverResponse[4]; - SQLUSMALLINT casing; SQLSMALLINT length; int r = SQLGetInfo(hDbc, SQL_IDENTIFIER_QUOTE_CHAR, diff --git a/src/xmlpatterns/expr/qapplytemplate.cpp b/src/xmlpatterns/expr/qapplytemplate.cpp index 95f4fdf..b91c2f0 100644 --- a/src/xmlpatterns/expr/qapplytemplate.cpp +++ b/src/xmlpatterns/expr/qapplytemplate.cpp @@ -160,8 +160,7 @@ Item::Iterator::Ptr ApplyTemplate::evaluateSequence(const DynamicContext::Ptr &c focus->setFocusIterator(focusIterator); return makeSequenceMappingIterator<Item>(ConstPtr(this), focusIterator, focus); } - else - return CommonValues::emptyIterator; + return CommonValues::emptyIterator; } } diff --git a/src/xmlpatterns/functions/qsequencefns.cpp b/src/xmlpatterns/functions/qsequencefns.cpp index f6d5391..faa787e 100644 --- a/src/xmlpatterns/functions/qsequencefns.cpp +++ b/src/xmlpatterns/functions/qsequencefns.cpp @@ -246,8 +246,7 @@ Item::Iterator::Ptr SubsequenceFN::evaluateSequence(const DynamicContext::Ptr &c if(length < 1 && length != -1) return CommonValues::emptyIterator; - else - return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length)); + return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length)); } Item SubsequenceFN::evaluateSingleton(const DynamicContext::Ptr &context) const diff --git a/tests/arthur/data/qps/borderimage.qps b/tests/arthur/data/qps/borderimage.qps index 747a74d..8d2e54b 100644 --- a/tests/arthur/data/qps/borderimage.qps +++ b/tests/arthur/data/qps/borderimage.qps @@ -106,6 +106,38 @@ repeat_block draw_column resetMatrix setRenderHint Antialiasing off +translate 200.1 520.1 + +begin_block one_pixel_border +drawImage borderimage 0 0 16 16 0 0 16 16 +drawImage borderimage 16 0 64 16 16 0 1 1 +drawImage borderimage 80 0 16 16 48 0 16 16 + +drawImage borderimage 0 16 16 64 16 0 1 1 +drawImage borderimage 80 16 16 64 16 0 1 1 + +drawImage borderimage 0 80 16 16 0 48 16 16 +drawImage borderimage 16 80 64 16 16 0 1 1 +drawImage borderimage 80 80 16 16 48 48 16 16 +end_block one_pixel_border + +resetMatrix + +translate 205.1 626.1 +scale 0.4 0.4 + +repeat_block one_pixel_border + +resetMatrix + +translate 255.1 624.1 +scale 0.4 0.4 +rotate 10 + +repeat_block one_pixel_border + +resetMatrix + setPen red drawRect 0 0 70 680 @@ -127,3 +159,6 @@ drawText 174 114 "smoothpixmaptransform off" drawRect 164 128 224 134 drawText 174 252 "smoothpixmaptransform on" + +drawRect 200 520 97 188 +drawText 210 698 "1x1 edges" diff --git a/tests/arthur/data/qps/borderimage_qps.png b/tests/arthur/data/qps/borderimage_qps.png Binary files differindex 89a8eba..ed51d5f 100644 --- a/tests/arthur/data/qps/borderimage_qps.png +++ b/tests/arthur/data/qps/borderimage_qps.png diff --git a/tests/auto/q3accel/q3accel.pro b/tests/auto/q3accel/q3accel.pro index 002033f..61d4f38 100644 --- a/tests/auto/q3accel/q3accel.pro +++ b/tests/auto/q3accel/q3accel.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3accel.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3action/q3action.pro b/tests/auto/q3action/q3action.pro index ee5d780..c85a158 100644 --- a/tests/auto/q3action/q3action.pro +++ b/tests/auto/q3action/q3action.pro @@ -1,3 +1,4 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3action.cpp diff --git a/tests/auto/q3actiongroup/q3actiongroup.pro b/tests/auto/q3actiongroup/q3actiongroup.pro index bfe1f68..139e48c 100644 --- a/tests/auto/q3actiongroup/q3actiongroup.pro +++ b/tests/auto/q3actiongroup/q3actiongroup.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3actiongroup.cpp diff --git a/tests/auto/q3buttongroup/clickLock/clickLock.pro b/tests/auto/q3buttongroup/clickLock/clickLock.pro index 68f5ed2..a1aa105 100644 --- a/tests/auto/q3buttongroup/clickLock/clickLock.pro +++ b/tests/auto/q3buttongroup/clickLock/clickLock.pro @@ -3,7 +3,8 @@ TEMPLATE = app win32:TARGET = ../clickLock !win32:TARGET = clickLock -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) DEPENDPATH += . INCLUDEPATH += . CONFIG -= app_bundle diff --git a/tests/auto/q3buttongroup/tst_q3buttongroup.pro b/tests/auto/q3buttongroup/tst_q3buttongroup.pro index 8ec25d0..9f1f090 100644 --- a/tests/auto/q3buttongroup/tst_q3buttongroup.pro +++ b/tests/auto/q3buttongroup/tst_q3buttongroup.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) # Input SOURCES += tst_q3buttongroup.cpp diff --git a/tests/auto/q3canvas/q3canvas.pro b/tests/auto/q3canvas/q3canvas.pro index cac538d..70e9b88 100644 --- a/tests/auto/q3canvas/q3canvas.pro +++ b/tests/auto/q3canvas/q3canvas.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3canvas.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3checklistitem/q3checklistitem.pro b/tests/auto/q3checklistitem/q3checklistitem.pro index 77d96e8..9ae9c55 100644 --- a/tests/auto/q3checklistitem/q3checklistitem.pro +++ b/tests/auto/q3checklistitem/q3checklistitem.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3checklistitem.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3combobox/q3combobox.pro b/tests/auto/q3combobox/q3combobox.pro index 2391f6c..7dcde2b 100644 --- a/tests/auto/q3combobox/q3combobox.pro +++ b/tests/auto/q3combobox/q3combobox.pro @@ -1,3 +1,4 @@ load(qttest_p4) SOURCES += tst_q3combobox.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3cstring/q3cstring.pro b/tests/auto/q3cstring/q3cstring.pro index 78077b8..1171093 100644 --- a/tests/auto/q3cstring/q3cstring.pro +++ b/tests/auto/q3cstring/q3cstring.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3cstring.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3databrowser/q3databrowser.pro b/tests/auto/q3databrowser/q3databrowser.pro index 09c16b7..d65a5ef 100644 --- a/tests/auto/q3databrowser/q3databrowser.pro +++ b/tests/auto/q3databrowser/q3databrowser.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3databrowser.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dateedit/q3dateedit.pro b/tests/auto/q3dateedit/q3dateedit.pro index ba585ce..85e0ebf 100644 --- a/tests/auto/q3dateedit/q3dateedit.pro +++ b/tests/auto/q3dateedit/q3dateedit.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3dateedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3datetimeedit/q3datetimeedit.pro b/tests/auto/q3datetimeedit/q3datetimeedit.pro index f2c0097..9c980be 100644 --- a/tests/auto/q3datetimeedit/q3datetimeedit.pro +++ b/tests/auto/q3datetimeedit/q3datetimeedit.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3datetimeedit.cpp diff --git a/tests/auto/q3deepcopy/q3deepcopy.pro b/tests/auto/q3deepcopy/q3deepcopy.pro index 04e0690..9ac1a10 100644 --- a/tests/auto/q3deepcopy/q3deepcopy.pro +++ b/tests/auto/q3deepcopy/q3deepcopy.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3deepcopy.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dict/q3dict.pro b/tests/auto/q3dict/q3dict.pro index 5ccd875..7bbea61 100644 --- a/tests/auto/q3dict/q3dict.pro +++ b/tests/auto/q3dict/q3dict.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3dict.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dns/q3dns.pro b/tests/auto/q3dns/q3dns.pro index 10c24e5..7fd2e4c 100644 --- a/tests/auto/q3dns/q3dns.pro +++ b/tests/auto/q3dns/q3dns.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3dns.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dockwindow/q3dockwindow.pro b/tests/auto/q3dockwindow/q3dockwindow.pro index 5f23c40..1352123 100644 --- a/tests/auto/q3dockwindow/q3dockwindow.pro +++ b/tests/auto/q3dockwindow/q3dockwindow.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3dockwindow.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3filedialog/q3filedialog.pro b/tests/auto/q3filedialog/q3filedialog.pro index 2394111..f57f9c0 100644 --- a/tests/auto/q3filedialog/q3filedialog.pro +++ b/tests/auto/q3filedialog/q3filedialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3filedialog.cpp diff --git a/tests/auto/q3frame/q3frame.pro b/tests/auto/q3frame/q3frame.pro index 7f0d24f..1d1f5a7 100644 --- a/tests/auto/q3frame/q3frame.pro +++ b/tests/auto/q3frame/q3frame.pro @@ -1,4 +1,5 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3frame.cpp diff --git a/tests/auto/q3groupbox/q3groupbox.pro b/tests/auto/q3groupbox/q3groupbox.pro index 5153a25..fd4cced 100644 --- a/tests/auto/q3groupbox/q3groupbox.pro +++ b/tests/auto/q3groupbox/q3groupbox.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) # Input SOURCES += tst_q3groupbox.cpp diff --git a/tests/auto/q3hbox/q3hbox.pro b/tests/auto/q3hbox/q3hbox.pro index d5b7c65..bbd7f5b 100644 --- a/tests/auto/q3hbox/q3hbox.pro +++ b/tests/auto/q3hbox/q3hbox.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3hbox.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3header/q3header.pro b/tests/auto/q3header/q3header.pro index 64ffb0f..d1a913a 100644 --- a/tests/auto/q3header/q3header.pro +++ b/tests/auto/q3header/q3header.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3header.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3iconview/q3iconview.pro b/tests/auto/q3iconview/q3iconview.pro index 37a138b..9416c08 100644 --- a/tests/auto/q3iconview/q3iconview.pro +++ b/tests/auto/q3iconview/q3iconview.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3iconview.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listbox/q3listbox.pro b/tests/auto/q3listbox/q3listbox.pro index d193ace..dc2d197 100644 --- a/tests/auto/q3listbox/q3listbox.pro +++ b/tests/auto/q3listbox/q3listbox.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_qlistbox.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listview/q3listview.pro b/tests/auto/q3listview/q3listview.pro index 56c62d1..5d72ea6 100644 --- a/tests/auto/q3listview/q3listview.pro +++ b/tests/auto/q3listview/q3listview.pro @@ -2,4 +2,5 @@ load(qttest_p4) SOURCES += tst_q3listview.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro index 143e0c0..b50d012 100644 --- a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro +++ b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3listviewitemiterator.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3mainwindow/q3mainwindow.pro b/tests/auto/q3mainwindow/q3mainwindow.pro index 7a198d1..c4cb7c4 100644 --- a/tests/auto/q3mainwindow/q3mainwindow.pro +++ b/tests/auto/q3mainwindow/q3mainwindow.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3mainwindow.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) CONFIG += console diff --git a/tests/auto/q3popupmenu/q3popupmenu.pro b/tests/auto/q3popupmenu/q3popupmenu.pro index c9c0dd5..216722b 100644 --- a/tests/auto/q3popupmenu/q3popupmenu.pro +++ b/tests/auto/q3popupmenu/q3popupmenu.pro @@ -4,5 +4,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3popupmenu.cpp diff --git a/tests/auto/q3process/q3process.pro b/tests/auto/q3process/q3process.pro index 8dc3541..a665c2b 100644 --- a/tests/auto/q3process/q3process.pro +++ b/tests/auto/q3process/q3process.pro @@ -5,6 +5,7 @@ SUBDIRS = cat \ tst TARGET = tst_q3process QT += qt3support +requires(contains(QT_CONFIG,qt3support)) #no install rule for subdir INSTALLS = diff --git a/tests/auto/q3process/tst/tst.pro b/tests/auto/q3process/tst/tst.pro index 090d76b..359148b 100644 --- a/tests/auto/q3process/tst/tst.pro +++ b/tests/auto/q3process/tst/tst.pro @@ -11,6 +11,7 @@ win32 { } } -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3progressbar/q3progressbar.pro b/tests/auto/q3progressbar/q3progressbar.pro index b3c8864..582c39e 100644 --- a/tests/auto/q3progressbar/q3progressbar.pro +++ b/tests/auto/q3progressbar/q3progressbar.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3progressbar.cpp diff --git a/tests/auto/q3progressdialog/q3progressdialog.pro b/tests/auto/q3progressdialog/q3progressdialog.pro index 65e24ed..08528db 100644 --- a/tests/auto/q3progressdialog/q3progressdialog.pro +++ b/tests/auto/q3progressdialog/q3progressdialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3progressdialog.cpp diff --git a/tests/auto/q3ptrlist/q3ptrlist.pro b/tests/auto/q3ptrlist/q3ptrlist.pro index 186a707..d7431f4 100644 --- a/tests/auto/q3ptrlist/q3ptrlist.pro +++ b/tests/auto/q3ptrlist/q3ptrlist.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3ptrlist.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3richtext/q3richtext.pro b/tests/auto/q3richtext/q3richtext.pro index 2d4fc5a..e22fa37 100644 --- a/tests/auto/q3richtext/q3richtext.pro +++ b/tests/auto/q3richtext/q3richtext.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3richtext.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3scrollview/q3scrollview.pro b/tests/auto/q3scrollview/q3scrollview.pro index 1750e8b..d98d234 100644 --- a/tests/auto/q3scrollview/q3scrollview.pro +++ b/tests/auto/q3scrollview/q3scrollview.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_qscrollview.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3semaphore/q3semaphore.pro b/tests/auto/q3semaphore/q3semaphore.pro index ad8c154..935917d 100644 --- a/tests/auto/q3semaphore/q3semaphore.pro +++ b/tests/auto/q3semaphore/q3semaphore.pro @@ -1,5 +1,6 @@ load(qttest_p4) SOURCES += tst_q3semaphore.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3serversocket/q3serversocket.pro b/tests/auto/q3serversocket/q3serversocket.pro index 4fa9dce..4e5e364 100644 --- a/tests/auto/q3serversocket/q3serversocket.pro +++ b/tests/auto/q3serversocket/q3serversocket.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3serversocket.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3socket/q3socket.pro b/tests/auto/q3socket/q3socket.pro index a9bf0c0..a8324e9 100644 --- a/tests/auto/q3socket/q3socket.pro +++ b/tests/auto/q3socket/q3socket.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_qsocket.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3socketdevice/q3socketdevice.pro b/tests/auto/q3socketdevice/q3socketdevice.pro index c6e9e93..d2cbfb2 100644 --- a/tests/auto/q3socketdevice/q3socketdevice.pro +++ b/tests/auto/q3socketdevice/q3socketdevice.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3socketdevice.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3sqlcursor/q3sqlcursor.pro b/tests/auto/q3sqlcursor/q3sqlcursor.pro index 2844540..2d316fb 100644 --- a/tests/auto/q3sqlcursor/q3sqlcursor.pro +++ b/tests/auto/q3sqlcursor/q3sqlcursor.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3sqlcursor.cpp QT += sql qt3support +requires(contains(QT_CONFIG,qt3support)) win32:LIBS += -lws2_32 diff --git a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro index 21e311f..59448eb 100644 --- a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro +++ b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3sqlselectcursor.cpp QT += sql qt3support +requires(contains(QT_CONFIG,qt3support)) win32:LIBS += -lws2_32 diff --git a/tests/auto/q3stylesheet/q3stylesheet.pro b/tests/auto/q3stylesheet/q3stylesheet.pro index a5e8438..f0fcd8b 100644 --- a/tests/auto/q3stylesheet/q3stylesheet.pro +++ b/tests/auto/q3stylesheet/q3stylesheet.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3stylesheet.cpp diff --git a/tests/auto/q3tabdialog/q3tabdialog.pro b/tests/auto/q3tabdialog/q3tabdialog.pro index 1ba72f9..815510d 100644 --- a/tests/auto/q3tabdialog/q3tabdialog.pro +++ b/tests/auto/q3tabdialog/q3tabdialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3tabdialog.cpp diff --git a/tests/auto/q3table/q3table.pro b/tests/auto/q3table/q3table.pro index 6d96a4e..bdda8ba 100644 --- a/tests/auto/q3table/q3table.pro +++ b/tests/auto/q3table/q3table.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3table.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textbrowser/q3textbrowser.pro b/tests/auto/q3textbrowser/q3textbrowser.pro index 8ddeaba..4dfd12e 100644 --- a/tests/auto/q3textbrowser/q3textbrowser.pro +++ b/tests/auto/q3textbrowser/q3textbrowser.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3textbrowser.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textedit/q3textedit.pro b/tests/auto/q3textedit/q3textedit.pro index a4b24a9..ff90c4a 100644 --- a/tests/auto/q3textedit/q3textedit.pro +++ b/tests/auto/q3textedit/q3textedit.pro @@ -4,5 +4,6 @@ SOURCES += tst_q3textedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textstream/q3textstream.pro b/tests/auto/q3textstream/q3textstream.pro index 7c80af7..bf2584a 100644 --- a/tests/auto/q3textstream/q3textstream.pro +++ b/tests/auto/q3textstream/q3textstream.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3textstream.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) MOC_DIR=tmp diff --git a/tests/auto/q3timeedit/q3timeedit.pro b/tests/auto/q3timeedit/q3timeedit.pro index 17b4a84..0f231df 100644 --- a/tests/auto/q3timeedit/q3timeedit.pro +++ b/tests/auto/q3timeedit/q3timeedit.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3timeedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3toolbar/q3toolbar.pro b/tests/auto/q3toolbar/q3toolbar.pro index 8fcab99..974f14f 100644 --- a/tests/auto/q3toolbar/q3toolbar.pro +++ b/tests/auto/q3toolbar/q3toolbar.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3toolbar.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3uridrag/q3uridrag.pro b/tests/auto/q3uridrag/q3uridrag.pro index 526623e..b6e77fc 100644 --- a/tests/auto/q3uridrag/q3uridrag.pro +++ b/tests/auto/q3uridrag/q3uridrag.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3uridrag.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3urloperator/q3urloperator.pro b/tests/auto/q3urloperator/q3urloperator.pro index 3364dac..29282eb 100644 --- a/tests/auto/q3urloperator/q3urloperator.pro +++ b/tests/auto/q3urloperator/q3urloperator.pro @@ -2,7 +2,8 @@ load(qttest_p4) SOURCES += tst_q3urloperator.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) QT += network diff --git a/tests/auto/q3valuelist/q3valuelist.pro b/tests/auto/q3valuelist/q3valuelist.pro index ab82d31..d359779 100644 --- a/tests/auto/q3valuelist/q3valuelist.pro +++ b/tests/auto/q3valuelist/q3valuelist.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3valuelist.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3valuevector/q3valuevector.pro b/tests/auto/q3valuevector/q3valuevector.pro index 883fda2..55956cb 100644 --- a/tests/auto/q3valuevector/q3valuevector.pro +++ b/tests/auto/q3valuevector/q3valuevector.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3valuevector.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3widgetstack/q3widgetstack.pro b/tests/auto/q3widgetstack/q3widgetstack.pro index 9783f58..1bd6a89 100644 --- a/tests/auto/q3widgetstack/q3widgetstack.pro +++ b/tests/auto/q3widgetstack/q3widgetstack.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3widgetstack.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index f6f1a07..738384d 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -143,6 +143,9 @@ private slots: void task246056_setCompletionPrefix(); void task250064_lostFocus(); + void task253125_lineEditCompletion_data(); + void task253125_lineEditCompletion(); + private: void filter(); void testRowCount(); @@ -1187,5 +1190,48 @@ void tst_QCompleter::task250064_lostFocus() QCOMPARE(textEdit->focusPolicy(), origPolicy); } +void tst_QCompleter::task253125_lineEditCompletion_data() +{ + QTest::addColumn<QStringList>("list"); + QTest::addColumn<int>("completionMode"); + + QStringList list = QStringList() + << "alpha" << "beta" << "gamma" << "delta" << "epsilon" << "zeta" + << "eta" << "theta" << "iota" << "kappa" << "lambda" << "mu" + << "nu" << "xi" << "omicron" << "pi" << "rho" << "sigma" + << "tau" << "upsilon" << "phi" << "chi" << "psi" << "omega"; + + QTest::newRow("Inline") << list << (int)QCompleter::InlineCompletion; + QTest::newRow("Filtered") << list << (int)QCompleter::PopupCompletion; + QTest::newRow("Unfiltered") << list << (int)QCompleter::UnfilteredPopupCompletion; +} + +void tst_QCompleter::task253125_lineEditCompletion() +{ + QFETCH(QStringList, list); + QFETCH(int, completionMode); + + QStringListModel *model = new QStringListModel; + model->setStringList(list); + + QCompleter *completer = new QCompleter(list); + completer->setModel(model); + completer->setCompletionMode((QCompleter::CompletionMode)completionMode); + + QLineEdit edit; + edit.setCompleter(completer); + edit.show(); + edit.setFocus(); + + QTest::qWait(100); + + QTest::keyClick(&edit, 'i'); + QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("iota")); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp index 58707f1..947e8d6 100644 --- a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp +++ b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp @@ -90,6 +90,8 @@ private Q_SLOTS: void watcher(); void watcher_error(); void watcher_waitForFinished(); + void watcher_waitForFinished_alreadyFinished(); + void watcher_waitForFinished_alreadyFinished_eventLoop(); void watcher_waitForFinished_error(); void callInsideWaitForFinished(); @@ -375,6 +377,77 @@ void tst_QDBusPendingCall::watcher_waitForFinished() QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); } +void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished() +{ + QDBusPendingCall ac = sendMessage(); + QVERIFY(!ac.isFinished()); + QVERIFY(!ac.isError()); + QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); + + ac.waitForFinished(); + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + callCount = 0; + watchArgument = 0; + + // create a watcher on an already-finished reply + QDBusPendingCallWatcher watch(ac); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + SLOT(finished(QDBusPendingCallWatcher*))); + + watch.waitForFinished(); + + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + QCOMPARE(callCount, 1); + QCOMPARE(slotCalled, (int)FinishCalled); + QCOMPARE(watchArgument, &watch); + QVERIFY(!watch.isError()); + + const QVariantList args2 = ac.reply().arguments(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); +} + +void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop() +{ + QDBusPendingCall ac = sendMessage(); + QVERIFY(!ac.isFinished()); + QVERIFY(!ac.isError()); + QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); + + ac.waitForFinished(); + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + callCount = 0; + watchArgument = 0; + + // create a watcher on an already-finished reply + QDBusPendingCallWatcher watch(ac); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + SLOT(finished(QDBusPendingCallWatcher*))); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + QCOMPARE(callCount, 1); + QCOMPARE(slotCalled, (int)FinishCalled); + QCOMPARE(watchArgument, &watch); + QVERIFY(!watch.isError()); + + const QVariantList args2 = ac.reply().arguments(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); +} + void tst_QDBusPendingCall::watcher_waitForFinished_error() { QDBusPendingCall ac = sendError(); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 77b7948..6d150cb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -78,8 +78,7 @@ Q_DECLARE_METATYPE(QRectF) class EventTester : public QGraphicsItem { public: - EventTester() - : repaints(0) + EventTester(QGraphicsItem *parent = 0) : QGraphicsItem(parent), repaints(0) { br = QRectF(-10, -10, 20, 20); } void setGeometry(const QRectF &rect) @@ -207,6 +206,7 @@ private slots: void itemTransform_unrelated(); void opacity_data(); void opacity(); + void opacity2(); void itemStacksBehindParent(); void nestedClipping(); void nestedClippingTransforms(); @@ -5570,6 +5570,91 @@ void tst_QGraphicsItem::opacity() QCOMPARE(c3->effectiveOpacity(), c3_effectiveOpacity); } +void tst_QGraphicsItem::opacity2() +{ + EventTester *parent = new EventTester; + EventTester *child = new EventTester(parent); + EventTester *grandChild = new EventTester(child); + + QGraphicsScene scene; + scene.addItem(parent); + + class MyGraphicsView : public QGraphicsView + { public: + int repaints; + MyGraphicsView(QGraphicsScene *scene) : QGraphicsView(scene), repaints(0) {} + void paintEvent(QPaintEvent *e) { ++repaints; QGraphicsView::paintEvent(e); } + }; + + MyGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(250); + +#define RESET_REPAINT_COUNTERS \ + parent->repaints = 0; \ + child->repaints = 0; \ + grandChild->repaints = 0; \ + view.repaints = 0; + + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); + + RESET_REPAINT_COUNTERS + + child->setOpacity(1.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 1); + QCOMPARE(grandChild->repaints, 1); + + RESET_REPAINT_COUNTERS + + parent->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 0); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); + + RESET_REPAINT_COUNTERS + + parent->setOpacity(1.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 1); + QCOMPARE(grandChild->repaints, 1); + + grandChild->setFlag(QGraphicsItem::ItemIgnoresParentOpacity); + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 1); + + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); // Already 0.0; no change. + QTest::qWait(100); + QCOMPARE(view.repaints, 0); + QCOMPARE(parent->repaints, 0); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); +} + void tst_QGraphicsItem::itemStacksBehindParent() { QGraphicsRectItem *parent1 = new QGraphicsRectItem(QRectF(0, 0, 100, 50)); diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp index 31a5391..0760ce8 100644 --- a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp +++ b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp @@ -59,6 +59,7 @@ public: private slots: void getSetCheck(); + void capabilitiesPerType(); }; tst_QNetworkProxy::tst_QNetworkProxy() @@ -79,6 +80,38 @@ void tst_QNetworkProxy::getSetCheck() QCOMPARE(quint16(0), obj1.port()); obj1.setPort(quint16(0xffff)); QCOMPARE(quint16(0xffff), obj1.port()); + + obj1.setType(QNetworkProxy::DefaultProxy); + QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy); + obj1.setType(QNetworkProxy::HttpProxy); + QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy); + obj1.setType(QNetworkProxy::Socks5Proxy); + QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy); +} + +void tst_QNetworkProxy::capabilitiesPerType() +{ + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy); + QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability); + QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability); + QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability); + + proxy.setType(QNetworkProxy::NoProxy); + // verify that the capabilities changed + QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability)); + QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability); + + proxy.setType(QNetworkProxy::HttpProxy); + QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability); + QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability)); + + // now set the capabilities on stone: + proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); + QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); + + // changing the type shouldn't change the capabilities any more + proxy.setType(QNetworkProxy::Socks5Proxy); + QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); } QTEST_MAIN(tst_QNetworkProxy) diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index a598bfc..cde4ae5 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -103,6 +103,7 @@ private slots: void valuePreservation(); void errorReporting(); void testCustomPageSizes(); + void printDialogCompleter(); private: }; @@ -940,5 +941,22 @@ void tst_QPrinter::testCustomPageSizes() QCOMPARE(paperSize, customSize); } +void tst_QPrinter::printDialogCompleter() +{ +#if defined(QT_NO_COMPLETER) || defined(QT_NO_FILEDIALOG) + QSKIP("QT_NO_COMPLETER || QT_NO_FILEDIALOG: Auto-complete turned off in QPrinterDialog.", QTest::SkipAll); +#else + QPrintDialog dialog; + dialog.printer()->setOutputFileName("file.pdf"); + dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile); + dialog.show(); + + QTest::qWait(100); + + QTest::keyClick(0, Qt::Key_Tab); + QTest::keyClick(0, 'P'); +#endif +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 665cfde..66cf81f 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -517,6 +517,8 @@ void tst_QSqlDatabase::tables() // MySQL doesn't give back anything when calling QSqlDatabase::tables() with QSql::Views // May be fixable by doing a select on informational_schema.views instead of using the client library api QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue); + if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)) + qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables; QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); } if (tempTables) @@ -1881,17 +1883,26 @@ void tst_QSqlDatabase::ibase_procWithReturnValues() "\nRESULT INTEGER)" "\nAS" "\nbegin" - "\nRESULT = 10;" + "\nRESULT = 10 * ABC;" "\nsuspend;" "\nend")); // Interbase procedures can be executed in two ways: EXECUTE PROCEDURE or SELECT QVERIFY_SQL(q, exec(QString("execute procedure %1(123)").arg(procName))); QVERIFY_SQL(q, next()); - QCOMPARE(q.value(0).toInt(), 10); + QCOMPARE(q.value(0).toInt(), 1230); QVERIFY_SQL(q, exec(QString("select result from %1(456)").arg(procName))); QVERIFY_SQL(q, next()); - QCOMPARE(q.value(0).toInt(), 10); + QCOMPARE(q.value(0).toInt(), 4560); + QVERIFY_SQL(q, prepare(QLatin1String("execute procedure ")+procName+QLatin1String("(?)"))); + q.bindValue(0, 123); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1230); + q.bindValue(0, 456); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 4560); q.exec(QString("drop procedure %1").arg(procName)); } @@ -2277,7 +2288,7 @@ void tst_QSqlDatabase::db2_valueCacheUpdate() void tst_QSqlDatabase::sqlStatementUseIsNull_189093() { - // NULL = NULL is unknow, the sqlStatment must use IS NULL + // NULL = NULL is unknown, the sqlStatment must use IS NULL QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro index 6b1d66d..bde990a 100644 --- a/tests/auto/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro @@ -1,3 +1,5 @@ load(qttest_p4) SOURCES += tst_qtemporaryfile.cpp QT = core + +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index c5afe04..8cae64e 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -51,6 +51,13 @@ #if defined(Q_OS_WIN) # include <windows.h> #endif +#if defined(Q_OS_UNIX) +# include <sys/types.h> +# include <sys/stat.h> +# include <errno.h> +# include <fcntl.h> // open(2) +# include <unistd.h> // close(2) +#endif //TESTED_CLASS= //TESTED_FILES= @@ -78,6 +85,7 @@ private slots: void openOnRootDrives(); void stressTest(); void rename(); + void renameFdLeak(); public: }; @@ -356,5 +364,42 @@ void tst_QTemporaryFile::rename() QVERIFY(!dir.exists("temporary-file.txt")); } +void tst_QTemporaryFile::renameFdLeak() +{ +#ifdef Q_OS_UNIX + // Test this on Unix only + + // Open a bunch of files to force the fd count to go up + static const int count = 10; + int bunch_of_files[count]; + for (int i = 0; i < count; ++i) { + bunch_of_files[i] = ::open(SRCDIR "tst_qtemporaryfile.cpp", O_RDONLY); + QVERIFY(bunch_of_files[i] != -1); + } + + int fd; + { + QTemporaryFile file; + file.setAutoRemove(false); + QVERIFY(file.open()); + + // close the bunch of files + for (int i = 0; i < count; ++i) + ::close(bunch_of_files[i]); + + // save the file descriptor for later + fd = file.handle(); + + // rename the file to something + QString newPath = QDir::tempPath() + "/tst_qtemporaryfile-renameFdLeak-" + QString::number(getpid()); + file.rename(newPath); + QFile::remove(newPath); + } + + // check if QTemporaryFile closed the file + QVERIFY(::close(fd) == -1 && errno == EBADF); +#endif +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 6b994cd..8a181c6 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -294,6 +294,7 @@ private slots: void render_systemClip2(); void render_systemClip3_data(); void render_systemClip3(); + void render_task252837(); void setContentsMargins(); @@ -7162,6 +7163,16 @@ void tst_QWidget::render_systemClip3() } } +void tst_QWidget::render_task252837() +{ + QWidget widget; + widget.resize(200, 200); + + QPixmap pixmap(widget.size()); + QPainter painter(&pixmap); + // Please do not crash. + widget.render(&painter); +} void tst_QWidget::setContentsMargins() { QLabel label("why does it always rain on me?"); diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 4390a10..b78f346 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -262,8 +262,9 @@ CentralWidget::~CentralWidget() QString zoomCount; QString currentPages; QLatin1Char separator('|'); - int i = m_searchWidget->isAttached() ? 1 : 0; + bool searchAttached = m_searchWidget->isAttached(); + int i = searchAttached ? 1 : 0; for (; i < tabWidget->count(); ++i) { HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i)); if (viewer && viewer->source().isValid()) { @@ -274,6 +275,7 @@ CentralWidget::~CentralWidget() engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage); engine.setCustomValue(QLatin1String("LastShownPages"), currentPages); + engine.setCustomValue(QLatin1String("SearchWasAttached"), searchAttached); #if !defined(QT_NO_WEBKIT) engine.setCustomValue(QLatin1String("LastPagesZoomWebView"), zoomCount); #else @@ -418,7 +420,18 @@ void CentralWidget::setLastShownPages() setSourceInNewTab((*it), (*zIt).toFloat()); const QLatin1String lastTab("LastTabPage"); - tabWidget->setCurrentIndex(helpEngine->customValue(lastTab, 1).toInt()); + int tab = helpEngine->customValue(lastTab, 1).toInt(); + + const QLatin1String searchKey("SearchWasAttached"); + const bool searchIsAttached = m_searchWidget->isAttached(); + const bool searchWasAttached = helpEngine->customValue(searchKey).toBool(); + + if (searchWasAttached && !searchIsAttached) + tabWidget->setCurrentIndex(--tab); + else if (!searchWasAttached && searchIsAttached) + tabWidget->setCurrentIndex(++tab); + else + tabWidget->setCurrentIndex(tab); } bool CentralWidget::hasSelection() const @@ -797,7 +810,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e) } } - if (QTabBar *tabBar = qobject_cast<QTabBar*>(object)) { + if (qobject_cast<QTabBar*>(object)) { const bool dblClick = e->type() == QEvent::MouseButtonDblClick; if ((e->type() == QEvent::MouseButtonRelease) || dblClick) { QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e); @@ -978,22 +991,29 @@ void CentralWidget::updateBrowserFont() void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) { - if (!m_searchWidget) { - m_searchWidget = new SearchWidget(searchEngine, this); - connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), this, - SLOT(setSourceFromSearch(QUrl))); - connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, - SLOT(setSourceFromSearchInNewTab(QUrl))); - } - tabWidget->insertTab(0, m_searchWidget, tr("Search")); - m_searchWidget->setAttached(true); + if (m_searchWidget) + return; + + m_searchWidget = new SearchWidget(searchEngine, this); + connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), this, + SLOT(setSourceFromSearch(QUrl))); + connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, + SLOT(setSourceFromSearchInNewTab(QUrl))); } -void CentralWidget::activateSearchWidget() +void CentralWidget::activateSearchWidget(bool updateLastTabPage) { - if (!m_searchWidget->isAttached()) + if (!m_searchWidget) createSearchWidget(helpEngine->searchEngine()); + if (!m_searchWidget->isAttached()) { + tabWidget->insertTab(0, m_searchWidget, tr("Search")); + m_searchWidget->setAttached(true); + + if (updateLastTabPage) + lastTabPage++; + } + tabWidget->setCurrentWidget(m_searchWidget); m_searchWidget->setFocus(); } diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index 2c28091..e3ce200 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -118,7 +118,7 @@ public: void activateTab(bool onlyHelpViewer = false); void createSearchWidget(QHelpSearchEngine *searchEngine); - void activateSearchWidget(); + void activateSearchWidget(bool updateLastTabPage = false); void removeSearchWidget(); int availableHelpViewer() const; diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index 0dae785..67eaa44 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -56,6 +56,7 @@ CmdLineParser::CmdLineParser() m_bookmarks(Untouched), m_search(Untouched), m_register(None), + m_removeSearchIndex(false), m_copy(false), m_quiet(false) { @@ -83,6 +84,7 @@ CmdLineParser::CmdLineParser() " (.qch) from the give collection\n" " file.\n" "-setCurrentFilter filter Set the filter as the active filter.\n" + "-remove-search-index Removes the full text search index.\n" "-quiet Does not display any error or\n" " status message.\n" "-help Displays this help.\n" @@ -217,6 +219,8 @@ CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments) error = QObject::tr("Missing filter argument!"); break; } + } else if (arg == QLatin1String("-remove-search-index")) { + m_removeSearchIndex = true; } else if (arg == QLatin1String("-quiet")) { continue; } else if (arg == QLatin1String("-help")) { @@ -307,6 +311,11 @@ QString CmdLineParser::currentFilter() const return m_currentFilter; } +bool CmdLineParser::removeSearchIndex() const +{ + return m_removeSearchIndex; +} + CmdLineParser::RegisterState CmdLineParser::registerRequest() const { return m_register; diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h index 332d464..263138b 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.h +++ b/tools/assistant/tools/assistant/cmdlineparser.h @@ -67,6 +67,7 @@ public: ShowState bookmarks() const; ShowState search() const; QString currentFilter() const; + bool removeSearchIndex() const; RegisterState registerRequest() const; QString helpFile() const; @@ -90,6 +91,7 @@ private: ShowState m_search; RegisterState m_register; QString m_currentFilter; + bool m_removeSearchIndex; bool m_copy; bool m_quiet; }; diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 794be02..75955ec 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -52,6 +52,8 @@ #include <QtHelp/QHelpEngineCore> +#include <QtNetwork/QLocalSocket> + #include <QtSql/QSqlDatabase> #include "mainwindow.h" @@ -166,6 +168,17 @@ referencedHelpFilesExistAll(QHelpEngineCore& user, QStringList& nameSpaces) return (counter != nameSpaces.count()) ? false : true; } +QString indexFilesFolder(const QString &collectionFile) +{ + QString indexFilesFolder = QLatin1String(".fulltextsearch"); + if (!collectionFile.isEmpty()) { + QFileInfo fi(collectionFile); + indexFilesFolder = QLatin1Char('.') + + fi.fileName().left(fi.fileName().lastIndexOf(QLatin1String(".qhc"))); + } + return indexFilesFolder; +} + int main(int argc, char *argv[]) { QApplication a(argc, argv); @@ -212,6 +225,28 @@ int main(int argc, char *argv[]) return 0; } + if (cmd.removeSearchIndex()) { + QString file = cmdCollectionFile; + if (file.isEmpty()) + file = MainWindow::defaultHelpCollectionFileName(); + QString path = QFileInfo(file).path(); + path += QLatin1String("/") + indexFilesFolder(file); + + QLocalSocket localSocket; + localSocket.connectToServer(QString(QLatin1String("QtAssistant%1")) + .arg(QLatin1String(QT_VERSION_STR))); + + QDir dir(path); // check if there is no other instance ruinning + if (!localSocket.waitForConnected() && dir.exists()) { + QStringList lst = dir.entryList(QDir::Files | QDir::Hidden); + foreach (const QString &item, lst) + dir.remove(item); + return 0; + } else { + return -1; + } + } + { QSqlDatabase db; QStringList sqlDrivers(db.drivers()); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 426a828..b0c2c6b 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -126,6 +126,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished())); m_centralWidget->createSearchWidget(searchEngine); + m_centralWidget->activateSearchWidget(); QString defWindowTitle = tr("Qt Assistant"); setWindowTitle(defWindowTitle); @@ -234,6 +235,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) else checkInitState(); } + setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); } MainWindow::~MainWindow() @@ -461,7 +463,7 @@ void MainWindow::setupActions() QKeySequence(tr("ALT+I"))); m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarks()), QKeySequence(tr("ALT+O"))); - m_viewMenu->addAction(tr("Search"), this, SLOT(showSearch()), + m_viewMenu->addAction(tr("Search"), this, SLOT(showSearchWidget()), QKeySequence(tr("ALT+S"))); menu = menuBar()->addMenu(tr("&Go")); @@ -880,6 +882,11 @@ void MainWindow::showSearch() m_centralWidget->activateSearchWidget(); } +void MainWindow::showSearchWidget() +{ + m_centralWidget->activateSearchWidget(true); +} + void MainWindow::hideSearch() { m_centralWidget->removeSearchWidget(); diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 7d08a74..d7f5c69 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -92,6 +92,7 @@ public slots: void showIndex(); void showBookmarks(); void showSearch(); + void showSearchWidget(); void syncContents(); void activateCurrentCentralWidgetTab(); diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index 094bd9c..74f7ba8 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -44,6 +44,7 @@ #include "installdialog.h" #include "fontpanel.h" #include "centralwidget.h" +#include "aboutdialog.h" #include <QtAlgorithms> @@ -52,6 +53,8 @@ #include <QtGui/QMessageBox> #include <QtGui/QMenu> #include <QtGui/QFontDatabase> +#include <QtGui/QApplication> +#include <QtGui/QDesktopWidget> #include <QtHelp/QHelpEngineCore> @@ -59,36 +62,38 @@ QT_BEGIN_NAMESPACE PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent) : QDialog(parent) + , m_helpEngine(helpEngine) , m_appFontChanged(false) , m_browserFontChanged(false) { - m_helpEngine = helpEngine; m_ui.setupUi(this); - connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), - SIGNAL(clicked()), this, SLOT(applyChanges())); - connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), - SIGNAL(clicked()), this, SLOT(reject())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), + this, SLOT(applyChanges())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), + this, SLOT(reject())); - m_hideFiltersTab = !m_helpEngine->customValue(QLatin1String("EnableFilterFunctionality"), - true).toBool(); - m_hideDocsTab = !m_helpEngine->customValue(QLatin1String("EnableDocumentationManager"), - true).toBool(); + QLatin1String key("EnableFilterFunctionality"); + m_hideFiltersTab = !m_helpEngine->customValue(key, true).toBool(); + + key = QLatin1String("EnableDocumentationManager"); + m_hideDocsTab = !m_helpEngine->customValue(key, true).toBool(); if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); m_ui.attributeWidget->setRootIsDecorated(false); + connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(updateFilterMap())); connect(m_ui.filterWidget, - SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(updateAttributes(QListWidgetItem*))); + SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, + SLOT(updateAttributes(QListWidgetItem*))); - connect(m_ui.filterAddButton, SIGNAL(clicked()), - this, SLOT(addFilter())); - connect(m_ui.filterRemoveButton, SIGNAL(clicked()), - this, SLOT(removeFilter())); + connect(m_ui.filterAddButton, SIGNAL(clicked()), this, + SLOT(addFilter())); + connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this, + SLOT(removeFilter())); updateFilterPage(); } else { @@ -106,22 +111,34 @@ PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *paren } else { m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.docsTab)); } + updateFontSettingsPage(); updateOptionsPage(); } PreferencesDialog::~PreferencesDialog() { + QLatin1String key(""); if (m_appFontChanged) { - m_helpEngine->setCustomValue(QLatin1String("appFont"), m_appFontPanel->selectedFont()); - m_helpEngine->setCustomValue(QLatin1String("useAppFont"), m_appFontPanel->isChecked()); - m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), m_appFontPanel->writingSystem()); + key = QLatin1String("appFont"); + m_helpEngine->setCustomValue(key, m_appFontPanel->selectedFont()); + + key = QLatin1String("useAppFont"); + m_helpEngine->setCustomValue(key, m_appFontPanel->isChecked()); + + key = QLatin1String("appWritingSystem"); + m_helpEngine->setCustomValue(key, m_appFontPanel->writingSystem()); } if (m_browserFontChanged) { - m_helpEngine->setCustomValue(QLatin1String("browserFont"), m_browserFontPanel->selectedFont()); - m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), m_browserFontPanel->isChecked()); - m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), m_browserFontPanel->writingSystem()); + key = QLatin1String("browserFont"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->selectedFont()); + + key = QLatin1String("useBrowserFont"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->isChecked()); + + key = QLatin1String("browserWritingSystem"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->writingSystem()); } if (m_appFontChanged || m_browserFontChanged) { @@ -129,8 +146,10 @@ PreferencesDialog::~PreferencesDialog() emit updateBrowserFont(); } - if (!m_ui.homePageLineEdit->text().isEmpty()) - m_helpEngine->setCustomValue(QLatin1String("homepage"), m_ui.homePageLineEdit->text()); + if (!m_ui.homePageLineEdit->text().isEmpty()) { + key = QLatin1String("homepage"); + m_helpEngine->setCustomValue(key, m_ui.homePageLineEdit->text()); + } } void PreferencesDialog::showDialog() @@ -173,7 +192,7 @@ void PreferencesDialog::updateAttributes(QListWidgetItem *item) if (item) checkedList = m_filterMap.value(item->text()); QTreeWidgetItem *itm; - for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) { + for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) { itm = m_ui.attributeWidget->topLevelItem(i); if (checkedList.contains(itm->text(0))) itm->setCheckState(0, Qt::Checked); @@ -192,7 +211,7 @@ void PreferencesDialog::updateFilterMap() QStringList newAtts; QTreeWidgetItem *itm = 0; - for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) { + for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) { itm = m_ui.attributeWidget->topLevelItem(i); if (itm->checkState(0) == Qt::Checked) newAtts.append(itm->text(0)); @@ -219,8 +238,8 @@ void PreferencesDialog::addFilter() void PreferencesDialog::removeFilter() { - QListWidgetItem *item = m_ui.filterWidget - ->takeItem(m_ui.filterWidget->currentRow()); + QListWidgetItem *item = + m_ui.filterWidget ->takeItem(m_ui.filterWidget->currentRow()); if (!item) return; @@ -238,25 +257,48 @@ void PreferencesDialog::addDocumentationLocal() if (fileNames.isEmpty()) return; + QStringList invalidFiles; + QStringList alreadyRegistered; foreach (const QString &fileName, fileNames) { - const QString ns = QHelpEngineCore::namespaceName(fileName); - if (ns.isEmpty()) { - QMessageBox::warning(this, tr("Add Documentation"), - tr("The specified file is not a valid Qt Help File!")); + const QString nameSpace = QHelpEngineCore::namespaceName(fileName); + if (nameSpace.isEmpty()) { + invalidFiles.append(fileName); continue; } - if (m_ui.registeredDocsListWidget->findItems(ns, Qt::MatchFixedString).count()) { - QMessageBox::warning(this, tr("Add Documentation"), - tr("The namespace %1 is already registered!").arg(ns)); - continue; + if (m_ui.registeredDocsListWidget->findItems(nameSpace, + Qt::MatchFixedString).count()) { + alreadyRegistered.append(nameSpace); + continue; } m_helpEngine->registerDocumentation(fileName); - m_ui.registeredDocsListWidget->addItem(ns); - m_regDocs.append(ns); - m_unregDocs.removeAll(ns); + m_ui.registeredDocsListWidget->addItem(nameSpace); + m_regDocs.append(nameSpace); + m_unregDocs.removeAll(nameSpace); + } + + if (!invalidFiles.isEmpty() || !alreadyRegistered.isEmpty()) { + QString message; + if (!alreadyRegistered.isEmpty()) { + foreach (const QString &ns, alreadyRegistered) { + message += tr("The namespace %1 is already registered!") + .arg(QString("<b>%1</b>").arg(ns)) + QLatin1String("<br>"); + } + if (!invalidFiles.isEmpty()) + message.append(QLatin1String("<br>")); + } + + if (!invalidFiles.isEmpty()) { + message += tr("The specified file is not a valid Qt Help File!"); + message.append(QLatin1String("<ul>")); + foreach (const QString &file, invalidFiles) + message += QLatin1String("<li>") + file + QLatin1String("</li>"); + message.append(QLatin1String("</ul>")); + } + QMessageBox::warning(this, tr("Add Documentation"), message); } + updateFilterPage(); } @@ -362,35 +404,50 @@ void PreferencesDialog::updateFontSettingsPage() m_ui.stackedWidget_2->setCurrentIndex(0); const QString customSettings(tr("Use custom settings")); - QFont font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("appFont"))); - QFontDatabase::WritingSystem writingSystem = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(QLatin1String("appWritingSystem")).toInt()); - m_appFontPanel->setTitle(customSettings); + + QLatin1String key = QLatin1String("appFont"); + QFont font = qVariantValue<QFont>(m_helpEngine->customValue(key)); m_appFontPanel->setSelectedFont(font); - m_appFontPanel->setWritingSystem(writingSystem); - m_appFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useAppFont")).toBool()); - QFont font2 = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("browserFont"))); - writingSystem = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(QLatin1String("browserWritingSystem")).toInt()); + key = QLatin1String("appWritingSystem"); + QFontDatabase::WritingSystem system = static_cast<QFontDatabase::WritingSystem> + (m_helpEngine->customValue(key).toInt()); + m_appFontPanel->setWritingSystem(system); + + key = QLatin1String("useAppFont"); + m_appFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); m_browserFontPanel->setTitle(customSettings); - m_browserFontPanel->setSelectedFont(font2); - m_browserFontPanel->setWritingSystem(writingSystem); - m_browserFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()); - connect(m_appFontPanel, SIGNAL(toggled(bool)), this, SLOT(appFontSettingToggled(bool))); - connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, SLOT(browserFontSettingToggled(bool))); + key = QLatin1String("browserFont"); + font = qVariantValue<QFont>(m_helpEngine->customValue(key)); + m_browserFontPanel->setSelectedFont(font); + + key = QLatin1String("browserWritingSystem"); + system = static_cast<QFontDatabase::WritingSystem> + (m_helpEngine->customValue(key).toInt()); + m_browserFontPanel->setWritingSystem(system); + + key = QLatin1String("useBrowserFont"); + m_browserFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); + + connect(m_appFontPanel, SIGNAL(toggled(bool)), this, + SLOT(appFontSettingToggled(bool))); + connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, + SLOT(browserFontSettingToggled(bool))); QList<QComboBox*> allCombos = qFindChildren<QComboBox*>(m_appFontPanel); - foreach (QComboBox* box, allCombos) - connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(appFontSettingChanged(int))); + foreach (QComboBox* box, allCombos) { + connect(box, SIGNAL(currentIndexChanged(int)), this, + SLOT(appFontSettingChanged(int))); + } - allCombos.clear(); allCombos = qFindChildren<QComboBox*>(m_browserFontPanel); - foreach (QComboBox* box, allCombos) - connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(browserFontSettingChanged(int))); + foreach (QComboBox* box, allCombos) { + connect(box, SIGNAL(currentIndexChanged(int)), this, + SLOT(browserFontSettingChanged(int))); + } } void PreferencesDialog::appFontSettingToggled(bool on) @@ -436,8 +493,8 @@ void PreferencesDialog::updateOptionsPage() void PreferencesDialog::restoreDefaultHomepage() { - QString homepage = m_helpEngine->customValue( - QLatin1String("defaultHomepage"), QLatin1String("help")).toString(); + QString homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"), + QLatin1String("help")).toString(); m_ui.homePageLineEdit->setText(homepage); } |