<file>res/images/zoom_in.png</file>
<file>res/images/zoom_out.png</file>
<file>res/images/location_search.png</file>
+ <file>res/images/list_item_context_button_bar_left.png</file>
+ <file>res/images/list_item_context_button_bar_right.png</file>
+ <file>res/images/list_item_context_button_bar_tile.png</file>
</qresource>
</RCC>
*/
#include <QDebug>
+#include <QPainter>
#include <QPropertyAnimation>
#include <QStateMachine>
{
qDebug() << __PRETTY_FUNCTION__;
+ // --- BAR LOOK ---
+ const int BAR_HEIGHT = 78;
+ setFixedHeight(BAR_HEIGHT);
+
+ m_backgroundLeft = new QPixmap(":/res/images/list_item_context_button_bar_left.png");
+ m_backgroundMiddle = new QPixmap(":/res/images/list_item_context_button_bar_tile.png");
+ m_backgroundRight = new QPixmap(":/res/images/list_item_context_button_bar_right.png");
+
+ // --- ANIMATION ---
const int ANIMATION_DURATION_MS = 150;
m_animation = new QPropertyAnimation(this, "pos", this);
this, SLOT(onAnimationFinished()));
}
+ListItemContextButtonBar::~ListItemContextButtonBar()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_backgroundLeft)
+ delete m_backgroundLeft;
+
+ if (m_backgroundMiddle)
+ delete m_backgroundMiddle;
+
+ if (m_backgroundRight)
+ delete m_backgroundRight;
+}
+
void ListItemContextButtonBar::changeButtons()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void ListItemContextButtonBar::paintEvent(QPaintEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(event);
+
+ QPainter painter(this);
+
+ painter.drawPixmap(0, 0, *m_backgroundLeft);
+ painter.drawTiledPixmap(24, 0, width() - 2 * 24, 78, *m_backgroundMiddle);
+ painter.drawPixmap(width() - 24, 0, *m_backgroundRight);
+}
+
void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
{
qDebug() << __PRETTY_FUNCTION__;
public:
explicit ListItemContextButtonBar(QWidget *parent = 0);
+ ~ListItemContextButtonBar();
+
+ void paintEvent(QPaintEvent *event);
+
void hideContextButtonBar();
/**
bool m_waitForOpen;
+ QPixmap *m_backgroundLeft;
+ QPixmap *m_backgroundMiddle;
+ QPixmap *m_backgroundRight;
+
QPropertyAnimation *m_animation;
QWidget *m_contextButtons; ///< Widget for context buttons