diff options
author | axis <qt-info@nokia.com> | 2009-11-26 14:56:42 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-26 14:56:42 (GMT) |
commit | 236d8ad3aedd09e905df97412380545d0986be2c (patch) | |
tree | 79b9e59bb232f2d5bd2b3ea6c1d93d095b8aa32b /src/gui | |
parent | d014d49c88d4fa31c46afb2c252e481177b30a55 (diff) | |
parent | 4160adc44a512a97d333227cfdde0648fb4132a9 (diff) | |
download | Qt-236d8ad3aedd09e905df97412380545d0986be2c.zip Qt-236d8ad3aedd09e905df97412380545d0986be2c.tar.gz Qt-236d8ad3aedd09e905df97412380545d0986be2c.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-staging2
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 56 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 30 | ||||
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 23 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 11 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 12 |
7 files changed, 68 insertions, 67 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fb2bc72..89d961c 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -133,36 +133,46 @@ private: TTimeIntervalMicroSeconds iDuration; }; +static QS60Beep* qt_S60Beep = 0; + QS60Beep::~QS60Beep() { + if (iToneUtil) { + switch (iState) { + case EBeepPlaying: + iToneUtil->CancelPlay(); + break; + case EBeepNotPrepared: + iToneUtil->CancelPrepare(); + break; + } + } delete iToneUtil; } QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) { - QS60Beep* self=new (ELeave) QS60Beep(); + QS60Beep* self = new (ELeave) QS60Beep(); CleanupStack::PushL(self); self->ConstructL(aFrequency, aDuration); CleanupStack::Pop(); return self; -}; +} void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) { - iToneUtil=CMdaAudioToneUtility::NewL(*this); - iState=EBeepNotPrepared; - iFrequency=aFrequency; - iDuration=aDuration; - iToneUtil->PrepareToPlayTone(iFrequency,iDuration); + iToneUtil = CMdaAudioToneUtility::NewL(*this); + iState = EBeepNotPrepared; + iFrequency = aFrequency; + iDuration = aDuration; + iToneUtil->PrepareToPlayTone(iFrequency, iDuration); } void QS60Beep::Play() { - if (iState != EBeepNotPrepared) { - if (iState == EBeepPlaying) { - iToneUtil->CancelPlay(); - iState = EBeepPrepared; - } + if (iState == EBeepPlaying) { + iToneUtil->CancelPlay(); + iState = EBeepPrepared; } iToneUtil->Play(); @@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError) { if (aError == KErrNone) { iState = EBeepPrepared; + Play(); } } void QS60Beep::MatoPlayComplete(TInt aError) { Q_UNUSED(aError); - iState=EBeepPrepared; + iState = EBeepPrepared; } @@ -1226,6 +1237,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) *****************************************************************************/ void qt_cleanup() { + if(qt_S60Beep) { + delete qt_S60Beep; + qt_S60Beep = 0; + } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles // S60 structure and window server session are freed in eventdispatcher destructor as they are needed there @@ -1467,14 +1482,13 @@ void QApplication::setCursorFlashTime(int msecs) void QApplication::beep() { - TInt frequency=440; - TTimeIntervalMicroSeconds duration(500000); - QS60Beep* beep=NULL; - TRAPD(err, beep=QS60Beep::NewL(frequency, duration)); - if (!err) - beep->Play(); - delete beep; - beep=NULL; + if (!qt_S60Beep) { + TInt frequency = 880; + TTimeIntervalMicroSeconds duration(500000); + TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration)); + } + if (qt_S60Beep) + qt_S60Beep->Play(); } /*! diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fbb9115..b389054 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4605,7 +4605,7 @@ void QWidgetPrivate::updateFont(const QFont &font) if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); - } else + } else #endif //QT_NO_GRAPHICSVIEW if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedFontResolveMask = 0; @@ -9897,13 +9897,13 @@ void QWidget::scroll(int dx, int dy) Q_D(QWidget); #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { - // Graphics View maintains its own dirty region as a list of rects; - // until we can connect item updates directly to the view, we must - // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + // Graphics View maintains its own dirty region as a list of rects; + // until we can connect item updates directly to the view, we must + // separately add a translated dirty region. + if (!d->dirty.isEmpty()) { + foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) + proxy->update(rect); + } proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -9932,13 +9932,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r) Q_D(QWidget); #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { - // Graphics View maintains its own dirty region as a list of rects; - // until we can connect item updates directly to the view, we must - // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) - proxy->update(rect); - } + // Graphics View maintains its own dirty region as a list of rects; + // until we can connect item updates directly to the view, we must + // separately add a translated dirty region. + if (!d->dirty.isEmpty()) { + foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + proxy->update(rect); + } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); return; } diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 8226797..1b8f413 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -949,6 +949,8 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) return; QWidgetBackingStore *wbs = x->backingStore; + if (!wbs) + return; static int accelEnv = -1; if (accelEnv == -1) { diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index ee10ff6..dca78ca 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -144,7 +144,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed}, {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, - {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter}, + {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, }; static const int frameElementsCount = @@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const storeThemePalette(&widgetPalette); } -void QS60StylePrivate::setThemePalette(QStyleOption *option) const -{ - setThemePalette(&option->palette); -} - QPalette* QS60StylePrivate::themePalette() { return m_themePalette; @@ -640,16 +635,16 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const { if(!widget) return; - QPalette widgetPalette = QApplication::palette(widget); //header view and its viewport need to be set 100% transparent button color, since drawing code will //draw transparent theme graphics to table column and row headers. if (qobject_cast<QHeaderView *>(widget)){ + QPalette widgetPalette = QApplication::palette(widget); widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); QHeaderView* header = qobject_cast<QHeaderView *>(widget); widgetPalette.setColor(QPalette::Button, Qt::transparent ); - if ( header->viewport() ) + if (header->viewport()) header->viewport()->setPalette(widgetPalette); QApplication::setPalette(widgetPalette, "QHeaderView"); } @@ -812,7 +807,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag case QS60StyleEnums::SP_QgnGrafTabActiveL: //Returned QSize for tabs must not be square, but narrow rectangle with width:height //ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones). - result.setWidth(10); + result.setWidth(result.height()>>1); break; case QS60StyleEnums::SP_QgnIndiSliderEdit: result.scale(pixelMetric(QStyle::PM_SliderLength), @@ -870,7 +865,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag return result; } -bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush) +bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush) { //If brush is not changed from style's default values, draw theme graphics. return (backgroundBrush.color() == Qt::transparent || @@ -1788,7 +1783,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (qobject_cast<const QAbstractButton *>(widget)) { //Make cornerButton slightly smaller so that it is not on top of table border graphic. QStyleOptionHeader subopt = *header; - const int borderTweak = + const int borderTweak = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1; if (subopt.direction == Qt::LeftToRight) subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak); @@ -1881,7 +1876,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest); } else { const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - if (option->direction == Qt::LeftToRight) + if (option->direction == Qt::LeftToRight) headerRect.adjust(-2*frameWidth, 0, 0, 0); else headerRect.adjust(0, 0, 2*frameWidth, 0); @@ -2027,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti buttonRect.setHeight((int)(buttonRect.height() * scaler)); // move the rect up for half of the new height-gain const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ; - buttonRect.adjust(0,-newY,0,-newY); + buttonRect.adjust(0, -newY, -1, -newY); painter->save(); QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option); @@ -2596,7 +2591,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin); const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth); ret = toolButton->rect; - const bool popup = (toolButton->features & + const bool popup = (toolButton->features & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::MenuButtonPopup; switch (scontrol) { diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ea86bb2..5ab2308 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -271,15 +271,6 @@ public: SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, SP_QsnFrButtonCenterInactive, - SP_QsnFrNotepadCornerTl, - SP_QsnFrNotepadCornerTr, - SP_QsnFrNotepadCornerBl, - SP_QsnFrNotepadCornerBr, - SP_QsnFrNotepadSideT, - SP_QsnFrNotepadSideB, - SP_QsnFrNotepadSideL, - SP_QsnFrNotepadSideR, - SP_QsnFrNotepadCenter }; enum ColorLists { @@ -418,8 +409,6 @@ public: //set theme palette for application void setThemePalette(QApplication *application) const; - //set theme palette for style option - void setThemePalette(QStyleOption *option) const; //access to theme palette static QPalette* themePalette(); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 501e62f..557acfb 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -120,6 +120,7 @@ void QMainWindowPrivate::init() #ifdef QT_SOFTKEYS_ENABLED menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); + menuBarAction->setVisible(false); #endif } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 761a060..2e27226 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -229,7 +229,7 @@ void QMenuPrivate::updateActionRects() const Q_Q(const QMenu); if (!itemsDirty) return; - + q->ensurePolished(); //let's reinitialize the buffer @@ -292,7 +292,7 @@ void QMenuPrivate::updateActionRects() const if (!action->isVisible() || (collapsibleSeparators && previousWasSeparator && action->isSeparator())) continue; // we continue, this action will get an empty QRect - + previousWasSeparator = action->isSeparator(); //let the style modify the above size.. @@ -1139,7 +1139,7 @@ void QMenuPrivate::_q_actionTriggered() //we check the parent hierarchy QList< QPointer<QWidget> > list; for(QWidget *widget = q->parentWidget(); widget; ) { - if (qobject_cast<QMenu*>(widget) + if (qobject_cast<QMenu*>(widget) #ifndef QT_NO_MENUBAR || qobject_cast<QMenuBar*>(widget) #endif @@ -1306,7 +1306,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) the addAction(), addActions() and insertAction() functions. An action is represented vertically and rendered by QStyle. In addition, actions can have a text label, an optional icon drawn on the very left side, - and shortcut key sequence such as "Ctrl+X". + and shortcut key sequence such as "Ctrl+X". The existing actions held by a menu can be found with actions(). @@ -1906,9 +1906,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction) pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1)); } else { if (pos.x()+size.width()-1 > screen.right()-desktopFrame) - pos.setX(qMin(p.x()+size.width(), screen.right()-desktopFrame-size.width()+1)); + pos.setX(screen.right()-desktopFrame-size.width()+1); if (pos.x() < screen.left()+desktopFrame) - pos.setX(qMax(p.x(), screen.left() + desktopFrame)); + pos.setX(screen.left() + desktopFrame); } if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { if(snapToMouse) |