summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/styles/qs60style.cpp44
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp16
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp2
-rw-r--r--src/openvg/openvg.pro2
-rw-r--r--src/openvg/qwindowsurface_vg.cpp5
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp27
-rw-r--r--src/openvg/qwindowsurface_vgegl_p.h4
7 files changed, 74 insertions, 26 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 28cbc45..27913cd 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1372,14 +1372,13 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
optionComboBox.palette.setColor(QPalette::Inactive, QPalette::WindowText,
optionComboBox.palette.text().color() );
QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
- painter->save();
- painter->setClipRect(editRect);
+ const int frameW = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
if (!comboBox->currentIcon.isNull()) {
- QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
- QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
+ const QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
+ const QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
QRect iconRect(editRect);
- iconRect.setWidth(comboBox->iconSize.width() + 4);
+ iconRect.setWidth(comboBox->iconSize.width() + frameW);
iconRect = alignedRect(comboBox->direction,
Qt::AlignLeft | Qt::AlignVCenter,
iconRect.size(), editRect);
@@ -1388,17 +1387,19 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
if (comboBox->direction == Qt::RightToLeft)
- editRect.translate(-4 - comboBox->iconSize.width(), 0);
+ editRect.setRight(editRect.right() - frameW - comboBox->iconSize.width());
else
- editRect.translate(comboBox->iconSize.width() + 4, 0);
+ editRect.setLeft(comboBox->iconSize.width() + frameW);
}
if (!comboBox->currentText.isEmpty() && !comboBox->editable) {
+ const Qt::TextElideMode elideMode = (comboBox->direction == Qt::LeftToRight) ? Qt::ElideRight : Qt::ElideLeft;
+ const QString text = comboBox->fontMetrics.elidedText(comboBox->currentText, elideMode, editRect.width());
+
QCommonStyle::drawItemText(painter,
editRect.adjusted(QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 0, -1, 0),
visualAlignment(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter),
- comboBox->palette, comboBox->state & State_Enabled, comboBox->currentText);
+ comboBox->palette, comboBox->state & State_Enabled, text);
}
- painter->restore();
}
break;
#endif //QT_NO_COMBOBOX
@@ -1541,7 +1542,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
const int tabOverlap =
QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap) - borderThickness;
- //todo: draw navi wipe behind tabbar - must be drawn with first draw
if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive||
skinElement==QS60StylePrivate::SE_TabBarTabEastActive||
@@ -1645,7 +1645,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
painter->drawPixmap(tr.left() + tabOverlap,
tr.center().y() - (tabIcon.height() >> 1),
tabIcon);
- tr.setLeft(tr.left() + iconSize.width() + 4);
+ tr.setLeft(tr.left() + iconSize.width() + 4); //todo: magic four
}
QCommonStyle::drawItemText(painter, tr, alignment, optionTab.palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
@@ -1964,14 +1964,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
// We need to reduce the focus frame size if LayoutSpacing is smaller than FocusFrameMargin
// Otherwise, we would overlay adjacent widgets.
const int frameHeightReduction =
- qMin(0, pixelMetric(QStyle::PM_LayoutVerticalSpacing)
- - pixelMetric(QStyle::PM_FocusFrameVMargin));
+ qMin(0, pixelMetric(PM_LayoutVerticalSpacing)
+ - pixelMetric(PM_FocusFrameVMargin));
const int frameWidthReduction =
- qMin(0, pixelMetric(QStyle::PM_LayoutHorizontalSpacing)
- - pixelMetric(QStyle::PM_FocusFrameHMargin));
+ qMin(0, pixelMetric(PM_LayoutHorizontalSpacing)
+ - pixelMetric(PM_FocusFrameHMargin));
const int rounding =
- qMin(pixelMetric(QStyle::PM_FocusFrameVMargin),
- pixelMetric(QStyle::PM_LayoutVerticalSpacing));
+ qMin(pixelMetric(PM_FocusFrameVMargin),
+ pixelMetric(PM_LayoutVerticalSpacing));
const QRect frameRect =
option->rect.adjusted(-frameWidthReduction, -frameHeightReduction,
frameWidthReduction, frameHeightReduction);
@@ -2847,7 +2847,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
const int tabOverlapNoBorder =
QS60StylePrivate::pixelMetric(PM_TabBarTabOverlap);
const int tabOverlap =
- tabOverlapNoBorder-QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
+ tabOverlapNoBorder - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
const QTabWidget *tab = qobject_cast<const QTabWidget *>(widget);
int gain = (tab) ? tabOverlap * tab->count() : 0;
switch (twf->shape) {
@@ -2913,7 +2913,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
ret = QRect();
} else {
if (menuItem->direction == Qt::RightToLeft)
- ret.translate(ret.width()-indicatorWidth, 0);
+ ret.translate(ret.width() - indicatorWidth, 0);
ret.setWidth(indicatorWidth);
}
} else {
@@ -3313,8 +3313,10 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event)
break;
case QEvent::Destroy:
case QEvent::Hide:
- d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim);
- d->m_bars.removeAll(reinterpret_cast<QProgressBar *>(object));
+ if (QProgressBar *bar = reinterpret_cast<QProgressBar *>(object)) {
+ d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim);
+ d->m_bars.removeAll(bar);
+ }
break;
default:
break;
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index c550938..285a789 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4242,8 +4242,15 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
const QAbstractScrollAreaPrivate *sap = sa->d_func();
rule.drawBackground(p, opt->rect, sap->contentsOffset());
- if (rule.hasBorder())
- rule.drawBorder(p, rule.borderRect(opt->rect));
+ if (rule.hasBorder()) {
+ QRect brect = rule.borderRect(opt->rect);
+ if (styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, opt, w)) {
+ QRect r = brect.adjusted(0, 0, sa->verticalScrollBar()->isVisible() ? -sa->verticalScrollBar()->width() : 0,
+ sa->horizontalScrollBar()->isVisible() ? -sa->horizontalScrollBar()->height() : 0);
+ brect = QStyle::visualRect(opt->direction, brect, r);
+ }
+ rule.drawBorder(p, brect);
+ }
break;
}
#endif
@@ -4628,6 +4635,11 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
return msz.width() == -1 ? msz.height() : msz.width();
}
break;
+
+ case PM_ScrollView_ScrollBarSpacing:
+ if(!rule.hasNativeBorder() || rule.hasBox())
+ return 0;
+ break;
#endif // QT_NO_SCROLLBAR
case PM_ProgressBarChunkWidth:
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 1d496d5..73ec53e 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -394,7 +394,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
if ((frameStyle != QFrame::NoFrame) &&
q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) {
controlsRect = widgetRect;
- const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing);
+ const int extra = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q);
const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0);
QRect frameRect = widgetRect;
frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y());
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index 3790492..883f0f3 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -33,7 +33,7 @@ contains(QT_CONFIG, egl) {
qwindowsurface_vgegl.cpp
}
-symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE
+symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING
include(../qbase.pri)
diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp
index 83b0764..c19d5d1 100644
--- a/src/openvg/qwindowsurface_vg.cpp
+++ b/src/openvg/qwindowsurface_vg.cpp
@@ -57,6 +57,7 @@ QVGWindowSurface::QVGWindowSurface(QWidget *window)
{
// Create the default type of EGL window surface for windows.
d_ptr = new QVGEGLWindowSurfaceDirect(this);
+ setStaticContentsSupport(d_ptr->supportsStaticContents());
}
QVGWindowSurface::QVGWindowSurface
@@ -89,7 +90,9 @@ void QVGWindowSurface::setGeometry(const QRect &rect)
bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy)
{
- return QWindowSurface::scroll(area, dx, dy);
+ if (!d_ptr->scroll(window(), area, dx, dy))
+ return QWindowSurface::scroll(area, dx, dy);
+ return true;
}
void QVGWindowSurface::beginPaint(const QRegion &region)
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 46a905f..99b614b 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -758,6 +758,33 @@ void QVGEGLWindowSurfaceDirect::endPaint
}
}
+bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const
+{
+#if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP)
+ return true;
+#else
+ return QVGEGLWindowSurfacePrivate::supportsStaticContents();
+#endif
+}
+
+bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy)
+{
+#ifdef QVG_BUFFER_SCROLLING
+ QEglContext *context = ensureContext(widget);
+ if (context) {
+ context->makeCurrent(windowSurface);
+ QRect scrollRect = area.boundingRect();
+ int sx = scrollRect.x();
+ int sy = size.height() - scrollRect.y() - scrollRect.height();
+ vgSeti(VG_SCISSORING, VG_FALSE);
+ vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height());
+ context->lazyDoneCurrent();
+ return true;
+ }
+#endif
+ return false;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h
index aa0c648..892fd9d 100644
--- a/src/openvg/qwindowsurface_vgegl_p.h
+++ b/src/openvg/qwindowsurface_vgegl_p.h
@@ -77,6 +77,8 @@ public:
(QWidget *widget, const QRegion& region, QImage *image = 0) = 0;
virtual VGImage surfaceImage() const;
virtual QSize surfaceSize() const = 0;
+ virtual bool supportsStaticContents() const { return false; }
+ virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; }
private:
QVGPaintEngine *engine;
@@ -128,6 +130,8 @@ public:
void beginPaint(QWidget *widget);
void endPaint(QWidget *widget, const QRegion& region, QImage *image);
QSize surfaceSize() const { return size; }
+ bool supportsStaticContents() const;
+ bool scroll(QWidget *widget, const QRegion& area, int dx, int dy);
protected:
QEglContext *context;