equal
deleted
inserted
replaced
26 #include <QDebug> |
26 #include <QDebug> |
27 |
27 |
28 namespace GVA { |
28 namespace GVA { |
29 |
29 |
30 DualButtonToolbarSnippet::DualButtonToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
30 DualButtonToolbarSnippet::DualButtonToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
31 const QRectF& ownerArea, const QWebElement & element, QGraphicsWidget * widget) |
31 const QWebElement & element) |
32 : ToolbarSnippet(elementId, chrome, ownerArea, element, widget) |
32 : ToolbarSnippet(elementId, chrome, element) |
33 { |
33 { |
34 m_type = ""; |
34 m_type = ""; |
35 } |
35 } |
36 |
36 |
37 DualButtonToolbarSnippet::~DualButtonToolbarSnippet() |
37 DualButtonToolbarSnippet::~DualButtonToolbarSnippet() |
48 |
48 |
49 /*! |
49 /*! |
50 Update the item spacing based on the chrome width |
50 Update the item spacing based on the chrome width |
51 */ |
51 */ |
52 void DualButtonToolbarSnippet::updateOwnerArea() { |
52 void DualButtonToolbarSnippet::updateOwnerArea() { |
53 setChildSpacing(m_chrome->width()); |
53 setChildSpacing(m_chrome->layout()->size().width()); |
54 ToolbarSnippet::updateOwnerArea(); |
54 ToolbarSnippet::updateOwnerArea(); |
55 } |
55 } |
56 |
56 |
57 void DualButtonToolbarSnippet::setChildSpacing(int width) { |
57 void DualButtonToolbarSnippet::setChildSpacing(int width) { |
58 QGraphicsLinearLayout* l = layout(); |
58 QGraphicsLinearLayout* l = layout(); |
63 l->setItemSpacing(l->count()-1, spacing); |
63 l->setItemSpacing(l->count()-1, spacing); |
64 } |
64 } |
65 ToolbarSnippet::updateOwnerArea(); |
65 ToolbarSnippet::updateOwnerArea(); |
66 } |
66 } |
67 |
67 |
68 void DualButtonToolbarSnippet::onMouseEvent(QEvent::Type type) { |
|
69 |
|
70 //qDebug() << "DualButtonToolbarSnippet::onMouseEvent - Type:" << type; |
|
71 ActionButton* button = static_cast<ActionButton*> ( sender()); |
|
72 ActionButtonSnippet * buttonSnippet = static_cast<ActionButtonSnippet*>( button->snippet()); |
|
73 |
|
74 if (type == QEvent::GraphicsSceneMousePress ) { |
|
75 buttonSnippet->setActive(true); |
|
76 } |
|
77 else if (type == QEvent::GraphicsSceneMouseRelease ) { |
|
78 buttonSnippet->updateButtonState(false); |
|
79 } |
|
80 } |
|
81 } // end of namespace GVA |
68 } // end of namespace GVA |
82 |
69 |
83 |
70 |
84 |
71 |