diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-17 03:20:09 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-17 03:20:09 (GMT) |
commit | 4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656 (patch) | |
tree | 9db3085e15487c4b0580035eeb0b262b0ada5920 /src/gui | |
parent | d1d81d48dff6b3285d9016d8f3354630926463d8 (diff) | |
parent | fd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff) | |
download | Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.zip Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.tar.gz Qt-4cd7e2ebd675fdc0b00d9a29f64e4189e74f7656.tar.bz2 |
Merge remote branch 'origin/master' into bearermanagement/unit-tests
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qwindowsurface_s60.cpp | 10 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 45 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 2 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qtextedit.cpp | 13 |
7 files changed, 49 insertions, 37 deletions
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 6cbf3d9..028ec48 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -149,11 +149,19 @@ void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi Q_ASSERT(window); QTLWExtra *topExtra = window->d_func()->maybeTopData(); Q_ASSERT(topExtra); + QRect qr = region.boundingRect(); if (!topExtra->inExpose) { topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again - TRect tr = qt_QRect2TRect(region.boundingRect()); + TRect tr = qt_QRect2TRect(qr); widget->winId()->DrawNow(tr); topExtra->inExpose = false; + } else { + // This handles the case when syncBackingStore updates content outside of the + // original drawing rectangle. This might happen if there are pending update() + // events at the same time as we get a Draw() from Symbian. + QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect()); + if (!drawRect.contains(qr)) + widget->winId()->DrawDeferred(); } } diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 9025e5b..ea7399f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -289,6 +289,9 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_Editor: drawFrame(SF_FrameLineEdit, painter, rect, flags | SF_PointNorth); break; + case SE_DropArea: + drawPart(QS60StyleEnums::SP_QgnGrafOrgBgGrid, painter, rect, flags | SF_PointNorth); + break; default: break; } @@ -844,15 +847,18 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag result.setWidth(pixelMetric(PM_Custom_FrameCornerWidth)); break; - case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed: case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed: - case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed: case QS60StyleEnums::SP_QsnCpScrollBgBottom: - case QS60StyleEnums::SP_QsnCpScrollBgMiddle: case QS60StyleEnums::SP_QsnCpScrollBgTop: case QS60StyleEnums::SP_QsnCpScrollHandleBottom: - case QS60StyleEnums::SP_QsnCpScrollHandleMiddle: case QS60StyleEnums::SP_QsnCpScrollHandleTop: + case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed: + result.setHeight(pixelMetric(QStyle::PM_ScrollBarExtent)); + result.setWidth(pixelMetric(QStyle::PM_ScrollBarExtent)); + break; + case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed: + case QS60StyleEnums::SP_QsnCpScrollBgMiddle: + case QS60StyleEnums::SP_QsnCpScrollHandleMiddle: result.setHeight(pixelMetric(QStyle::PM_ScrollBarExtent)); result.setWidth(pixelMetric(QStyle::PM_ScrollBarSliderMin)); break; @@ -2271,14 +2277,16 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StyleEnums::SkinParts skinPart = (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; int minDimension = qMin(option->rect.width(), option->rect.height()); - const int resizeValue = minDimension >> 1; - minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension)); - int verticalMagic(0); - // magic values for positioning svg icon. - if (option->rect.width() <= option->rect.height()) - verticalMagic = 3; - iconRect.translate(3, verticalMagic - resizeValue); + const int magicTweak = 3; + int resizeValue = minDimension >> 1; + if (!QS60StylePrivate::isTouchSupported()) { + minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. + iconRect.setSize(QSize(minDimension, minDimension)); + const int verticalMagic = (option->rect.width() <= option->rect.height()) ? magicTweak : 0; + resizeValue = verticalMagic - resizeValue; + } + iconRect.translate(magicTweak, resizeValue); QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); } } @@ -2302,7 +2310,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; case PE_PanelScrollAreaCorner: break; - + case PE_IndicatorItemViewItemDrop: + if (QS60StylePrivate::isTouchSupported()) + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_DropArea, painter, option->rect, flags); + else + commonStyleDraws = true; + break; // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: case PE_IndicatorDockWidgetResizeHandle: @@ -2323,7 +2336,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_TOOLBAR #ifndef QT_NO_COLUMNVIEW case PE_IndicatorColumnViewArrow: - case PE_IndicatorItemViewItemDrop: #endif //QT_NO_COLUMNVIEW case PE_FrameTabBarBase: // since tabs are in S60 always in navipane, let's use common style for tab base in Qt. default: @@ -2481,6 +2493,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FormLayoutWrapPolicy: retValue = QFormLayout::WrapLongRows; break; + case SH_ScrollBar_ContextMenu: + retValue = false; + break; default: retValue = QCommonStyle::styleHint(sh, opt, widget, hret); break; @@ -2559,11 +2574,11 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; const int buttonMargin = spinbox->frame ? 2 : 0; - const int buttonWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; + const int buttonContentWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; QSize buttonSize; buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness)); //width should at least be equal to height - buttonSize.setWidth(qMax(buttonSize.height(), buttonWidth)); + buttonSize.setWidth(qMax(buttonSize.height(), buttonContentWidth)); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); const int y = frameThickness + spinbox->rect.y(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index eae2291..ea30b81 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -131,6 +131,7 @@ public: SP_QgnGrafBarFrameSideL, SP_QgnGrafBarFrameSideR, SP_QgnGrafBarProgress, + SP_QgnGrafOrgBgGrid, SP_QgnGrafScrollArrowDown, SP_QgnGrafScrollArrowLeft, SP_QgnGrafScrollArrowRight, @@ -428,6 +429,7 @@ public: SE_ScrollBarHandlePressedVertical, SE_ButtonInactive, SE_Editor, + SE_DropArea }; enum SkinFrameElements { diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 6d9ba05..cb49fbc 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -178,6 +178,8 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1}, /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1}, + // No drop area for 3.x non-touch devices + /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1}, /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1}, /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1}, diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 141f844..0ba8b9f 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1637,12 +1637,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) if (!hasEditFocus() && !(event->modifiers() & Qt::ControlModifier)) { if (!event->text().isEmpty() && event->text().at(0).isPrint() && !isReadOnly()) - { setEditFocus(true); -#ifndef Q_OS_SYMBIAN - clear(); -#endif - } else { + else { event->ignore(); return; } @@ -1698,12 +1694,8 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) // commit text as they focus out without interfering with focus if (QApplication::keypadNavigationEnabled() && hasFocus() && !hasEditFocus() - && !e->preeditString().isEmpty()) { + && !e->preeditString().isEmpty()) setEditFocus(true); -#ifndef Q_OS_SYMBIAN - selectAll(); // so text is replaced rather than appended to -#endif - } #endif d->control->processInputMethodEvent(e); diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 02ffe13..0d798b7 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -2394,7 +2394,7 @@ void QPlainTextEdit::setReadOnly(bool ro) then the focus policy is also automatically set to Qt::ClickFocus. The default value depends on whether the QPlainTextEdit is read-only - or editable, and whether it is a QTextBrowser or not. + or editable. */ void QPlainTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index b6886b4..4541730 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1212,12 +1212,9 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) default: if (QApplication::keypadNavigationEnabled()) { if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) { - if (e->text()[0].isPrint()) { + if (e->text()[0].isPrint()) setEditFocus(true); -#ifndef Q_OS_SYMBIAN - clear(); -#endif - } else { + else { e->ignore(); return; } @@ -1677,12 +1674,8 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e) #ifdef QT_KEYPAD_NAVIGATION if (d->control->textInteractionFlags() & Qt::TextEditable && QApplication::keypadNavigationEnabled() - && !hasEditFocus()) { + && !hasEditFocus()) setEditFocus(true); -#ifndef Q_OS_SYMBIAN - selectAll(); // so text is replaced rather than appended to -#endif - } #endif d->sendControlEvent(e); ensureCursorVisible(); |