diff options
author | Roopesh Chander <roop@forwardbias.in> | 2009-10-23 12:39:36 +0530 |
---|---|---|
committer | Roopesh Chander <roop@forwardbias.in> | 2009-10-23 12:58:04 +0530 |
commit | e01d0f5631a19fc6ae2da19003844533689b35d8 (patch) | |
tree | f312ce6db6a95787fc501faf9d8060583eed63af /graphicstoolbar.cpp | |
parent | 7ec741042396523e6fe91d047d8d76cec242343e (diff) |
try animating the toolbar
Diffstat (limited to 'graphicstoolbar.cpp')
-rw-r--r-- | graphicstoolbar.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/graphicstoolbar.cpp b/graphicstoolbar.cpp index 4149c83..3beddf9 100644 --- a/graphicstoolbar.cpp +++ b/graphicstoolbar.cpp @@ -1,6 +1,9 @@ #include <QPainter> #include <QGraphicsProxyWidget> #include <QGraphicsDropShadowEffect> +#include <QGraphicsRotation> +#include <QList> +#include <QGraphicsTransform> #include "graphicstoolbar.h" GraphicsToolBar::GraphicsToolBar(QGraphicsScene *scene, QGraphicsItem * parent, Qt::WindowFlags wFlags) @@ -34,6 +37,13 @@ GraphicsToolBar::GraphicsToolBar(QGraphicsScene *scene, QGraphicsItem * parent, m_shadowEffect->setProperty("offset", QPointF(8, 8)); m_shadowEffect->setProperty("blurRadius", 5); setGraphicsEffectsEnabled(true); + + m_rotation = new QGraphicsRotation; + m_rotation->setAxis(Qt::YAxis); + m_rotation->setAngle(0); + QList<QGraphicsTransform *> txs; + txs << m_rotation; + setTransformations(txs); } void GraphicsToolBar::setGraphicsEffectsEnabled(bool enabled) { @@ -48,6 +58,10 @@ bool GraphicsToolBar::graphicsEffectsEnabled() const { return m_isGraphicsEffectsEnabled; } +QGraphicsRotation* GraphicsToolBar::rotation() const { + return m_rotation; +} + void GraphicsToolBar::addWidget(QWidget *widget) { QGraphicsWidget *gw = m_scene->addWidget(widget); m_layout->addItem(gw); @@ -66,6 +80,8 @@ void GraphicsToolBar::setFillLevel(int percent) { } void GraphicsToolBar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + Q_UNUSED(option); + Q_UNUSED(widget); painter->save(); painter->setClipRect(boundingRect().adjusted(0, boundingRect().height() * ((100 - m_fillLevel) / 100.0), 0, 0)); painter->setBrush(m_bgBrush); @@ -94,3 +110,10 @@ void GraphicsToolBar::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) { update(); } +void GraphicsToolBar::show() { + QGraphicsWidget::show(); +} + +void GraphicsToolBar::hide() { + QGraphicsWidget::hide(); +} |