diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 27 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qdirmodel.cpp | 5 | ||||
-rw-r--r-- | src/gui/itemviews/qfileiconprovider.cpp | 37 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qws.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 12 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_qws.cpp | 3 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 6 |
8 files changed, 67 insertions, 33 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 849f4b3..8b4e1b1 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1604,12 +1604,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent, args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - //If workingDirectory returned a different path than the initial one, - //it means that the initial path was invalid. There is no point to try select a file - if (args.directory != QFileInfo(dir).path()) - args.selection = QString(); - else - args.selection = QFileDialogPrivate::initialSelection(dir); + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFile; args.options = options; @@ -1687,18 +1682,13 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, QString *selectedFilter, Options options) { - if (qt_filedialog_open_filenames_hook) + if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog)) return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options); QFileDialogArgs args; args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - //If workingDirectory returned a different path than the initial one, - //it means that the initial path was invalid. There is no point to try select a file - if (args.directory != QFileInfo(dir).path()) - args.selection = QString(); - else - args.selection = QFileDialogPrivate::initialSelection(dir); + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = ExistingFiles; args.options = options; @@ -1778,18 +1768,13 @@ QString QFileDialog::getSaveFileName(QWidget *parent, QString *selectedFilter, Options options) { - if (qt_filedialog_save_filename_hook) + if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog)) return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options); QFileDialogArgs args; args.parent = parent; args.caption = caption; args.directory = QFileDialogPrivate::workingDirectory(dir); - //If workingDirectory returned a different path than the initial one, - //it means that the initial path was invalid. There is no point to try select a file - if (args.directory != QFileInfo(dir).path()) - args.selection = QString(); - else - args.selection = QFileDialogPrivate::initialSelection(dir); + args.selection = QFileDialogPrivate::initialSelection(dir); args.filter = filter; args.mode = AnyFile; args.options = options; @@ -1858,7 +1843,7 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, const QString &dir, Options options) { - if (qt_filedialog_existing_directory_hook) + if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog)) return qt_filedialog_existing_directory_hook(parent, caption, dir, options); QFileDialogArgs args; args.parent = parent; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 6ef226d..53b044c 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -3129,7 +3129,7 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event) } } else #endif - if (d->dragMode == QGraphicsView::ScrollHandDrag) { + if (d->dragMode == QGraphicsView::ScrollHandDrag && event->button() == Qt::LeftButton) { #ifndef QT_NO_CURSOR // Restore the open hand cursor. ### There might be items // under the mouse that have a valid cursor at this time, so diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp index c25149b..c5618b6 100644 --- a/src/gui/itemviews/qdirmodel.cpp +++ b/src/gui/itemviews/qdirmodel.cpp @@ -228,7 +228,10 @@ void QDirModelPrivate::invalidate() \note QDirModel requires an instance of a GUI application. - \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, + \note The usage of QDirModel is not recommended anymore. The + QFileSystemModel class is a more performant alternative. + + \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel {Dir View Example}, {Model Classes} */ diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 53608e7..dd4341b 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -45,13 +45,13 @@ #include <qstyle.h> #include <qapplication.h> #include <qdir.h> +#include <qpixmapcache.h> #if defined(Q_WS_WIN) #define _WIN32_IE 0x0500 #include <qt_windows.h> #include <commctrl.h> #include <objbase.h> #include <private/qpixmapdata_p.h> -#include <qpixmapcache.h> #elif defined(Q_WS_MAC) #include <private/qt_cocoa_helpers_mac_p.h> #endif @@ -314,6 +314,31 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const { QIcon retIcon; + QString fileExtension = fi.suffix().toUpper(); + fileExtension.prepend(QLatin1String(".")); + + const QString keyBase = QLatin1String("qt_") + fileExtension; + + QPixmap pixmap; + if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) { + QPixmapCache::find(keyBase + QLatin1String("16"), pixmap); + } + + if (!pixmap.isNull()) { + retIcon.addPixmap(pixmap); + if (QPixmapCache::find(keyBase + QLatin1String("32"), pixmap)) { + retIcon.addPixmap(pixmap); + if (QPixmapCache::find(keyBase + QLatin1String("64"), pixmap)) { + retIcon.addPixmap(pixmap); + if (QPixmapCache::find(keyBase + QLatin1String("128"), pixmap)) { + retIcon.addPixmap(pixmap); + return retIcon; + } + } + } + } + + FSRef macRef; OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fi.canonicalFilePath().toUtf8().constData()), &macRef, 0); @@ -333,6 +358,16 @@ QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const return retIcon; qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon); ReleaseIconRef(iconRef); + + pixmap = retIcon.pixmap(16); + QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap); + pixmap = retIcon.pixmap(32); + QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap); + pixmap = retIcon.pixmap(64); + QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap); + pixmap = retIcon.pixmap(128); + QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap); + return retIcon; } #endif diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index f568438..347afc8 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -661,10 +661,14 @@ void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd) int QWSDisplay::Data::takeId() { - if (unused_identifiers.count() == 10) + int unusedIdCount = unused_identifiers.count(); + if (unusedIdCount == 10) create(15); - if (unused_identifiers.count() == 0) + if (unusedIdCount == 0) { + create(1); // Make sure we have an incoming id to wait for, just in case we're recursive waitForCreation(); + } + return unused_identifiers.takeFirst(); } diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 99a1fc1..cde0c47 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -264,12 +264,16 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF int nativeSocket = CFSocketGetNative(s); MacSocketInfo *socketInfo = eventDispatcher->macSockets.value(nativeSocket); QEvent notifierEvent(QEvent::SockAct); + + // There is a race condition that happen where we disable the notifier and + // the kernel still has a notification to pass on. We then get this + // notification after we've successfully disabled the CFSocket, but our Qt + // notifier is now gone. The upshot is we have to check the notifier + // everytime. if (callbackType == kCFSocketReadCallBack) { - Q_ASSERT(socketInfo->readNotifier); - QApplication::sendEvent(socketInfo->readNotifier, ¬ifierEvent); + if (socketInfo->readNotifier) + QApplication::sendEvent(socketInfo->readNotifier, ¬ifierEvent); } else if (callbackType == kCFSocketWriteCallBack) { - // ### Bug in Apple socket notifiers seems to send write even - // ### after the notifier has been disabled, need to investigate further. if (socketInfo->writeNotifier) QApplication::sendEvent(socketInfo->writeNotifier, ¬ifierEvent); } diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 639bc92..d5a5c20 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -421,7 +421,8 @@ QWSWindowSurface::QWSWindowSurface(QWidget *widget) QWSWindowSurface::~QWSWindowSurface() { #ifdef Q_BACKINGSTORE_SUBSURFACES - winIdToSurfaceMap()->remove(winId()); + if (d_ptr->winId) + winIdToSurfaceMap()->remove(d_ptr->winId); #endif delete d_ptr; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 4d1fb7a..9560c4b 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -1202,7 +1202,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { MARGINS borderSize; if (widget) { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); if (theme) { int stateId; if (!(option->state & State_Enabled)) @@ -3631,7 +3632,8 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_LineEdit: case CT_ComboBox: { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); MARGINS borderSize; if (theme) { int result = pGetThemeMargins(theme, |