From aa3dc5ac75505285f7501eb75935414d309c077f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 14 May 2010 12:59:55 +0300 Subject: Fix anomaly demo control strip icon placement Some icons overlapped in very small screens, so make icon placement little bit smarter. Task-number: QTBUG-10635 Reviewed-by: Janne Anttila --- demos/embedded/anomaly/src/ControlStrip.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/demos/embedded/anomaly/src/ControlStrip.cpp b/demos/embedded/anomaly/src/ControlStrip.cpp index dc6d5c2..c9c81c0 100644 --- a/demos/embedded/anomaly/src/ControlStrip.cpp +++ b/demos/embedded/anomaly/src/ControlStrip.cpp @@ -66,6 +66,7 @@ QSize ControlStrip::minimumSizeHint() const void ControlStrip::mousePressEvent(QMouseEvent *event) { int h = height(); + int spacing = qMin(h, (width() - h * 4) / 3); int x = event->pos().x(); if (x < h) { @@ -80,13 +81,13 @@ void ControlStrip::mousePressEvent(QMouseEvent *event) return; } - if ((x < width() - 2 * h) && (x > width() - 3 * h)) { + if ((x < width() - (h + spacing)) && (x > width() - (h * 2 + spacing))) { emit forwardClicked(); event->accept(); return; } - if ((x < width() - 3 * h) && (x > width() - 5 * h)) { + if ((x < width() - (h * 2 + spacing * 2)) && (x > width() - (h * 3 + spacing * 2))) { emit backClicked(); event->accept(); return; @@ -96,15 +97,16 @@ void ControlStrip::mousePressEvent(QMouseEvent *event) void ControlStrip::paintEvent(QPaintEvent *event) { int h = height(); - int s = (h - menuPixmap.height()) / 2; + int spacing = qMin(h, (width() - h * 4) / 3); + int s = (height() - menuPixmap.height()) / 2; QPainter p(this); p.fillRect(event->rect(), QColor(32, 32, 32, 192)); p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.drawPixmap(s, s, menuPixmap); p.drawPixmap(width() - h + s, s, closePixmap); - p.drawPixmap(width() - 3 * h + s, s, forwardPixmap); - p.drawPixmap(width() - 5 * h + s, s, backPixmap); + p.drawPixmap(width() - (h * 2 + spacing) + s, s, forwardPixmap); + p.drawPixmap(width() - (h * 3 + spacing * 2) + s, s, backPixmap); p.end(); } -- cgit v0.12 From 0749d35484a4efb2202a7c2b6da7d5b796ef5b56 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 14 May 2010 14:38:31 +0300 Subject: 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 --- src/gui/itemviews/qabstractitemview.cpp | 5 ++++- src/gui/styles/qs60style.cpp | 10 +++++++--- 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 : -- cgit v0.12 From 6835055e501127a39ef78dfd5768783a75bcb156 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 14 May 2010 14:55:13 +0200 Subject: Support linked fonts (.ltt) from standard font locations. The internal font database was only populated with .ttf and .ccc files. This patch adds .ltt as file type. Without complete font type coverage in the fontstore, we may get a mismatch in the internal association of font table and fontfamily. Most probably, this will also fix the crash on SSE Satio's. SSE seems to use .ltt files already on S60 5.0. An improvement needs to be verified by an owner of such a device, however. Task-number: QTBUG-8905 Reviewed-by: Aleksandar Sasha Babic --- src/gui/text/qfontdatabase_s60.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 4171e40..40fe3b7 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -113,6 +113,7 @@ QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementati QStringList filters; filters.append(QLatin1String("*.ttf")); filters.append(QLatin1String("*.ccc")); + filters.append(QLatin1String("*.ltt")); const QFileInfoList fontFiles = alternativeFilePaths(QLatin1String("resource\\Fonts"), filters); const TInt heapMinLength = 0x1000; -- cgit v0.12