diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 7 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview_p.h | 8 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 11 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 91 | ||||
-rw-r--r-- | src/gui/painting/qprintengine_ps.cpp | 25 | ||||
-rw-r--r-- | src/gui/painting/qprintengine_win.cpp | 7 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui.cpp | 12 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 43 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 8 | ||||
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 9 | ||||
-rw-r--r-- | src/gui/styles/qstylesheetstyle_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 14 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 46 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 32 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60_p.h | 8 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 4 |
21 files changed, 234 insertions, 130 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 6b22607..569a329 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -845,6 +845,13 @@ inline bool QGraphicsItemPrivate::insertionOrder(QGraphicsItem *a, QGraphicsItem inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) { QGraphicsItemPrivate *parentp = this; +#ifndef QT_NO_GRAPHICSEFFECT + if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) { + parentp->notifyInvalidated = 1; + static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() + ->source->d_func())->invalidateCache(); + } +#endif while (parentp->parent) { parentp = parentp->parent->d_ptr.data(); parentp->dirtyChildren = 1; diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 729837a..80e3ec1 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -183,8 +183,12 @@ public: else QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); #else - QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::ExcludeSocketNotifiers - | QEventLoop::ExcludeUserInputEvents); + // At this point either HIViewSetNeedsDisplay (Carbon) or setNeedsDisplay: YES (Cocoa) + // is called, which means there's a pending update request. We want to dispatch it + // now because otherwise graphics view updates would require two + // round-trips in the event loop before the item is painted. + extern void qt_mac_dispatchPendingUpdateRequests(QWidget *); + qt_mac_dispatchPendingUpdateRequests(viewport->window()); #endif } diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c735d1f..5f7813b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -73,6 +73,7 @@ # endif # include <private/qs60mainapplication_p.h> # include <centralrepository.h> +# include "qs60mainappui.h" #endif #include "private/qstylesheetstyle_p.h" @@ -539,6 +540,14 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) sendMouseEvent(receiver, type, globalPos, button, modifiers); } +#ifdef Q_WS_S60 +void QSymbianControl::HandleStatusPaneSizeChange() +{ + QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi()); + s60AppUi->HandleStatusPaneSizeChange(); +} +#endif + void QSymbianControl::sendMouseEvent( QWidget *receiver, QEvent::Type type, @@ -982,15 +991,6 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint)); - - // Responsiviness - CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup - TUint cbaFlags = cba->ButtonGroupFlags(); - if(qwidget->windowFlags() & Qt::WindowSoftkeysRespondHint) - cbaFlags |= EAknCBAFlagRespondWhenInvisible; - else - cbaFlags &= ~EAknCBAFlagRespondWhenInvisible; - cba->SetButtonGroupFlags(cbaFlags); } #endif } else if (QApplication::activeWindow() == qwidget->window()) { diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index e4990b1..6325d95 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -79,6 +79,8 @@ bool QSoftKeyManagerPrivateS60::skipCbaUpdate() // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before // menu/dialog CBA is actually displayed i.e. it is being costructed. CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer(); + if (!appUiCba) + return true; // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current(); // Check if softkey need to be update even they are not visible diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 024c1fc..8cef03c 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1299,6 +1299,17 @@ CGContextRef qt_mac_graphicsContextFor(QWidget *widget) return context; } +void qt_mac_dispatchPendingUpdateRequests(QWidget *widget) +{ + if (!widget) + return; +#ifndef QT_MAC_USE_COCOA + HIViewRender(qt_mac_nativeview_for(widget)); +#else + [qt_mac_nativeview_for(widget) displayIfNeeded]; +#endif +} + CGFloat qt_mac_get_scalefactor() { #ifndef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index a714221..58da302 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -155,7 +155,7 @@ class QLongTapTimer; class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver #ifdef Q_WS_S60 -, public MAknFadedComponent +, public MAknFadedComponent, public MEikStatusPaneObserver #endif { public: @@ -183,6 +183,7 @@ public: #ifdef Q_WS_S60 void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } + void HandleStatusPaneSizeChange(); protected: // from MAknFadedComponent TInt CountFadedComponents() {return 1;} diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index bfa7050..a0429d3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -387,16 +387,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de | EPointerFilterMove | EPointerFilterDrag, 0); drawableWindow->EnableVisibilityChangeEvents(); - if (!isOpaque) { - RWindow *const window = static_cast<RWindow *>(drawableWindow); -#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE - window->SetSurfaceTransparency(true); -#else - const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA)); - if (window->SetTransparencyAlphaChannel() == KErrNone) - window->SetBackgroundColor(TRgb(255, 255, 255, 0)); -#endif - } + s60UpdateIsOpaque(); } q->setAttribute(Qt::WA_WState_Created); @@ -488,6 +479,47 @@ void QWidgetPrivate::show_sys() QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); +#ifdef Q_WS_S60 + // Lazily initialize the S60 screen furniture when the first window is shown. + if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) + && !S60->buttonGroupContainer() && !S60->statusPane()) { + + bool isFullscreen = q->windowState() & Qt::WindowFullScreen; + bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; + + // If the window is fullscreen and has not explicitly requested that the CBA be visible + // we delay the creation even more. + if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) { + + // Create the status pane and CBA here + CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); + MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory(); + TRAP_IGNORE(factory->ReadAppInfoResourceL(0, ui)); + if (S60->buttonGroupContainer()) + S60->buttonGroupContainer()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + + if (S60->statusPane()) { + // Use QDesktopWidget as the status pane observer to proxy for the AppUi. + // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. + QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId()); + S60->statusPane()->SetObserver(desktopControl); + + // Hide the status pane if fullscreen OR + // Fill client area if maximized OR + // Put window below status pane unless the window has an explicit position. + if (isFullscreen) { + S60->statusPane()->MakeVisible(false); + } else if (q->windowState() & Qt::WindowMaximized) { + TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + id->SetExtent(r.iTl, r.Size()); + } else if (!q->testAttribute(Qt::WA_Moved)) { + id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); + } + } + } + } +#endif + id->MakeVisible(true); if(q->isWindow()) @@ -1063,6 +1095,9 @@ void QWidget::setWindowState(Qt::WindowStates newstate) return; if (isWindow()) { + createWinId(); + Q_ASSERT(testAttribute(Qt::WA_WState_Created)); + const bool wasResized = testAttribute(Qt::WA_Resized); const bool wasMoved = testAttribute(Qt::WA_Moved); @@ -1088,35 +1123,35 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (buttonGroup) { // Visibility buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested)); - - // Responsiviness - CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup - TUint cbaFlags = cba->ButtonGroupFlags(); - if(windowFlags() & Qt::WindowSoftkeysRespondHint) - cbaFlags |= EAknCBAFlagRespondWhenInvisible; - else - cbaFlags &= ~EAknCBAFlagRespondWhenInvisible; - cba->SetButtonGroupFlags(cbaFlags); } #endif // Q_WS_S60 - createWinId(); - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); // Ensure the initial size is valid, since we store it as normalGeometry below. if (!wasResized && !isVisible()) adjustSize(); QTLWExtra *top = d->topData(); - const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; - + QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint; - if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) - setGeometry(qApp->desktop()->screenGeometry(this)); - else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) - setGeometry(qApp->desktop()->availableGeometry(this)); - else + if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) { + window->SetExtentToWholeScreen(); + } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) { + TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this)); + window->SetExtent(maxExtent.iTl, maxExtent.Size()); + } else { +#ifdef Q_WS_S60 + // With delayed creation of S60 app panes, the normalGeometry calculated above is not + // accurate because it did not consider the status pane. This means that when returning + // normal mode after showing the status pane, the geometry would overlap so we should + // move it if it never had an explicit position. + if (!wasMoved && statusPane && visible) { + TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl; + normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); + } +#endif setGeometry(normalGeometry); + } //restore normal geometry top->normalGeometry = normalGeometry; diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp index ac94de3..28e9a7a 100644 --- a/src/gui/painting/qprintengine_ps.cpp +++ b/src/gui/painting/qprintengine_ps.cpp @@ -485,7 +485,6 @@ void QPSPrintEnginePrivate::emitHeader(bool finished) QByteArray header; QPdf::ByteStream s(&header); - s << "%!PS-Adobe-1.0"; qreal scale = 72. / ((qreal) q->metric(QPaintDevice::PdmDpiY)); QRect pageRect = this->pageRect(); @@ -497,28 +496,32 @@ void QPSPrintEnginePrivate::emitHeader(bool finished) int width = pageRect.width(); int height = pageRect.height(); if (finished && pageCount == 1 && copies == 1 && - ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps")))) - ) { + ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps"))))) + { + // According to the EPSF 3.0 spec it is required that the PS + // version is PS-Adobe-3.0 + s << "%!PS-Adobe-3.0"; if (!boundingBox.isValid()) boundingBox.setRect(0, 0, width, height); if (orientation == QPrinter::Landscape) { if (!fullPage) boundingBox.translate(-mleft, -mtop); s << " EPSF-3.0\n%%BoundingBox: " - << (int)(printer->height() - boundingBox.bottom())*scale // llx - << (int)(printer->width() - boundingBox.right())*scale - 1 // lly - << (int)(printer->height() - boundingBox.top())*scale + 1 // urx - << (int)(printer->width() - boundingBox.left())*scale; // ury + << int((printer->height() - boundingBox.bottom())*scale) // llx + << int((printer->width() - boundingBox.right())*scale - 1) // lly + << int((printer->height() - boundingBox.top())*scale + 1) // urx + << int((printer->width() - boundingBox.left())*scale); // ury } else { if (!fullPage) boundingBox.translate(mleft, -mtop); s << " EPSF-3.0\n%%BoundingBox: " - << (int)(boundingBox.left())*scale - << (int)(printer->height() - boundingBox.bottom())*scale - 1 - << (int)(boundingBox.right())*scale + 1 - << (int)(printer->height() - boundingBox.top())*scale; + << int((boundingBox.left())*scale) + << int((printer->height() - boundingBox.bottom())*scale - 1) + << int((boundingBox.right())*scale + 1) + << int((printer->height() - boundingBox.top())*scale); } } else { + s << "%!PS-Adobe-1.0"; int w = width + (fullPage ? 0 : mleft + mright); int h = height + (fullPage ? 0 : mtop + mbottom); w = (int)(w*scale); diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index ea9dc5d..dd4de99 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -965,12 +965,13 @@ void QWin32PrintEnginePrivate::queryDefault() return; QStringList info = output.split(QLatin1Char(',')); - if (info.size() > 0) { + int infoSize = info.size(); + if (infoSize > 0) { if (name.isEmpty()) name = info.at(0); - if (program.isEmpty()) + if (program.isEmpty() && infoSize > 1) program = info.at(1); - if (port.isEmpty()) + if (port.isEmpty() && infoSize > 2) port = info.at(2); } } diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 3b5b9d3..feffc9f 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -112,16 +112,10 @@ void QS60MainAppUi::ConstructL() // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without // resource files in most SDKs. S60 3rd FP1 public seems to require resource file // even these flags are defined - TInt flags = CAknAppUi::EAknEnableSkin; - if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) { - flags |= CAknAppUi::ENoScreenFurniture | CAknAppUi::ENonStandardResourceFile; - } + TInt flags = CAknAppUi::EAknEnableSkin + | CAknAppUi::ENoScreenFurniture + | CAknAppUi::ENonStandardResourceFile; BaseConstructL(flags); - - if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) { - CEikButtonGroupContainer* nativeContainer = Cba(); - nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - } } /*! diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 7587343..90b8be3 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -92,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,17,"QVGA Landscape"}, -{320,240,1,17,"QVGA Portrait"}, -{360,640,1,17,"NHD Landscape"}, -{640,360,1,17,"NHD Portrait"}, +{240,320,1,18,"QVGA Landscape"}, +{320,240,1,18,"QVGA Portrait"}, +{360,640,1,18,"NHD Landscape"}, +{640,360,1,18,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -104,11 +104,11 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,0,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,0,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,0,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,0,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,0,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106} +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1, 106}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1, 106}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1, 135}, +{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1, 106} // *** End of generated data *** }; @@ -651,6 +651,8 @@ void QS60StylePrivate::setFont(QWidget *widget) const fontCategory = QS60StyleEnums::FC_Title; } else if (qobject_cast<QMessageBox *>(widget)){ fontCategory = QS60StyleEnums::FC_Primary; + } else if (qobject_cast<QMenu *>(widget)){ + fontCategory = QS60StyleEnums::FC_Primary; } if (fontCategory != QS60StyleEnums::FC_Undefined) { const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) @@ -1744,6 +1746,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem); optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth)); optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight)); + optionCheckBox.rect.moveCenter(QPoint( + optionCheckBox.rect.center().x(), + menuItem->rect.center().y())); const int moveByX = optionCheckBox.rect.width() + vSpacing; if (optionMenuItem.direction == Qt::LeftToRight) { textRect.translate(moveByX, 0); @@ -2424,6 +2429,10 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const if (metricValue == KNotFound) metricValue = QCommonStyle::pixelMetric(metric, option, widget); + // Menu scrollers should be set to zero height for combobox popups + if (metric == PM_MenuScrollerHeight && !qobject_cast<const QMenu *>(widget)) + metricValue = 0; + //if layout direction is mirrored, switch left and right border margins if (option && option->direction == Qt::RightToLeft) { if (metric == PM_LayoutLeftMargin) @@ -2483,7 +2492,14 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz.setHeight(naviPaneSize.height()); } break; + case CT_MenuItem: case CT_ItemViewItem: + if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { + if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { + sz = QSize(); + break; + } + } sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); if (QS60StylePrivate::isTouchSupported()) //Make itemview easier to use in touch devices @@ -2564,6 +2580,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_Menu_SelectionWrap: retValue = true; break; + case SH_Menu_MouseTracking: + retValue = true; + break; case SH_ItemView_ShowDecorationSelected: retValue = true; break; @@ -3150,6 +3169,12 @@ bool QS60Style::event(QEvent *e) #ifdef QT_KEYPAD_NAVIGATION case QEvent::FocusIn: if (QWidget *focusWidget = QApplication::focusWidget()) { + + // Menus and combobox popups do not draw focus frame around them + if (qobject_cast<QComboBoxListView *>(focusWidget) || + qobject_cast<QMenu *>(focusWidget)) + break; + if (!d->m_focusFrame) d->m_focusFrame = new QFocusFrame(focusWidget); d->m_focusFrame->setWidget(focusWidget); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 58a7159..55aa6b0 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -310,7 +310,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_All, -1,-1}, /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_All, -1,-1}, /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_All, -1,-1}, - /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_All, -1,-1}, + /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_All, -1,-1}, // ToolTip graphics different in 3.1 vs. 3.2+. /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */ @@ -919,7 +919,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr result = fromFbsBitmap(frame, NULL, flags, targetSize); } } else { - TDisplayMode maskDepth = EGray2; + TDisplayMode maskDepth = EGray256; // Query the skin item for possible frame graphics mask details. if (skinInstance) { CAknsMaskedBitmapItemData* skinMaskedBmp = static_cast<CAknsMaskedBitmapItemData*>( @@ -983,6 +983,10 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme frameId.Set(KAknsIIDQsnFrPopupSub); } break; + case QS60StylePrivate::SF_PopupBackground: + centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu); + frameId.Set(KAknsIIDQsnFrPopupSub); + break; case QS60StylePrivate::SF_PanelBackground: // remove center piece for panel graphics, so that only border is drawn centerId.Set(KAknsIIDNone); diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 81b923b..515b6c7 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1539,7 +1539,9 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCache->constFind(baseStyle()); if (defaultCacheIt == styleSheetCache->constEnd()) { defaultSs = getDefaultStyleSheet(); - styleSheetCache->insert(baseStyle(), defaultSs); + QStyle *bs = baseStyle(); + styleSheetCache->insert(bs, defaultSs); + QObject::connect(bs, SIGNAL(destroyed(QObject*)), this, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); } else { defaultSs = defaultCacheIt.value(); } @@ -2666,6 +2668,11 @@ void QStyleSheetStyle::widgetDestroyed(QObject *o) autoFillDisabledWidgets->remove((const QWidget *)o); } +void QStyleSheetStyle::styleDestroyed(QObject *o) +{ + styleSheetCache->remove(o); +} + /*! * Make sure that the cache will be clean by connecting destroyed if needed. * return false if the widget is not stylable; diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h index 50abef9..fd81437 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/gui/styles/qstylesheetstyle_p.h @@ -147,6 +147,7 @@ protected: private Q_SLOTS: void widgetDestroyed(QObject *); + void styleDestroyed(QObject *); private: int refcount; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 24887b5..21a31a3 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2616,10 +2616,8 @@ void QFontCache::cleanup() } QT_CATCH (const std::bad_alloc &) { // no cache - just ignore } - if (cache && cache->hasLocalData()) { - cache->localData()->clear(); + if (cache && cache->hasLocalData()) cache->setLocalData(0); - } } #endif // QT_NO_THREAD @@ -2631,6 +2629,7 @@ QFontCache::QFontCache() QFontCache::~QFontCache() { + clear(); { EngineDataCache::ConstIterator it = engineDataCache.constBegin(), end = engineDataCache.constEnd(); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index ae5e9ca..ff29462 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -598,10 +598,10 @@ static QList<QFontDatabase::WritingSystem> determineWritingSystemsFromTrueTypeBi #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // class with virtual destructor, derived in qfontdatabase_s60.cpp -class QFontDatabaseS60Store +class QSymbianFontDatabaseExtras { public: - virtual ~QFontDatabaseS60Store() {} + virtual ~QSymbianFontDatabaseExtras() {} }; #endif @@ -614,7 +614,7 @@ public: , stream(0) #endif #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - , s60Store(0) + , symbianExtras(0) #endif { } ~QFontDatabasePrivate() { @@ -628,9 +628,9 @@ public: families = 0; count = 0; #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - if (s60Store) { - delete s60Store; - s60Store = 0; + if (symbianExtras) { + delete symbianExtras; + symbianExtras = 0; } #endif // don't clear the memory fonts! @@ -675,7 +675,7 @@ public: QDataStream *stream; QStringList fallbackFamilies; #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - const QFontDatabaseS60Store *s60Store; + const QSymbianFontDatabaseExtras *symbianExtras; #endif }; diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index ef5e0c4..3ad0806 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -92,22 +92,22 @@ QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameF } #if defined(QT_NO_FREETYPE) -class QFontDatabaseS60StoreImplementation : public QFontDatabaseS60Store +class QSymbianFontDatabaseExtrasImplementation : public QSymbianFontDatabaseExtras { public: - QFontDatabaseS60StoreImplementation(); - ~QFontDatabaseS60StoreImplementation(); + QSymbianFontDatabaseExtrasImplementation(); + ~QSymbianFontDatabaseExtrasImplementation(); - const QFontEngineS60Extensions *extension(const QString &typeface) const; + const QSymbianTypeFaceExtras *extras(const QString &typeface) const; private: RHeap* m_heap; CFontStore *m_store; COpenFontRasterizer *m_rasterizer; - mutable QHash<QString, const QFontEngineS60Extensions *> m_extensions; + mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extras; }; -QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() +QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation() { m_heap = User::ChunkHeap(NULL, 0x1000, 0x100000); QT_TRAP_THROWING( @@ -127,10 +127,10 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr)); } } -QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() +QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation() { - typedef QHash<QString, const QFontEngineS60Extensions *>::iterator iterator; - for (iterator p = m_extensions.begin(); p != m_extensions.end(); ++p) { + typedef QHash<QString, const QSymbianTypeFaceExtras *>::iterator iterator; + for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) { m_store->ReleaseFont((*p)->fontOwner()); delete *p; } @@ -156,9 +156,9 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont) } #endif // FNTSTORE_H_INLINES_SUPPORT_FMM -const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(const QString &typeface) const +const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface) const { - if (!m_extensions.contains(typeface)) { + if (!m_extras.contains(typeface)) { CFont* font = NULL; TFontSpec spec(qt_QString2TPtrC(typeface), 1); spec.iHeight = 1; @@ -171,9 +171,9 @@ const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(c #else OpenFontFromBitmapFont(bitmapFont); #endif // FNTSTORE_H_INLINES_SUPPORT_FMM - m_extensions.insert(typeface, new QFontEngineS60Extensions(font, openFont)); + m_extras.insert(typeface, new QSymbianTypeFaceExtras(font, openFont)); } - return m_extensions.value(typeface); + return m_extras.value(typeface); } #else class QFontEngineFTS60 : public QFontEngineFT @@ -240,14 +240,14 @@ static void initializeDb() return; #if defined(QT_NO_FREETYPE) - if (!db->s60Store) - db->s60Store = new QFontDatabaseS60StoreImplementation; + if (!db->symbianExtras) + db->symbianExtras = new QSymbianFontDatabaseExtrasImplementation; QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); - const QFontDatabaseS60StoreImplementation *store = - static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); + const QSymbianFontDatabaseExtrasImplementation *dbExtras = + static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; @@ -273,8 +273,8 @@ static void initializeDb() style->smoothScalable = typefaceSupport.iIsScalable; style->pixelSize(0, true); - const QFontEngineS60Extensions *extension = store->extension(familyName); - const QByteArray os2Table = extension->getSfntTable(MAKE_TAG('O', 'S', '/', '2')); + const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(familyName); + const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2')); const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData()); const unsigned char* ulUnicodeRange = data + 42; quint32 unicodeRange[4] = { @@ -394,10 +394,10 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo QFontDef request = req; request.family = fontFamily; #if defined(QT_NO_FREETYPE) - const QFontDatabaseS60StoreImplementation *store = - static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); - const QFontEngineS60Extensions *extension = store->extension(fontFamily); - fe = new QFontEngineS60(request, extension); + const QSymbianFontDatabaseExtrasImplementation *dbExtras = + static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); + const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily); + fe = new QFontEngineS60(request, typeFaceExtras); #else QFontEngine::FaceId faceId; const QtFontFamily * const reqQtFontFamily = db->family(fontFamily); diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index c9ff661..a9960e4 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font) +QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font) : m_font(font) , m_cmap(0) , m_symbolCMap(false) @@ -68,7 +68,7 @@ QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont * Q_ASSERT(m_shapingExtension && m_trueTypeExtension); } -QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const +QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const { Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); TInt error = KErrNone; @@ -79,7 +79,7 @@ QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const return result; } -bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const +bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const { if (!m_trueTypeExtension->HasTrueTypeTable(tag)) return false; @@ -104,7 +104,7 @@ bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *l return result; } -const unsigned char *QFontEngineS60Extensions::cmap() const +const unsigned char *QSymbianTypeFaceExtras::cmap() const { if (!m_cmap) { m_cmapTable = getSfntTable(MAKE_TAG('c', 'm', 'a', 'p')); @@ -114,7 +114,7 @@ const unsigned char *QFontEngineS60Extensions::cmap() const return m_cmap; } -QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const +QPainterPath QSymbianTypeFaceExtras::glyphOutline(glyph_t glyph) const { QPainterPath result; QPolygonF polygon; @@ -134,7 +134,7 @@ QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const return result; } -CFont *QFontEngineS60Extensions::fontOwner() const +CFont *QSymbianTypeFaceExtras::fontOwner() const { return m_fontOwner; } @@ -192,8 +192,8 @@ void QFontEngineS60::releaseFont(CFont *&font) } } -QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Extensions *extensions) - : m_extensions(extensions) +QFontEngineS60::QFontEngineS60(const QFontDef &request, const QSymbianTypeFaceExtras *extras) + : m_extras(extras) , m_originalFont(0) , m_originalFontSizeInPixels((request.pixelSize >= 0)? request.pixelSize:pointsToPixels(request.pointSize)) @@ -220,10 +220,12 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout } HB_Glyph *g = glyphs->glyphs; - const unsigned char* cmap = m_extensions->cmap(); + const unsigned char* cmap = m_extras->cmap(); + const bool isRtl = (flags & QTextEngine::RightToLeft); for (int i = 0; i < len; ++i) { const unsigned int uc = getChar(characters, i, len); - *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc); + *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, + isRtl ? QChar::mirroredChar(uc) : uc); } glyphs->numGlyphs = g - glyphs->glyphs; @@ -241,8 +243,8 @@ void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla Q_UNUSED(flags); for (int i = 0; i < glyphs->numGlyphs; i++) { const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]); - glyphs->advances_x[i] = glyphs->offsets[i].x = bbox.xoff; - glyphs->advances_y[i] = glyphs->offsets[i].y = bbox.yoff; + glyphs->advances_x[i] = bbox.xoff; + glyphs->advances_y[i] = bbox.yoff; } } @@ -337,7 +339,7 @@ const char *QFontEngineS60::name() const bool QFontEngineS60::canRender(const QChar *string, int len) { - const unsigned char *cmap = m_extensions->cmap(); + const unsigned char *cmap = m_extras->cmap(); for (int i = 0; i < len; ++i) { const unsigned int uc = getChar(string, i, len); if (QFontEngine::getTrueTypeGlyphIndex(cmap, uc) == 0) @@ -348,12 +350,12 @@ bool QFontEngineS60::canRender(const QChar *string, int len) QByteArray QFontEngineS60::getSfntTable(uint tag) const { - return m_extensions->getSfntTable(tag); + return m_extras->getSfntTable(tag); } bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const { - return m_extensions->getSfntTableData(tag, buffer, length); + return m_extras->getSfntTableData(tag, buffer, length); } QFontEngine::Type QFontEngineS60::type() const diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index a80af4d..b6b117f 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -63,10 +63,10 @@ class CFont; QT_BEGIN_NAMESPACE // ..gives us access to truetype tables, UTF-16<->GlyphID mapping, and glyph outlines -class QFontEngineS60Extensions +class QSymbianTypeFaceExtras { public: - QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font); + QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font); QByteArray getSfntTable(uint tag) const; bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; @@ -87,7 +87,7 @@ private: class QFontEngineS60 : public QFontEngine { public: - QFontEngineS60(const QFontDef &fontDef, const QFontEngineS60Extensions *extensions); + QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras); ~QFontEngineS60(); bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; @@ -128,7 +128,7 @@ private: CFont *fontWithSize(qreal size) const; static void releaseFont(CFont *&font); - const QFontEngineS60Extensions *m_extensions; + const QSymbianTypeFaceExtras *m_extras; CFont* m_originalFont; const qreal m_originalFontSizeInPixels; CFont* m_scaledFont; diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 655fc61..c1c4abf 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -740,8 +740,14 @@ bool QLineEdit::validateAndSet(const QString &newText, int newPos, setText(oldText); return false; } - setCursorPosition(newPos); - setSelection(qMin(newMarkAnchor, newMarkDrag), qAbs(newMarkAnchor - newMarkDrag)); + int selstart = qMin(newMarkAnchor, newMarkDrag); + int sellength = qAbs(newMarkAnchor - newMarkDrag); + if (selstart == newPos) { + selstart = qMax(newMarkAnchor, newMarkDrag); + sellength = -sellength; + } + //setSelection also set the position + setSelection(selstart, sellength); return true; } #endif //QT3_SUPPORT diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 907dd14..f84059d 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -2803,7 +2803,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) QAction *action = d->actionAt(e->pos()); if (!action) { - if (d->hasHadMouse) + if (d->hasHadMouse + && (!d->currentAction + || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; } else if(e->buttons()) { |