diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-24 16:02:55 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-24 16:02:55 +0100 |
commit | 627d9cbd3c45834fe7aa1f2ee37fdfca07a03976 (patch) | |
tree | c0805165804b2a9ef809318dd6a84132d2e57744 /src/plugins/platforms | |
parent | fed2d237b71ac2f586dca0d35d104e7cf0cd9bd2 (diff) | |
parent | 1b5f9bec03901519db3694d1b51fa7989ade1f25 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
Change-Id: I4ca87d44129fa5c1d8541cd58b8d62bc69080688
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 33 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 20 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 4 |
4 files changed, 55 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 14c24beabf..61ddfe9498 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -490,6 +490,39 @@ static QTouchDevice *touchDevice = 0; [self handleMouseEvent:theEvent]; } +- (void)updateTrackingAreas +{ + [super updateTrackingAreas]; + + // [NSView addTrackingArea] is slow, so bail out early if we can: + if (NSIsEmptyRect([self visibleRect])) + return; + + QCocoaAutoReleasePool pool; + if (NSArray *trackingArray = [self trackingAreas]) { + NSUInteger size = [trackingArray count]; + for (NSUInteger i = 0; i < size; ++i) { + NSTrackingArea *t = [trackingArray objectAtIndex:i]; + [self removeTrackingArea:t]; + } + } + + // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should + // only be turned on if mouseTracking, hover is on or a tool tip is set. + // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to + // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of + // mouse moves delivered to it (Apple recommends keeping it OFF because there + // is a performance hit). So it goes. + NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp + | NSTrackingInVisibleRect | NSTrackingMouseMoved; + NSTrackingArea *ta = [[[NSTrackingArea alloc] initWithRect:[self frame] + options:trackingOptions + owner:self + userInfo:nil] + autorelease]; + [self addTrackingArea:ta]; +} + - (void)mouseMoved:(NSEvent *)theEvent { [self handleMouseEvent:theEvent]; diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 46a2c682b3..b4699b6306 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -769,6 +769,7 @@ public: inline void selectNameFilter(const QString &filter); inline void updateSelectedNameFilter() { selectNameFilter(m_data.selectedNameFilter()); } inline QString selectedNameFilter() const; + void selectFile(const QString &fileName) const; bool hideFiltersDetails() const { return m_hideFiltersDetails; } void setHideFiltersDetails(bool h) { m_hideFiltersDetails = h; } void setDefaultSuffix(const QString &s); @@ -1071,6 +1072,11 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel } } +void QWindowsNativeFileDialogBase::selectFile(const QString &fileName) const +{ + m_fileDialog->SetFileName((wchar_t*)fileName.utf16()); +} + // Return the index of the selected filter, accounting for QFileDialog // sometimes stripping the filter specification depending on the // hideFilterDetails setting. @@ -1362,6 +1368,12 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog() result->setLabelText(QFileDialogOptions::Accept, opts->labelText(QFileDialogOptions::Accept)); result->updateDirectory(); result->updateSelectedNameFilter(); + const QStringList initialSelection = opts->initiallySelectedFiles(); + if (initialSelection.size() > 0) { + QFileInfo info(initialSelection.front()); + if (!info.isDir()) + result->selectFile(info.fileName()); + } const QString defaultSuffix = opts->defaultSuffix(); if (!defaultSuffix.isEmpty()) result->setDefaultSuffix(defaultSuffix); @@ -1383,9 +1395,13 @@ QString QWindowsFileDialogHelper::directory() const return m_data.directory(); } -void QWindowsFileDialogHelper::selectFile(const QString & /* filename */) +void QWindowsFileDialogHelper::selectFile(const QString &fileName) { - // Not implemented. + if (QWindowsContext::verboseDialogs) + qDebug("%s %s" , __FUNCTION__, qPrintable(fileName)); + + if (QWindowsNativeFileDialogBase *nfd = nativeFileDialog()) + nfd->selectFile(fileName); } QStringList QWindowsFileDialogHelper::selectedFiles() const diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 44c730d375..32de54562a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -771,6 +771,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) HANDLE_PLATFORM_WINDOW_EVENT(xcb_unmap_notify_event_t, event, handleUnmapNotifyEvent); case XCB_CLIENT_MESSAGE: handleClientMessageEvent((xcb_client_message_event_t *)event); + break; case XCB_ENTER_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); case XCB_LEAVE_NOTIFY: diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 9af1f0404f..9fe6e4253b 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -84,8 +84,10 @@ #include <QtGui/QScreen> #ifndef QT_NO_ACCESSIBILITY #include <qpa/qplatformaccessibility.h> +#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE #include "../../../platformsupport/linuxaccessibility/bridge_p.h" #endif +#endif QT_BEGIN_NAMESPACE @@ -112,7 +114,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters) m_fontDatabase.reset(new QGenericUnixFontDatabase()); m_inputContext.reset(QPlatformInputContextFactory::create()); -#ifndef QT_NO_ACCESSIBILITY +#ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE m_accessibility.reset(new QSpiAccessibleBridge()); #endif } |