diff options
author | axis <qt-info@nokia.com> | 2010-03-18 07:57:42 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-03-18 07:57:42 (GMT) |
commit | d3cba714adb35098d515f7c4f8e90a4e38527d76 (patch) | |
tree | 60018e4f20fc6b58017081b5e9e043d36a7ee3a9 | |
parent | 09c2a804b700ec51f44bda567b806181d00bc161 (diff) | |
parent | e483886bcfcf7252af9ac7cc89de15f912bf69da (diff) | |
download | Qt-d3cba714adb35098d515f7c4f8e90a4e38527d76.zip Qt-d3cba714adb35098d515f7c4f8e90a4e38527d76.tar.gz Qt-d3cba714adb35098d515f7c4f8e90a4e38527d76.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-s60
Conflicts:
qmake/generators/symbian/symmake_abld.cpp
20 files changed, 230 insertions, 103 deletions
diff --git a/demos/embedded/anomaly/src/BrowserView.cpp b/demos/embedded/anomaly/src/BrowserView.cpp index 0945b89..41318ad 100644 --- a/demos/embedded/anomaly/src/BrowserView.cpp +++ b/demos/embedded/anomaly/src/BrowserView.cpp @@ -82,6 +82,7 @@ void BrowserView::initialize() connect(m_controlStrip, SIGNAL(menuClicked()), SIGNAL(menuButtonClicked())); connect(m_controlStrip, SIGNAL(backClicked()), m_webView, SLOT(back())); connect(m_controlStrip, SIGNAL(forwardClicked()), m_webView, SLOT(forward())); + connect(m_controlStrip, SIGNAL(closeClicked()), qApp, SLOT(quit())); QPalette pal = m_webView->palette(); pal.setBrush(QPalette::Base, Qt::white); diff --git a/demos/embedded/anomaly/src/ControlStrip.cpp b/demos/embedded/anomaly/src/ControlStrip.cpp index 265d9a0..dc6d5c2 100644 --- a/demos/embedded/anomaly/src/ControlStrip.cpp +++ b/demos/embedded/anomaly/src/ControlStrip.cpp @@ -50,6 +50,7 @@ ControlStrip::ControlStrip(QWidget *parent) menuPixmap.load(":/images/edit-find.png"); backPixmap.load(":/images/go-previous.png"); forwardPixmap.load(":/images/go-next.png"); + closePixmap.load(":/images/button-close.png"); } QSize ControlStrip::sizeHint() const @@ -74,12 +75,18 @@ void ControlStrip::mousePressEvent(QMouseEvent *event) } if (x > width() - h) { - emit forwardClicked(); + emit closeClicked(); event->accept(); return; } if ((x < width() - 2 * h) && (x > width() - 3 * h)) { + emit forwardClicked(); + event->accept(); + return; + } + + if ((x < width() - 3 * h) && (x > width() - 5 * h)) { emit backClicked(); event->accept(); return; @@ -95,7 +102,9 @@ void ControlStrip::paintEvent(QPaintEvent *event) p.fillRect(event->rect(), QColor(32, 32, 32, 192)); p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.drawPixmap(s, s, menuPixmap); - p.drawPixmap(width() - 3 * h + s, s, backPixmap); - p.drawPixmap(width() - h + s, s, forwardPixmap); + p.drawPixmap(width() - h + s, s, closePixmap); + p.drawPixmap(width() - 3 * h + s, s, forwardPixmap); + p.drawPixmap(width() - 5 * h + s, s, backPixmap); + p.end(); } diff --git a/demos/embedded/anomaly/src/ControlStrip.h b/demos/embedded/anomaly/src/ControlStrip.h index bbaea87..b6003a1 100644 --- a/demos/embedded/anomaly/src/ControlStrip.h +++ b/demos/embedded/anomaly/src/ControlStrip.h @@ -58,6 +58,7 @@ signals: void menuClicked(); void backClicked(); void forwardClicked(); + void closeClicked(); protected: void paintEvent(QPaintEvent *event); @@ -67,6 +68,7 @@ private: QPixmap menuPixmap; QPixmap backPixmap; QPixmap forwardPixmap; + QPixmap closePixmap; }; #endif // CONTROLSTRIP_H diff --git a/demos/embedded/anomaly/src/anomaly.qrc b/demos/embedded/anomaly/src/anomaly.qrc index 601a34e..d8ea630 100644 --- a/demos/embedded/anomaly/src/anomaly.qrc +++ b/demos/embedded/anomaly/src/anomaly.qrc @@ -5,5 +5,6 @@ <file>images/edit-find.png</file> <file>images/list-add.png</file> <file>images/list-remove.png</file> + <file>images/button-close.png</file> </qresource> </RCC> diff --git a/demos/embedded/anomaly/src/images/button-close.png b/demos/embedded/anomaly/src/images/button-close.png Binary files differnew file mode 100644 index 0000000..7a7b048 --- /dev/null +++ b/demos/embedded/anomaly/src/images/button-close.png diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm index daf33d4..1338515 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_extra_pre_targetdep.flm @@ -10,6 +10,8 @@ SINGLETON:=$(call sanitise,TARGET_$(PREDEP_TARGET)) +$(call makepathfor,$(PREDEP_TARGET)) + define qmake_extra_pre_targetdep EXPORT:: $(PREDEP_TARGET) diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index f05e7ff..0ba1a3c 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -204,6 +204,8 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; t << "MOVE = " << var("QMAKE_MOVE") << endl; + t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; #ifdef Q_OS_WIN32 t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; t << "ABLD = ABLD.BAT" << endl; diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index d1d0104..c817056 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -147,6 +147,8 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; t << "MOVE = " << var("QMAKE_MOVE") << endl; t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 728c316..aa1c7d9 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -62,21 +62,25 @@ static const int QFILE_WRITEBUFFER_SIZE = 16384; static QByteArray locale_encode(const QString &f) { -#ifndef Q_OS_DARWIN - return f.toLocal8Bit(); -#else +#if defined(Q_OS_DARWIN) // Mac always expects UTF-8... and decomposed... return f.normalized(QString::NormalizationForm_D).toUtf8(); +#elif defined(Q_OS_SYMBIAN) + return f.toUtf8(); +#else + return f.toLocal8Bit(); #endif } static QString locale_decode(const QByteArray &f) { -#ifndef Q_OS_DARWIN - return QString::fromLocal8Bit(f); -#else +#if defined(Q_OS_DARWIN) // Mac always gives us UTF-8 and decomposed, we want that composed... return QString::fromUtf8(f).normalized(QString::NormalizationForm_C); +#elif defined(Q_OS_SYMBIAN) + return QString::fromUtf8(f); +#else + return QString::fromLocal8Bit(f); #endif } diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index a39ccfd..483eb62 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -1315,6 +1315,8 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) return; } + d->proxyIsGivingFocus = true; + switch (event->reason()) { case Qt::TabFocusReason: { if (QWidget *focusChild = d->findFocusChild(0, true)) @@ -1328,10 +1330,11 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) default: if (d->widget && d->widget->focusWidget()) { d->widget->focusWidget()->setFocus(event->reason()); - return; } break; } + + d->proxyIsGivingFocus = false; } /*! diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h index 60eb058..8aed363 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget_p.h +++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h @@ -118,6 +118,7 @@ public: quint32 styleChangeMode : 2; quint32 paletteChangeMode : 2; quint32 focusFromWidgetToProxy : 1; + quint32 proxyIsGivingFocus : 1; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 573bac6..27b490b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -52,6 +52,7 @@ #include "qstring.h" #include "qdebug.h" #include "qimage.h" +#include "qcombobox.h" #include "private/qkeymapper_p.h" #include "private/qfont_p.h" #ifndef QT_NO_STYLE_S60 @@ -1409,11 +1410,13 @@ void QApplicationPrivate::leaveModal_sys(QWidget *widget) void QApplicationPrivate::openPopup(QWidget *popup) { + if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) + static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(ETrue); + if (!QApplicationPrivate::popupWidgets) QApplicationPrivate::popupWidgets = new QWidgetList; QApplicationPrivate::popupWidgets->append(popup); - // Cancel focus widget pointer capture and long tap timer if (QApplication::focusWidget()) { static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer(); @@ -1452,6 +1455,9 @@ void QApplicationPrivate::openPopup(QWidget *popup) void QApplicationPrivate::closePopup(QWidget *popup) { + if (popup && qobject_cast<QComboBox *>(popup->parentWidget())) + static_cast<QSymbianControl *>(popup->effectiveWinId())->FadeBehindPopup(EFalse); + if (!QApplicationPrivate::popupWidgets) return; QApplicationPrivate::popupWidgets->removeAll(popup); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e5310ea..af5fcd1 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6171,6 +6171,8 @@ void QWidget::setFocus(Qt::FocusReason reason) previousProxyFocus = topData->proxyWidget->widget()->focusWidget(); if (previousProxyFocus && previousProxyFocus->focusProxy()) previousProxyFocus = previousProxyFocus->focusProxy(); + if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus) + return; } } #endif diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index bf5a62e..a2ebebb 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -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,-909,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}, -{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,-909,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}, -{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,-909,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}, -{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,-909,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}, -{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,-909,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} +{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}, +{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}, +{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}, +{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}, +{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} // *** End of generated data *** }; @@ -2475,6 +2475,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w { int retValue = -1; switch (sh) { + case SH_ComboBox_Popup: + retValue = true; + break; case SH_Table_GridLineColor: retValue = int(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 2, 0).rgba()); break; @@ -2690,6 +2693,19 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple height - 2 * frameThickness); } break; + case SC_ComboBoxListBoxPopup: { + const QRect desktopContent = QApplication::desktop()->availableGeometry(); + + // take the size of this and position bottom above available area + QRect popupRect; + const int width = desktopContent.width() - pixelMetric(PM_LayoutRightMargin) - pixelMetric(PM_LayoutLeftMargin); + popupRect.setWidth(width); + popupRect.setHeight(desktopContent.height()); //combobox resets height anyway based on content + popupRect.setBottom(desktopContent.bottom()); + popupRect.translate(pixelMetric(PM_LayoutLeftMargin), 0); + ret = popupRect; + } + break; default: break; } @@ -2844,9 +2860,13 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con ret = menuItem->rect; if (element == SE_ItemViewItemDecoration) { - if (menuItem->direction == Qt::RightToLeft) - ret.translate(ret.width()-indicatorWidth, 0); - ret.setWidth(indicatorWidth); + if (menuItem->icon.isNull()) { + ret = QRect(); + } else { + if (menuItem->direction == Qt::RightToLeft) + ret.translate(ret.width()-indicatorWidth, 0); + ret.setWidth(indicatorWidth); + } } else { ret = menuItem->rect; if (!menuItem->icon.isNull()) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index f71d250..c16f18a 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -532,9 +532,11 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) QStyleOptionComboBox opt = comboStyleOption(); const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); #ifndef QT_NO_SCROLLBAR +#ifndef Q_WS_S60 if (usePopup) view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); #endif +#endif if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) || usePopup) { view->setMouseTracking(true); @@ -2417,24 +2419,44 @@ void QComboBox::showPopup() // Position horizontally. listRect.moveLeft(above.x()); +#ifndef Q_WS_S60 // Position vertically so the curently selected item lines up // with the combo box. const QRect currentItemRect = view()->visualRect(view()->currentIndex()); const int offset = listRect.top() - currentItemRect.top(); listRect.moveTop(above.y() + offset - listRect.top()); +#endif // Clamp the listRect height and vertical position so we don't expand outside the // available screen geometry.This may override the vertical position, but it is more // important to show as much as possible of the popup. const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height()); +#ifdef Q_WS_S60 + //popup needs to be stretched with screen minimum dimension + listRect.setHeight(qMin(screen.height(), screen.width())); +#else listRect.setHeight(height); +#endif + if (boundToScreen) { if (listRect.top() < screen.top()) listRect.moveTop(screen.top()); if (listRect.bottom() > screen.bottom()) listRect.moveBottom(screen.bottom()); } +#ifdef Q_WS_S60 + if (screen.width() < screen.height()) { + // in portait, menu should be positioned above softkeys + listRect.moveBottom(screen.bottom()); + } else { + // landscape, menu should be at the right and horizontally centered + listRect.setWidth(listRect.height()); + listRect.moveCenter(screen.center()); + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } +#endif } else if (!boundToScreen || listRect.height() <= belowHeight) { listRect.moveTopLeft(below); } else if (listRect.height() <= aboveHeight) { @@ -2643,6 +2665,34 @@ void QComboBox::changeEvent(QEvent *e) if (d->lineEdit) d->updateLineEditGeometry(); d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem); + +#ifdef Q_WS_S60 + if (d->container) { + QStyleOptionComboBox opt; + initStyleOption(&opt); + + if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { + const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); + + QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt, + QStyle::SC_ComboBoxListBoxPopup, this)); + listRect.setHeight(qMin(screen.height(), screen.width())); + + if (screen.width() < screen.height()) { + // in portait, menu should be positioned above softkeys + listRect.moveBottom(screen.bottom()); + } else { + // landscape, menu should be at the right and horizontally centered + listRect.setWidth(listRect.height()); + listRect.moveCenter(screen.center()); + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); + } + d->container->setGeometry(listRect); + } + } +#endif + // ### need to update scrollers etc. as well here break; case QEvent::EnabledChange: diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index 74dfdc9..92d85cc 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -270,7 +270,9 @@ protected: const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionMenuItem opt = getStyleOption(option, index); +#ifndef Q_WS_S60 painter->fillRect(option.rect, opt.palette.background()); +#endif mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo); } QSize sizeHint(const QStyleOptionViewItem &option, diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 44814cc..8adf5af 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -459,10 +459,6 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) #if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) if (type == QPixmapData::SgImage && pixmap) { RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap); - // when "0" used as argument then - // default display, context are used - if (!context) - context = qt_vg_create_context(0, QInternal::Pixmap); destroyImages(); prevSize = QSize(); @@ -500,7 +496,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(context->display(), + EGLImageKHR eglImage = eglCreateImageKHR(QEglContext::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, @@ -515,7 +511,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) vgImage = vgCreateEGLImageTargetKHR(eglImage); if(vgGetError() != VG_NO_ERROR) { cleanup(); - eglDestroyImageKHR(context->display(), eglImage); + eglDestroyImageKHR(QEglContext::display(), eglImage); SgDriver::Close(); return; } @@ -529,7 +525,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) prevSize = QSize(w, h); setSerialNumber(++qt_vg_pixmap_serial); // release stuff - eglDestroyImageKHR(context->display(), eglImage); + eglDestroyImageKHR(QEglContext::display(), eglImage); SgDriver::Close(); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); @@ -624,7 +620,7 @@ void* QVGPixmapData::toNativeType(NativeType type) } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(context->display(), + EGLImageKHR eglImage = eglCreateImageKHR(QEglContext::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, @@ -637,7 +633,7 @@ void* QVGPixmapData::toNativeType(NativeType type) VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); if(vgGetError() != VG_NO_ERROR) { - eglDestroyImageKHR(context->display(), eglImage); + eglDestroyImageKHR(QEglContext::display(), eglImage); sgImage->Close(); SgDriver::Close(); return 0; @@ -653,7 +649,7 @@ void* QVGPixmapData::toNativeType(NativeType type) } // release stuff vgDestroyImage(dstVgImage); - eglDestroyImageKHR(context->display(), eglImage); + eglDestroyImageKHR(QEglContext::display(), eglImage); SgDriver::Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 693312a..f46d6c2 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -230,9 +230,9 @@ static QEglContext *createContext(QPaintDevice *device) // Set the swap interval for the display. QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); if (!interval.isEmpty()) - eglSwapInterval(context->display(), interval.toInt()); + eglSwapInterval(QEglContext::display(), interval.toInt()); else - eglSwapInterval(context->display(), 1); + eglSwapInterval(QEglContext::display(), 1); #ifdef EGL_RENDERABLE_TYPE // Has the user specified an explicit EGL configuration to use? @@ -246,16 +246,16 @@ static QEglContext *createContext(QPaintDevice *device) EGLint matching = 0; EGLConfig cfg; if (eglChooseConfig - (context->display(), properties, &cfg, 1, &matching) && + (QEglContext::display(), properties, &cfg, 1, &matching) && matching > 0) { // Check that the selected configuration actually supports OpenVG // and then create the context with it. EGLint id = 0; EGLint type = 0; eglGetConfigAttrib - (context->display(), cfg, EGL_CONFIG_ID, &id); + (QEglContext::display(), cfg, EGL_CONFIG_ID, &id); eglGetConfigAttrib - (context->display(), cfg, EGL_RENDERABLE_TYPE, &type); + (QEglContext::display(), cfg, EGL_RENDERABLE_TYPE, &type); if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) { context->setConfig(cfg); if (!context->createContext()) { @@ -334,7 +334,7 @@ static void qt_vg_destroy_shared_context(QVGSharedContext *shared) shared->engine = 0; shared->context->doneCurrent(); if (shared->surface != EGL_NO_SURFACE) { - eglDestroySurface(shared->context->display(), shared->surface); + eglDestroySurface(QEglContext::display(), shared->surface); shared->surface = EGL_NO_SURFACE; } delete shared->context; @@ -412,7 +412,7 @@ EGLSurface qt_vg_shared_surface(void) attribs[4] = EGL_NONE; } shared->surface = eglCreatePbufferSurface - (shared->context->display(), shared->context->config(), attribs); + (QEglContext::display(), shared->context->config(), attribs); } return shared->surface; } @@ -555,7 +555,7 @@ void QVGEGLWindowSurfaceVGImage::beginPaint(QWidget *widget) context->makeCurrent(mainSurface()); recreateBackBuffer = false; if (backBufferSurface != EGL_NO_SURFACE) { - eglDestroySurface(context->display(), backBufferSurface); + eglDestroySurface(QEglContext::display(), backBufferSurface); backBufferSurface = EGL_NO_SURFACE; } if (backBuffer != VG_INVALID_HANDLE) { @@ -568,7 +568,7 @@ void QVGEGLWindowSurfaceVGImage::beginPaint(QWidget *widget) if (backBuffer != VG_INVALID_HANDLE) { // Create an EGL surface for rendering into the VGImage. backBufferSurface = eglCreatePbufferFromClientBuffer - (context->display(), EGL_OPENVG_IMAGE, + (QEglContext::display(), EGL_OPENVG_IMAGE, (EGLClientBuffer)(backBuffer), context->config(), NULL); if (backBufferSurface == EGL_NO_SURFACE) { @@ -704,7 +704,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) #if defined(QVG_DIRECT_TO_WINDOW) // Did we get a direct to window rendering surface? EGLint buffer = 0; - if (eglQueryContext(context->display(), context->context(), + if (eglQueryContext(QEglContext::display(), context->context(), EGL_RENDER_BUFFER, &buffer) && buffer == EGL_SINGLE_BUFFER) { needToSwap = false; @@ -714,7 +714,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) // Try to force the surface back buffer to preserve its contents. if (needToSwap) { eglGetError(); // Clear error state first. - eglSurfaceAttrib(context->display(), surface, + eglSurfaceAttrib(QEglContext::display(), surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); if (eglGetError() != EGL_SUCCESS) { qWarning("QVG: could not enable preserved swap"); diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 69d2ad2..23b3458 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -3426,85 +3426,106 @@ void tst_QGraphicsProxyWidget::clickFocus() scene.setItemIndexMethod(QGraphicsScene::NoIndex); QGraphicsProxyWidget *proxy = scene.addWidget(new QLineEdit); - EventSpy proxySpy(proxy); - EventSpy widgetSpy(proxy->widget()); - QGraphicsView view(&scene); - view.setFrameStyle(0); - view.resize(300, 300); - view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QApplication::setActiveWindow(&view); - QTest::qWait(25); - QTRY_COMPARE(QApplication::activeWindow(), &view); - QVERIFY(!proxy->hasFocus()); - QVERIFY(!proxy->widget()->hasFocus()); + { + EventSpy proxySpy(proxy); + EventSpy widgetSpy(proxy->widget()); - QCOMPARE(proxySpy.counts[QEvent::FocusIn], 0); - QCOMPARE(proxySpy.counts[QEvent::FocusOut], 0); - QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 0); - QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 0); + view.setFrameStyle(0); + view.resize(300, 300); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QApplication::setActiveWindow(&view); + QTest::qWait(25); + QTRY_COMPARE(QApplication::activeWindow(), &view); - QPointF lineEditCenter = proxy->mapToScene(proxy->boundingRect().center()); - // Spontaneous mouse click sets focus on a clickable widget. - for (int retry = 0; retry < 50 && !proxy->hasFocus(); retry++) - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); - QVERIFY(proxy->hasFocus()); - QVERIFY(proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusIn], 1); - QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 1); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); - scene.setFocusItem(0); - QVERIFY(!proxy->hasFocus()); - QVERIFY(!proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusOut], 1); - QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 1); + QCOMPARE(proxySpy.counts[QEvent::FocusIn], 0); + QCOMPARE(proxySpy.counts[QEvent::FocusOut], 0); + QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 0); + QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 0); - // Non-spontaneous mouse click sets focus if the widget has been clicked before - { - QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); - event.setScenePos(lineEditCenter); - event.setButton(Qt::LeftButton); - qApp->sendEvent(&scene, &event); + QPointF lineEditCenter = proxy->mapToScene(proxy->boundingRect().center()); + // Spontaneous mouse click sets focus on a clickable widget. + for (int retry = 0; retry < 50 && !proxy->hasFocus(); retry++) + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); QVERIFY(proxy->hasFocus()); QVERIFY(proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusIn], 2); - QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 2); + QCOMPARE(proxySpy.counts[QEvent::FocusIn], 1); + QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 1); + + scene.setFocusItem(0); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); + QCOMPARE(proxySpy.counts[QEvent::FocusOut], 1); + QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 1); + + // Non-spontaneous mouse click sets focus if the widget has been clicked before + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); + event.setScenePos(lineEditCenter); + event.setButton(Qt::LeftButton); + qApp->sendEvent(&scene, &event); + QVERIFY(proxy->hasFocus()); + QVERIFY(proxy->widget()->hasFocus()); + QCOMPARE(proxySpy.counts[QEvent::FocusIn], 2); + QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 2); + } } scene.setFocusItem(0); proxy->setWidget(new QLineEdit); // resets focusWidget - QVERIFY(!proxy->hasFocus()); - QVERIFY(!proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusOut], 2); - QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 2); - // Non-spontaneous mouse click does not set focus on the embedded widget. { - QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); - event.setScenePos(lineEditCenter); - event.setButton(Qt::LeftButton); - qApp->sendEvent(&scene, &event); + QPointF lineEditCenter = proxy->mapToScene(proxy->boundingRect().center()); + EventSpy proxySpy(proxy); + EventSpy widgetSpy(proxy->widget()); QVERIFY(!proxy->hasFocus()); QVERIFY(!proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusIn], 2); - QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 2); - } + QCOMPARE(proxySpy.counts[QEvent::FocusOut], 0); + QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 0); - scene.setFocusItem(0); - QVERIFY(!proxy->hasFocus()); - QVERIFY(!proxy->widget()->hasFocus()); - QCOMPARE(proxySpy.counts[QEvent::FocusOut], 2); - QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 2); - - // Spontaneous click on non-clickable widget does not give focus. - proxy->widget()->setFocusPolicy(Qt::NoFocus); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); - QVERIFY(!proxy->hasFocus()); - QVERIFY(!proxy->widget()->hasFocus()); + // Non-spontaneous mouse click does not set focus on the embedded widget. + { + QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); + event.setScenePos(lineEditCenter); + event.setButton(Qt::LeftButton); + qApp->sendEvent(&scene, &event); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); + QCOMPARE(proxySpy.counts[QEvent::FocusIn], 0); + QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 0); + } + + scene.setFocusItem(0); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); + QCOMPARE(proxySpy.counts[QEvent::FocusOut], 0); + QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 0); + + // Spontaneous click on non-clickable widget does not give focus. + proxy->widget()->setFocusPolicy(Qt::NoFocus); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); + + // Multiple clicks should only result in one FocusIn. + proxy->widget()->setFocusPolicy(Qt::StrongFocus); + scene.setFocusItem(0); + QVERIFY(!proxy->hasFocus()); + QVERIFY(!proxy->widget()->hasFocus()); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter)); + QVERIFY(proxy->hasFocus()); + QVERIFY(proxy->widget()->hasFocus()); + QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 1); + QCOMPARE(proxySpy.counts[QEvent::FocusIn], 1); + } } void tst_QGraphicsProxyWidget::windowFrameMargins() diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp index 93873fb..beb785e 100644 --- a/util/s60pixelmetrics/pixel_metrics.cpp +++ b/util/s60pixelmetrics/pixel_metrics.cpp @@ -1012,12 +1012,15 @@ TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric) value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape); break; + case QStyle::PM_MenuScrollerHeight: + value = 0; + break; + // todo: re-check if these really are not available in s60 case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60 case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60 case QStyle::PM_HeaderMargin: // not in S60 - case QStyle::PM_MenuScrollerHeight: // not in S60 case QStyle::PM_MenuTearoffHeight: // not in S60 case QStyle::PM_DockWidgetFrameWidth: // not in S60 case QStyle::PM_DockWidgetSeparatorExtent: // not in S60 |