diff options
Diffstat (limited to 'src/gui')
28 files changed, 240 insertions, 147 deletions
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 8af0d2b..82cfa24 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -65,9 +65,9 @@ typedef float CGFloat; // Should only not be defined on 32-bit platforms QT_USE_NAMESPACE -@class QCocoaColorPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate); -@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> { +@interface QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) : NSObject<NSWindowDelegate> { NSColorPanel *mColorPanel; NSView *mStolenContentView; NSButton *mOkButton; @@ -99,7 +99,7 @@ QT_USE_NAMESPACE - (void)setResultSet:(BOOL)result; @end -@implementation QCocoaColorPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) - (id)initWithColorPanel:(NSColorPanel *)panel stolenContentView:(NSView *)stolenContentView okButton:(NSButton *)okButton @@ -432,26 +432,26 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial, [colorPanel setDefaultButtonCell:[okButton cell]]; } - delegate = [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel + delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel stolenContentView:stolenContentView okButton:okButton cancelButton:cancelButton priv:this]; - [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)]; + [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)]; } [delegate setResultSet:false]; setCocoaPanelColor(initial); - [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel]; } void QColorDialogPrivate::closeCocoaColorPanel() { - [static_cast<QCocoaColorPanelDelegate *>(delegate) onCancelClicked]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) onCancelClicked]; } void QColorDialogPrivate::releaseCocoaColorPanelDelegate() { - [static_cast<QCocoaColorPanelDelegate *>(delegate) release]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) release]; } void QColorDialogPrivate::mac_nativeDialogModalHelp() @@ -471,13 +471,13 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp() void QColorDialogPrivate::_q_macRunNativeAppModalPanel() { - [static_cast<QCocoaColorPanelDelegate *>(delegate) exec]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) exec]; } void QColorDialogPrivate::setCocoaPanelColor(const QColor &color) { QMacCocoaAutoReleasePool pool; - QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate); + QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate); NSColor *nsColor; const QColor::Spec spec = color.spec(); if (spec == QColor::Cmyk) { diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 28acf24..b07b1ea 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -82,9 +82,9 @@ QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QFileInfo) QT_USE_NAMESPACE -@class QNSOpenSavePanelDelegate; +@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); -@interface QNSOpenSavePanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject { @public NSOpenPanel *mOpenPanel; NSSavePanel *mSavePanel; @@ -123,7 +123,7 @@ QT_USE_NAMESPACE @end -@implementation QNSOpenSavePanelDelegate +@implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) - (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode title:(const QString &)title @@ -554,7 +554,7 @@ void QFileDialogPrivate::setDirectory_sys(const QString &directory) } #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); [delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)]; #endif } @@ -565,7 +565,7 @@ QString QFileDialogPrivate::directory_sys() const return mCurrentLocation; #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); return qt_mac_NSStringToQString([delegate->mSavePanel directory]); #endif } @@ -622,7 +622,7 @@ QStringList QFileDialogPrivate::selectedFiles_sys() const } #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); return [delegate selectedFiles]; #endif } @@ -633,7 +633,7 @@ void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) Q_UNUSED(filters); #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); bool hideDetails = q_func()->testOption(QFileDialog::HideNameFilterDetails); [delegate setNameFilters:filters hideDetails:hideDetails]; #endif @@ -645,7 +645,7 @@ void QFileDialogPrivate::setFilter_sys() #else Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); *(delegate->mQDirFilter) = model->filter(); delegate->mFileMode = fileMode; [delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())]; @@ -668,7 +668,7 @@ void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) NavCustomControl(mDialog, kNavCtlSelectCustomType, &navSpec); #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); [delegate->mPopUpButton selectItemAtIndex:index]; [delegate filterChanged:nil]; #endif @@ -681,7 +681,7 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const int index = filterInfo.currentSelection; #else QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); int index = [delegate->mPopUpButton indexOfSelectedItem]; #endif return index != -1 ? nameFilters.at(index) : QString(); @@ -696,7 +696,7 @@ void QFileDialogPrivate::deleteNativeDialog_sys() mDialogStarted = false; #else QMacCocoaAutoReleasePool pool; - [reinterpret_cast<QNSOpenSavePanelDelegate *>(mDelegate) release]; + [reinterpret_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate) release]; mDelegate = 0; #endif nativeDialogInUse = false; @@ -1034,7 +1034,7 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate() bool selectDir = q->selectedFiles().isEmpty(); QString selection(selectDir ? q->directory().absolutePath() : q->selectedFiles().value(0)); - QNSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegate alloc] + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc] initWithAcceptMode:acceptMode title:q->windowTitle() nameFilters:q->nameFilters() @@ -1055,7 +1055,7 @@ bool QFileDialogPrivate::showCocoaFilePanel() Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; createNSOpenSavePanelDelegate(); - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); if (qt_mac_is_macsheet(q)) [delegate showWindowModalSheet:q->parentWidget()]; else @@ -1071,7 +1071,7 @@ bool QFileDialogPrivate::hideCocoaFilePanel() return false; } else { QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); [delegate closePanel]; // Even when we hide it, we are still using a // native dialog, so return true: @@ -1104,7 +1104,7 @@ void QFileDialogPrivate::_q_macRunNativeAppModalPanel() #else Q_Q(QFileDialog); QMacCocoaAutoReleasePool pool; - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); [delegate runApplicationModalPanel]; dialogResultCode_sys() == QDialog::Accepted ? q->accept() : q->reject(); #endif @@ -1119,7 +1119,7 @@ QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys() else return QDialog::Accepted; #else - QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate); + QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); return [delegate dialogResultCode]; #endif } diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 919790b..bb8ef3f 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -82,7 +82,7 @@ const CGFloat DialogSideMargin = 9.0; const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask; -@class QCocoaFontPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate); #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 @@ -93,7 +93,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin #endif -@interface QCocoaFontPanelDelegate : NSObject <NSWindowDelegate> { +@interface QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) : NSObject <NSWindowDelegate> { NSFontPanel *mFontPanel; NSView *mStolenContentView; NSButton *mOkButton; @@ -156,7 +156,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) return newFont; } -@implementation QCocoaFontPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) - (id)initWithFontPanel:(NSFontPanel *)panel stolenContentView:(NSView *)stolenContentView okButton:(NSButton *)okButton @@ -478,7 +478,7 @@ QT_BEGIN_NAMESPACE void QFontDialogPrivate::closeCocoaFontPanel() { QMacCocoaAutoReleasePool pool; - QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); NSWindow *ourPanel = [theDelegate actualPanel]; [ourPanel close]; [theDelegate cleanUpAfterMyself]; @@ -519,7 +519,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) } [mgr setSelectedFont:nsFont isMultiple:NO]; - [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font]; + [static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font]; } void QFontDialogPrivate::createNSFontPanelDelegate() @@ -584,7 +584,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate() } // create the delegate and set it - QCocoaFontPanelDelegate *del = [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel stolenContentView:stolenContentView okButton:okButton cancelButton:cancelButton @@ -637,7 +637,7 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp() void QFontDialogPrivate::_q_macRunNativeAppModalPanel() { createNSFontPanelDelegate(); - QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); [del runApplicationModalPanel]; } @@ -649,7 +649,7 @@ bool QFontDialogPrivate::showCocoaFontPanel() Q_Q(QFontDialog); QMacCocoaAutoReleasePool pool; createNSFontPanelDelegate(); - QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate); + QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate); if (qt_mac_is_macsheet(q)) [del showWindowModalSheet:q->parentWidget()]; else diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/gui/dialogs/qnspanelproxy_mac.mm index 3229a4d..0bd5c63 100644 --- a/src/gui/dialogs/qnspanelproxy_mac.mm +++ b/src/gui/dialogs/qnspanelproxy_mac.mm @@ -52,9 +52,9 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@class QNSPanelProxy; +@class QT_MANGLE_NAMESPACE(QNSPanelProxy); -@interface QNSPanelProxy : NSWindow { +@interface QT_MANGLE_NAMESPACE(QNSPanelProxy) : NSWindow { } - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation; @@ -66,7 +66,7 @@ QT_USE_NAMESPACE backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen; @end -@implementation QNSPanelProxy +@implementation QT_MANGLE_NAMESPACE(QNSPanelProxy) - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { @@ -108,15 +108,15 @@ QT_USE_NAMESPACE } @end -@class QNSWindowProxy; +@class QT_MANGLE_NAMESPACE(QNSWindowProxy); -@interface QNSWindowProxy : NSWindow { +@interface QT_MANGLE_NAMESPACE(QNSWindowProxy) : NSWindow { } - (void)setTitle:(NSString *)title; - (void)qt_fakeSetTitle:(NSString *)title; @end -@implementation QNSWindowProxy +@implementation QT_MANGLE_NAMESPACE(QNSWindowProxy) - (void)setTitle:(NSString *)title { QCFString cftitle(currentWindow->windowTitle()); @@ -190,10 +190,10 @@ void macStartInterceptNSPanelCtor() { macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); } /* @@ -203,10 +203,10 @@ void macStopInterceptNSPanelCtor() { macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:), @selector(qt_fakeInitWithContentRect:styleMask:backing:defer:), - [NSPanel class], [QNSPanelProxy class]); + [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]); } /* @@ -217,7 +217,7 @@ void macStartInterceptWindowTitle(QWidget *window) { currentWindow = window; macStartIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), - [NSWindow class], [QNSWindowProxy class]); + [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); } /* @@ -227,7 +227,7 @@ void macStopInterceptWindowTitle() { currentWindow = 0; macStopIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:), - [NSWindow class], [QNSWindowProxy class]); + [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]); } /* diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm index cfcde0f..0302be4 100644 --- a/src/gui/dialogs/qpagesetupdialog_mac.mm +++ b/src/gui/dialogs/qpagesetupdialog_mac.mm @@ -50,9 +50,9 @@ QT_USE_NAMESPACE -@class QCocoaPageLayoutDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate); -@interface QCocoaPageLayoutDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject { QMacPrintEnginePrivate *pe; } - (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; @@ -60,7 +60,7 @@ QT_USE_NAMESPACE returnCode:(int)returnCode contextInfo:(void *)contextInfo; @end -@implementation QCocoaPageLayoutDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) - (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine; { self = [super init]; @@ -213,7 +213,7 @@ void QPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality) pageLayout = [NSPageLayout pageLayout]; // Keep a copy to this since we plan on using it for a bit. [pageLayout retain]; - QCocoaPageLayoutDelegate *delegate = [[QCocoaPageLayoutDelegate alloc] initWithMacPrintEngine:ep]; + QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithMacPrintEngine:ep]; if (modality == Qt::ApplicationModal) { int rval = [pageLayout runModalWithPrintInfo:ep->printInfo]; diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm index 6a8d6a4..84a72db 100644 --- a/src/gui/dialogs/qprintdialog_mac.mm +++ b/src/gui/dialogs/qprintdialog_mac.mm @@ -124,15 +124,15 @@ QT_USE_NAMESPACE #ifdef QT_MAC_USE_COCOA -@class QCocoaPrintPanelDelegate; +@class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate); -@interface QCocoaPrintPanelDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject { } - (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo; @end -@implementation QCocoaPrintPanelDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) - (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo { @@ -313,7 +313,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) macStartInterceptWindowTitle(q); printPanel = [NSPrintPanel printPanel]; - QCocoaPrintPanelDelegate *delegate = [[QCocoaPrintPanelDelegate alloc] init]; + QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init]; [printPanel setOptions:macOptions]; if (modality == Qt::ApplicationModal) { diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index 1390b21..e406cba 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -237,7 +237,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *) */ QVistaHelper::QVistaHelper(QWizard *wizard) - : pressed(false) + : QObject(wizard) + , pressed(false) , wizard(wizard) , backButton_(0) { diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b2bdc5c..7f43b96 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1427,6 +1427,13 @@ QGraphicsItem::~QGraphicsItem() d_ptr->inDestructor = 1; d_ptr->removeExtraItemCache(); + if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) { + QGraphicsObject *o = static_cast<QGraphicsObject *>(this); + QGestureManager *manager = QGestureManager::instance(); + foreach (Qt::GestureType type, d_ptr->gestureContext.keys()) + manager->cleanupCachedGestures(o, type); + } + clearFocus(); // Update focus scope item ptr. diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index ec635d4..7b62de1 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -788,6 +788,10 @@ void QApplicationPrivate::construct( qt_gui_eval_init(application_type); #endif +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) + symbianInit(); +#endif + #ifndef QT_NO_LIBRARY if(load_testability) { QLibrary testLib(QLatin1String("qttestability")); @@ -2364,6 +2368,19 @@ bool QApplication::event(QEvent *e) if (!(w->windowType() == Qt::Desktop)) postEvent(w, new QEvent(QEvent::LanguageChange)); } +#ifndef Q_OS_WIN + } else if (e->type() == QEvent::LocaleChange) { + // on Windows the event propagation is taken care by the + // WM_SETTINGCHANGE event handler. + QWidgetList list = topLevelWidgets(); + for (int i = 0; i < list.size(); ++i) { + QWidget *w = list.at(i); + if (!(w->windowType() == Qt::Desktop)) { + if (!w->testAttribute(Qt::WA_SetLocale)) + w->d_func()->setLocale_helper(QLocale(), true); + } + } +#endif } else if (e->type() == QEvent::Timer) { QTimerEvent *te = static_cast<QTimerEvent*>(e); Q_ASSERT(te != 0); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index fb2837e..50b9759 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1936,6 +1936,8 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa QLocalePrivate::updateSystemPrivate(); if (!widget->testAttribute(Qt::WA_SetLocale)) widget->dptr()->setLocale_helper(QLocale(), true); + QEvent e(QEvent::LocaleChange); + QApplication::sendEvent(qApp, &e); } } else if (msg.wParam == SPI_SETICONTITLELOGFONT) { diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp index e47de00..7e5afc7 100644 --- a/src/gui/kernel/qdnd_qws.cpp +++ b/src/gui/kernel/qdnd_qws.cpp @@ -192,6 +192,10 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) return false; switch(e->type()) { + case QEvent::ShortcutOverride: + // prevent accelerators from firing while dragging + e->accept(); + return true; case QEvent::KeyPress: case QEvent::KeyRelease: diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 0a05d8e..2b12317 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1299,6 +1299,12 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e) return true; } + if (e->type() == QEvent::ShortcutOverride) { + // prevent accelerators from firing while dragging + e->accept(); + return true; + } + if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { QKeyEvent *ke = ((QKeyEvent*)e); if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index aa6720e..9495f40 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -132,20 +132,21 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); if (list.contains(recognizer)) { m_deletedRecognizers.insert(g, recognizer); - m_gestureToRecognizer.remove(g); } } - foreach (QGestureRecognizer *recognizer, list) { - QList<QGesture *> obsoleteGestures; - QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin(); - while (iter != m_objectGestures.end()) { - ObjectGesture objectGesture = iter.key(); - if (objectGesture.gesture == type) - obsoleteGestures << iter.value(); - ++iter; + QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin(); + while (iter != m_objectGestures.end()) { + ObjectGesture objectGesture = iter.key(); + if (objectGesture.gesture == type) { + foreach (QGesture *g, iter.value()) { + if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)) { + m_gestureToRecognizer.remove(g); + m_obsoleteGestures[recognizer].insert(g); + } + } } - m_obsoleteGestures.insert(recognizer, obsoleteGestures); + ++iter; } } @@ -155,7 +156,14 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ while (iter != m_objectGestures.end()) { ObjectGesture objectGesture = iter.key(); if (objectGesture.gesture == type && target == objectGesture.object.data()) { - qDeleteAll(iter.value()); + QSet<QGesture *> gestures = iter.value().toSet(); + for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator + it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) { + it.value() -= gestures; + } + foreach (QGesture *g, gestures) + m_deletedRecognizers.remove(g); + qDeleteAll(gestures); iter = m_objectGestures.erase(iter); } else { ++iter; @@ -177,6 +185,9 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni #ifndef QT_NO_GRAPHICSVIEW } else { Q_ASSERT(qobject_cast<QGraphicsObject *>(object)); + QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object); + if (graphicsObject->QGraphicsItem::d_func()->inDestructor) + return 0; #endif } diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index a0ff83f..c105c9b 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -127,7 +127,7 @@ private: int m_lastCustomGestureId; - QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures; + QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures; QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers; void cleanupGesturesForRemovedRecognizer(QGesture *gesture); diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm index 71fd663..2aff44d 100644 --- a/src/gui/kernel/qsound_mac.mm +++ b/src/gui/kernel/qsound_mac.mm @@ -88,14 +88,14 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@interface QMacSoundDelegate : NSObject<NSSoundDelegate> { +@interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject<NSSoundDelegate> { QSound *qSound; // may be null. QAuServerMac* server; } -(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server; @end -@implementation QMacSoundDelegate +@implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate) -(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv { self = [super init]; if(self) { @@ -172,7 +172,7 @@ NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound) { NSString *nsFileName = const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(fileName))); NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES]; - QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this]; + QT_MANGLE_NAMESPACE(QMacSoundDelegate) * const delegate = [[QT_MANGLE_NAMESPACE(QMacSoundDelegate) alloc] initWithQSound:qSound:this]; [nsSound setDelegate:delegate]; [nsFileName release]; return nsSound; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 60f38f2..e39526e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1388,6 +1388,9 @@ QWidget::~QWidget() qWarning("QWidget: %s (%s) deleted while being painted", className(), name()); #endif + foreach (Qt::GestureType type, d->gestureContext.keys()) + ungrabGesture(type); + // force acceptDrops false before winId is destroyed. d->registerDropSite(false); diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index e29b755..f12c956 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3824,9 +3824,35 @@ void QWidgetPrivate::raise_sys() #if QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; if (isRealWindow()) { - // Calling orderFront shows the window on Cocoa too. + // With the introduction of spaces it is not as simple as just raising the window. + // First we need to check if we are in the right space. If we are, then we just continue + // as usual. The problem comes when we are not in the active space. There are two main cases: + // 1. Our parent was moved to a new space. In this case we want the window to be raised + // in the same space as its parent. + // 2. We don't have a parent. For this case we will just raise the window and let Cocoa + // switch to the corresponding space. + // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if + // required we will introduce special handling for some of them. if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) { - [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)]; + OSWindowRef window = qt_mac_window_for(q); + // isOnActiveSpace is available only from 10.6 onwards, so we need to check if it is + // available before calling it. + if([window respondsToSelector:@selector(isOnActiveSpace)]) { + if(![window performSelector:@selector(isOnActiveSpace)]) { + QWidget *parentWidget = q->parentWidget(); + if(parentWidget) { + OSWindowRef parentWindow = qt_mac_window_for(parentWidget); + if(parentWindow && [parentWindow isOnActiveSpace]) { + // The window was created in a different space. Therefore if we want + // to show it in the current space we need to recreate it in the new + // space. + recreateMacWindow(); + window = qt_mac_window_for(q); + } + } + } + } + [window orderFront:window]; } if (qt_mac_raise_process) { //we get to be the active process now ProcessSerialNumber psn; diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 7d647b7..4912291 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -512,8 +512,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO DestroyWindow(destroyw); } +#ifndef QT_NO_TABLETEVENT if (q != qt_tablet_widget && QWidgetPrivate::mapper) qt_tablet_init(); +#endif // QT_NO_TABLETEVENT if (q->testAttribute(Qt::WA_DropSiteRegistered)) registerDropSite(true); diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index 509847b..e352f5c 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -358,8 +358,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO DestroyWindow(destroyw); } +#ifndef QT_NO_TABLETEVENT if (q != qt_tablet_widget && QWidgetPrivate::mapper) qt_tablet_init_wce(); +#endif // QT_NO_TABLETEVENT if (q->testAttribute(Qt::WA_DropSiteRegistered)) registerDropSite(true); diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index b8bf15e..2955e39 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -931,29 +931,16 @@ void QPdfEnginePrivate::writeHeader() void QPdfEnginePrivate::writeInfo() { info = addXrefEntry(-1); - - // The 'text string' type in PDF is encoded either as PDFDocEncoding, or - // Unicode UTF-16 with a Unicode byte order mark as the first character - // (0xfeff), with the high-order byte first. - QByteArray array("<<\n/Title (\xfe\xff"); - const ushort *utf16Title = title.utf16(); - for (int i=0; i < title.size(); ++i) { - array.append((*(utf16Title + i)) >> 8); - array.append((*(utf16Title + i)) & 0xff); - } - array.append(")\n/Creator (\xfe\xff"); - const ushort *utf16Creator = creator.utf16(); - for (int i=0; i < creator.size(); ++i) { - array.append((*(utf16Creator + i)) >> 8); - array.append((*(utf16Creator + i)) & 0xff); - } - array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n"); - write(array); - + xprintf("<<\n/Title "); + printString(title); + xprintf("\n/Creator "); + printString(creator); + xprintf("\n/Producer "); + printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies)")); QDateTime now = QDateTime::currentDateTime().toUTC(); QTime t = now.time(); QDate d = now.date(); - xprintf("/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", + xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", d.year(), d.month(), d.day(), @@ -1230,6 +1217,25 @@ int QPdfEnginePrivate::addXrefEntry(int object, bool printostr) return object; } +void QPdfEnginePrivate::printString(const QString &string) { + // The 'text string' type in PDF is encoded either as PDFDocEncoding, or + // Unicode UTF-16 with a Unicode byte order mark as the first character + // (0xfeff), with the high-order byte first. + QByteArray array("(\xfe\xff"); + const ushort *utf16 = string.utf16(); + + for (int i=0; i < string.size(); ++i) { + char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)}; + for(int j=0; j < 2; ++j) { + if (part[j] == '(' || part[j] == ')' || part[j] == '\\') + array.append('\\'); + array.append(part[j]); + } + } + array.append(")"); + write(array); +} + QT_END_NAMESPACE #endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/gui/painting/qprintengine_pdf_p.h index cb6c59d..e0ca56f 100644 --- a/src/gui/painting/qprintengine_pdf_p.h +++ b/src/gui/painting/qprintengine_pdf_p.h @@ -170,6 +170,7 @@ private: void writePage(); int addXrefEntry(int object, bool printostr = true); + void printString(const QString &string); void xprintf(const char* fmt, ...); inline void write(const QByteArray &data) { stream->writeRawData(data.constData(), data.size()); diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 0f39b23..d9f7df0 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -1397,7 +1397,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o dark.lighter(135), 60); QColor highlight = option->palette.highlight().color(); - QColor highlightText = option->palette.highlightedText().color(); switch(element) { case CE_RadioButton: //fall through @@ -2723,7 +2722,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp { // Fill title bar gradient QColor titlebarColor = QColor(active ? highlight: palette.background().color()); - QColor titleBarGradientStop(active ? highlight.darker(150): palette.background().color().darker(120)); QLinearGradient gradient(option->rect.center().x(), option->rect.top(), option->rect.center().x(), option->rect.bottom()); @@ -2986,7 +2984,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->fillRect(option->rect, option->palette.background()); - QRect rect = scrollBar->rect; QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); @@ -3714,6 +3711,9 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option { int ret = -1; switch (metric) { + case PM_ToolTipLabelFrameWidth: + ret = 2; + break; case PM_ButtonDefaultIndicator: ret = 0; break; diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 9c61023..6c8d561 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1163,7 +1163,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) { QRect tabRect = tbb->rect; - QRegion region(tabRect); painter->save(); painter->setPen(QPen(option->palette.dark().color().dark(110), 0)); switch (tbb->shape) { @@ -1245,8 +1244,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline); - QPalette palette = option->palette; - switch (control) { case CC_TitleBar: @@ -1333,11 +1330,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom bool isEnabled = (comboBox->state & State_Enabled); bool focus = isEnabled && (comboBox->state & State_HasFocus); - QColor buttonShadow = option->palette.dark().color(); GtkStateType state = gtkPainter.gtkState(option); int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); - QPixmap cache; - QString pixmapName; QStyleOptionComboBox comboBoxCopy = *comboBox; comboBoxCopy.rect = option->rect; @@ -1345,8 +1339,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QRect rect = option->rect; QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxArrow, widget); - QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, - SC_ComboBoxEditField, widget); GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? GTK_SHADOW_IN : GTK_SHADOW_OUT; @@ -1414,9 +1406,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else if (option->state & State_MouseOver && comboBox->activeSubControls & SC_ComboBoxArrow) buttonState = GTK_STATE_PRELIGHT; - QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y, - gtkToggleButton->allocation.width, gtkToggleButton->allocation.height); - Q_ASSERT(gtkToggleButton); gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState, shadow, gtkToggleButton->style, buttonPath.toString() + @@ -1436,8 +1425,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (focus) GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); - QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") - : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); // Draw the separator between label and arrows QHashableLatin1Literal vSeparatorPath = comboBox->editable @@ -1643,6 +1630,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom style = scrollbarWidget->style; gboolean trough_under_steppers = true; gboolean trough_side_details = false; + gboolean activate_slider = false; gboolean stepper_size = 14; gint trough_border = 1; if (!d->gtk_check_version(2, 10, 0)) { @@ -1650,6 +1638,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom "trough-border", &trough_border, "trough-side-details", &trough_side_details, "trough-under-steppers", &trough_under_steppers, + "activate-slider", &activate_slider, "stepper-size", &stepper_size, NULL); } if (trough_under_steppers) { @@ -1695,6 +1684,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (!(option->state & State_Enabled)) state = GTK_STATE_INSENSITIVE; + else if (activate_slider && + option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider)) + state = GTK_STATE_ACTIVE; else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider)) state = GTK_STATE_PRELIGHT; @@ -1932,14 +1924,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); - QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); bool horizontal = slider->orientation == Qt::Horizontal; bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; - QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight); - QPixmap cache; QBrush oldBrush = painter->brush(); QPen oldPen = painter->pen(); @@ -1948,6 +1937,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QColor highlightAlpha(Qt::white); highlightAlpha.setAlpha(80); + QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? + GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget; style = scaleWidget->style; @@ -1981,11 +1972,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QRect lowerGroove = grooveRect; if (horizontal) { - upperGroove.setLeft(handle.center().x()); - lowerGroove.setRight(handle.center().x()); + if (slider->upsideDown) { + lowerGroove.setLeft(handle.center().x()); + upperGroove.setRight(handle.center().x()); + } else { + upperGroove.setLeft(handle.center().x()); + lowerGroove.setRight(handle.center().x()); + } } else { - upperGroove.setBottom(handle.center().y()); - lowerGroove.setTop(handle.center().y()); + if (!slider->upsideDown) { + lowerGroove.setBottom(handle.center().y()); + upperGroove.setTop(handle.center().y()); + } else { + upperGroove.setBottom(handle.center().y()); + lowerGroove.setTop(handle.center().y()); + } } gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state, @@ -2543,7 +2544,6 @@ void QGtkStyle::drawControl(ControlElement element, d->gtkWidget("GtkMenu.GtkMenuItem"); style = gtkPainter.getStyle(gtkMenuItem); - QColor borderColor = option->palette.background().color().darker(160); QColor shadow = option->palette.dark().color(); if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { @@ -2768,8 +2768,6 @@ void QGtkStyle::drawControl(ControlElement element, // Arrow if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow - QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget), - proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); QFontMetrics fm(menuitem->font); int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness; @@ -3116,7 +3114,6 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple case CC_ComboBox: if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { // We employ the gtk widget to position arrows and separators for us - QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox"); GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") : d->gtkWidget("GtkComboBox"); d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 8e7ec80..05fe744 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -873,7 +873,7 @@ void QCompleterPrivate::showPopup(const QRect& rect) const QRect screen = QApplication::desktop()->availableGeometry(widget); Qt::LayoutDirection dir = widget->layoutDirection(); QPoint pos; - int rw, rh, w; + int rh, w; int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3; QScrollBar *hsb = popup->horizontalScrollBar(); if (hsb && hsb->isVisible()) @@ -881,21 +881,30 @@ void QCompleterPrivate::showPopup(const QRect& rect) if (rect.isValid()) { rh = rect.height(); - w = rw = rect.width(); + w = rect.width(); pos = widget->mapToGlobal(dir == Qt::RightToLeft ? rect.bottomRight() : rect.bottomLeft()); } else { rh = widget->height(); - rw = widget->width(); pos = widget->mapToGlobal(QPoint(0, widget->height() - 2)); w = widget->width(); } - if ((pos.x() + rw) > (screen.x() + screen.width())) + if (w > screen.width()) + w = screen.width(); + if ((pos.x() + w) > (screen.x() + screen.width())) pos.setX(screen.x() + screen.width() - w); if (pos.x() < screen.x()) pos.setX(screen.x()); - if (((pos.y() + rh) > (screen.y() + screen.height())) && ((pos.y() - h - rh) >= 0)) - pos.setY(pos.y() - qMax(h, popup->minimumHeight()) - rh + 2); + + int top = pos.y() - rh - screen.top() + 2; + int bottom = screen.bottom() - pos.y(); + h = qMax(h, popup->minimumHeight()); + if (h > bottom) { + h = qMin(qMax(top, bottom), h); + + if (top > bottom) + pos.setY(pos.y() - h - rh + 2); + } popup->setGeometry(pos.x(), pos.y(), w, h); diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index d943c8c..8aaaa0f 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -75,8 +75,6 @@ #define QT_MAC_SYSTEMTRAY_USE_GROWL -@class QNSMenu; - #include <private/qt_cocoa_helpers_mac_p.h> #include <private/qsystemtrayicon_p.h> #include <qtemporaryfile.h> @@ -98,13 +96,14 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -@class QNSImageView; +@class QT_MANGLE_NAMESPACE(QNSMenu); +@class QT_MANGLE_NAMESPACE(QNSImageView); -@interface QNSStatusItem : NSObject { +@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject { NSStatusItem *item; QSystemTrayIcon *icon; QSystemTrayIconPrivate *iconPrivate; - QNSImageView *imageCell; + QT_MANGLE_NAMESPACE(QNSImageView) *imageCell; } -(id)initWithIcon:(QSystemTrayIcon*)icon iconPrivate:(QSystemTrayIconPrivate *)iprivate; -(void)dealloc; @@ -115,11 +114,11 @@ QT_USE_NAMESPACE - (void)doubleClickSelector:(id)sender; @end -@interface QNSImageView : NSImageView { +@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView { BOOL down; - QNSStatusItem *parent; + QT_MANGLE_NAMESPACE(QNSStatusItem) *parent; } --(id)initWithParent:(QNSStatusItem*)myParent; +-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent; -(QSystemTrayIcon*)icon; -(void)menuTrackingDone:(NSNotification*)notification; -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @@ -134,7 +133,7 @@ QT_USE_NAMESPACE #endif -@interface QNSMenu : NSMenu <NSMenuDelegate> { +@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> { QMenu *qmenu; } -(QMenu*)menu; @@ -148,14 +147,14 @@ class QSystemTrayIconSys public: QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d) { QMacCocoaAutoReleasePool pool; - item = [[QNSStatusItem alloc] initWithIcon:icon iconPrivate:d]; + item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d]; } ~QSystemTrayIconSys() { QMacCocoaAutoReleasePool pool; [[[item item] view] setHidden: YES]; [item release]; } - QNSStatusItem *item; + QT_MANGLE_NAMESPACE(QNSStatusItem) *item; }; void QSystemTrayIconPrivate::install_sys() @@ -299,8 +298,8 @@ QT_END_NAMESPACE @implementation NSStatusItem (Qt) @end -@implementation QNSImageView --(id)initWithParent:(QNSStatusItem*)myParent { +@implementation QT_MANGLE_NAMESPACE(QNSImageView) +-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent { self = [super init]; parent = myParent; down = NO; @@ -400,7 +399,7 @@ QT_END_NAMESPACE } @end -@implementation QNSStatusItem +@implementation QT_MANGLE_NAMESPACE(QNSStatusItem) -(id)initWithIcon:(QSystemTrayIcon*)i iconPrivate:(QSystemTrayIconPrivate *)iPrivate { @@ -409,7 +408,7 @@ QT_END_NAMESPACE icon = i; iconPrivate = iPrivate; item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; - imageCell = [[QNSImageView alloc] initWithParent:self]; + imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self]; [item setView: imageCell]; } return self; @@ -453,7 +452,7 @@ QT_END_NAMESPACE [[[self item] view] removeAllToolTips]; iconPrivate->updateToolTip_sys(); #endif - NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()]; + NSMenu *m = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:icon->contextMenu()]; [m setAutoenablesItems: NO]; [[NSNotificationCenter defaultCenter] addObserver:imageCell selector:@selector(menuTrackingDone:) @@ -481,7 +480,7 @@ private: QSystemTrayIconQMenu(); }; -@implementation QNSMenu +@implementation QT_MANGLE_NAMESPACE(QNSMenu) -(id)initWithQMenu:(QMenu*)qm { self = [super init]; if(self) { @@ -494,7 +493,7 @@ private: return qmenu; } -(void)menuNeedsUpdate:(NSMenu*)nsmenu { - QNSMenu *menu = static_cast<QNSMenu *>(nsmenu); + QT_MANGLE_NAMESPACE(QNSMenu) *menu = static_cast<QT_MANGLE_NAMESPACE(QNSMenu) *>(nsmenu); emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow(); for(int i = [menu numberOfItems]-1; i >= 0; --i) [menu removeItemAtIndex:i]; @@ -539,7 +538,7 @@ private: [nsimage release]; } if(action->menu()) { - QNSMenu *sub = [[QNSMenu alloc] initWithQMenu:action->menu()]; + QT_MANGLE_NAMESPACE(QNSMenu) *sub = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:action->menu()]; [item setSubmenu:sub]; } else { [item setAction:@selector(selectedAction:)]; diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm index b2a0e0c..e68ee7c 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm +++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm @@ -58,7 +58,7 @@ QT_FORWARD_DECLARE_CLASS(QMainWindowLayout); QT_FORWARD_DECLARE_CLASS(QToolBar); QT_FORWARD_DECLARE_CLASS(QCFString); -@implementation QCocoaToolBarDelegate +@implementation QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) - (id)initWithMainWindowLayout:(QMainWindowLayout *)layout { diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h index 8e3d06f..b4af54f 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h +++ b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h @@ -61,7 +61,7 @@ QT_END_NAMESPACE @class NSToolbarItem; -@interface QCocoaToolBarDelegate : NSObject { +@interface QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) : NSObject { QT_PREPEND_NAMESPACE(QMainWindowLayout) *mainWindowLayout; NSToolbarItem *toolbarItem; } diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 9527057..b8cef93 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -410,7 +410,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar macToolbar = [[NSToolbar alloc] initWithIdentifier:(NSString *)kQMainWindowMacToolbarID]; [macToolbar setDisplayMode:NSToolbarDisplayModeIconOnly]; [macToolbar setSizeMode:NSToolbarSizeModeRegular]; - [macToolbar setDelegate:[[QCocoaToolBarDelegate alloc] initWithMainWindowLayout:this]]; + [macToolbar setDelegate:[[QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) alloc] initWithMainWindowLayout:this]]; [window setToolbar:macToolbar]; [macToolbar release]; } |