diff options
author | Peter Penz <ppenz@openismus.com> | 2010-06-24 16:05:26 +0200 |
---|---|---|
committer | Jörgen Scheibengruber <jorgen.scheibengruber@nokia.com> | 2010-06-29 16:09:04 +0300 |
commit | 69d3b517705bda603e0ce039f8fb8129a7f8029b (patch) | |
tree | db9650f6e64c312559bd996ec997aa1416481861 | |
parent | dd536cb310b95cc46a25752027b8127bbc86c140 (diff) |
Changes: Improve performance of MWidgetView::reactiveMargins() and MWidgetView::margins()
RevBy: Armin Berres
Details:
Although getting the bounding rectangle of a widget is quite fast,
a huge number of calls is done during e. g. panning through a list.
The patch improves the performance of MWidgetView::reactiveMargins()
and MWidgetView::margins(): Each call of the -> operator for the style
container results in calling MStyleContainer::currentStyle(), that
contains calls like MApplication::activeWindow(). So now one call is done
instead of four. Panning the list of the widgetsgallery in the portrait
mode gets faster by around 2 - 3 fps. The patch is related to NB#174717,
but probably further investigations need to be done to speedup the
performance.
-rw-r--r-- | src/corelib/widgets/core/mwidgetview.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/corelib/widgets/core/mwidgetview.cpp b/src/corelib/widgets/core/mwidgetview.cpp index 01ddc19d..48f725dd 100644 --- a/src/corelib/widgets/core/mwidgetview.cpp +++ b/src/corelib/widgets/core/mwidgetview.cpp @@ -245,10 +245,11 @@ const MWidgetStyleContainer &MWidgetView::style() const QRect MWidgetView::margins() const { - return QRect(style()->marginLeft(), - style()->marginTop(), - style()->marginRight(), - style()->marginBottom()); + const MWidgetStyle *s = static_cast<const MWidgetStyle*>(style().operator->()); + return QRect(s->marginLeft(), + s->marginTop(), + s->marginRight(), + s->marginBottom()); } int MWidgetView::marginLeft() const @@ -273,10 +274,11 @@ int MWidgetView::marginBottom() const QRect MWidgetView::reactiveMargins() const { - return QRect(style()->reactiveMarginLeft(), - style()->reactiveMarginTop(), - style()->reactiveMarginRight(), - style()->reactiveMarginBottom()); + const MWidgetStyle *s = static_cast<const MWidgetStyle*>(style().operator->()); + return QRect(s->reactiveMarginLeft(), + s->reactiveMarginTop(), + s->reactiveMarginRight(), + s->reactiveMarginBottom()); } int MWidgetView::reactiveMarginLeft() const |