aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDUI-Team Symbio <dui-team@fi.symbio.com>2010-06-29 10:27:33 +0300
committerDaniel d'Andrada <daniel.dandrada@nokia.com>2010-06-30 12:58:15 +0300
commit95ae5a96bfdb7e441f544808b6039324c4e240ed (patch)
tree6f8691f967ff3ffa7d3f5bd1932974e93816642d
parent78d118620b2e84b773c8a0701bc8722b80989c61 (diff)
Fixes: NB#176548 - Toolbar missing shade
RevBy: Daniel d'Andrada
-rw-r--r--src/views/mtoolbarview.cpp28
-rw-r--r--src/views/mtoolbarview.h9
-rw-r--r--src/views/style/mtoolbarstyle.h2
3 files changed, 39 insertions, 0 deletions
diff --git a/src/views/mtoolbarview.cpp b/src/views/mtoolbarview.cpp
index c0132e3e..f6338e36 100644
--- a/src/views/mtoolbarview.cpp
+++ b/src/views/mtoolbarview.cpp
@@ -33,6 +33,8 @@
#include "mtextedit.h"
#include "mtoolbarview.h"
#include "mtoolbarview_p.h"
+#include "mscalableimage.h"
+#include "mscenemanager.h"
const int maxSlots = 4;
@@ -560,6 +562,32 @@ MToolBarView::~MToolBarView()
delete d_ptr;
}
+QRectF MToolBarView::boundingRect() const
+{
+ QRectF br = MWidgetView::boundingRect();
+ if (style()->dropShadowImage()) {
+ br.setTop(-style()->dropShadowImage()->pixmap()->size().height());
+ }
+ return br;
+}
+
+void MToolBarView::drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const
+{
+ Q_D(const MToolBarView);
+
+ //draw shadow on top of the actual toolbar on portrait mode
+ if (d->controller->sceneManager()->orientation() == M::Portrait) {
+ if (style()->dropShadowImage()) {
+ style()->dropShadowImage()->draw(0,
+ -style()->dropShadowImage()->pixmap()->size().height(),
+ boundingRect().width(),
+ style()->dropShadowImage()->pixmap()->size().height(),
+ painter);
+ }
+ }
+ MWidgetView::drawBackground(painter, option);
+}
+
// bind view and controller together
M_REGISTER_VIEW_NEW(MToolBarView, MToolBar)
diff --git a/src/views/mtoolbarview.h b/src/views/mtoolbarview.h
index 8cf6f409..e53e3aef 100644
--- a/src/views/mtoolbarview.h
+++ b/src/views/mtoolbarview.h
@@ -73,7 +73,16 @@ public:
virtual ~MToolBarView();
MWidget *getWidget(QAction *action) const;
+
+ //! \reimp
+ virtual QRectF boundingRect() const;
+ //! \reimp_end
+
protected:
+ //! \reimp
+ virtual void drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
+ //! \reimp_end
+
/*!
\brief protected constructor
\param dd Shared private class
diff --git a/src/views/style/mtoolbarstyle.h b/src/views/style/mtoolbarstyle.h
index dab8e929..ac4aa4a9 100644
--- a/src/views/style/mtoolbarstyle.h
+++ b/src/views/style/mtoolbarstyle.h
@@ -34,6 +34,8 @@ class M_EXPORT MToolbarStyle : public MWidgetStyle
{
Q_OBJECT
M_STYLE(MToolbarStyle)
+
+ M_STYLE_PTR_ATTRIBUTE(MScalableImage*, dropShadowImage, DropShadowImage)
};
/*!