summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-05-14 11:38:31 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-05-14 11:38:31 (GMT)
commit0749d35484a4efb2202a7c2b6da7d5b796ef5b56 (patch)
tree290396f132aece12c00da7d658954441bd525230 /src
parentaa3dc5ac75505285f7501eb75935414d309c077f (diff)
downloadQt-0749d35484a4efb2202a7c2b6da7d5b796ef5b56.zip
Qt-0749d35484a4efb2202a7c2b6da7d5b796ef5b56.tar.gz
Qt-0749d35484a4efb2202a7c2b6da7d5b796ef5b56.tar.bz2
QS60Style: In S60 3.x and 5.0 Qt itemviews behaviour is not nativelike
Currently style defines QStyle::SH_ItemView_ActivateItemOnSingleClick, which leads to itemview item activation only occur on double-click (or tap). The item selection work native-like on Sym^3. As a correction, style needs to check the passed styleoption and check whether or not the state "Selected" is on. In these cases, the itemactivation can proceed. Task-number: QTBUG-10697 Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp5
-rw-r--r--src/gui/styles/qs60style.cpp10
2 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 2faf755..b464330 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1785,7 +1785,10 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
emit clicked(index);
if (edited)
return;
- if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
+ QStyleOptionViewItemV4 option = d->viewOptionsV4();
+ if (d->pressedAlreadySelected)
+ option.state |= QStyle::State_Selected;
+ if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
emit activated(index);
}
}
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 924cabc..d28e1d9 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2575,7 +2575,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget,
QStyleHintReturn *hret) const
{
- int retValue = -1;
+ int retValue = 0;
switch (sh) {
case SH_RequestSoftwareInputPanel:
if (QS60StylePrivate::isSingleClickUi())
@@ -2610,9 +2610,13 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_Dial_BackgroundRole:
retValue = QPalette::Base;
break;
- case SH_ItemView_ActivateItemOnSingleClick:
- retValue = QS60StylePrivate::isSingleClickUi();
+ case SH_ItemView_ActivateItemOnSingleClick: {
+ if (QS60StylePrivate::isSingleClickUi())
+ retValue = true;
+ else if (opt && opt->state & QStyle::State_Selected)
+ retValue = true;
break;
+ }
case SH_ProgressDialog_TextLabelAlignment:
retValue = (QApplication::layoutDirection() == Qt::LeftToRight) ?
Qt::AlignLeft :