Q_ASSERT(m_animation->state() == QAbstractAnimation::Stopped);
+ if (!isVisible())
+ show();
+
// Hide previous buttons (if any)
if (m_contextButtons)
m_contextButtons->setParent(0);
m_newContextButtons = 0;
m_contextButtons->setParent(this);
m_contextButtons->show();
- setFixedSize(m_contextButtons->size());
+ setFixedWidth(m_contextButtons->width());
// center this widget horizontally to middle of the panel contents area and set outside of
// the view
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);
+ const int TOP = 0;
+ const int LEFT = 0;
+ painter.drawPixmap(TOP, LEFT, *m_backgroundLeft);
+ painter.drawTiledPixmap(m_backgroundLeft->width(), TOP,
+ width() - m_backgroundLeft->width() - m_backgroundRight->width(),
+ height(),
+ *m_backgroundMiddle);
+ painter.drawPixmap(width() - m_backgroundRight->width(), TOP, *m_backgroundRight);
}
void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
{
qDebug() << __PRETTY_FUNCTION__;
+
+ // --- GENERIC BUTTONS ---
+ m_genericButtons = new QWidget;
+ m_genericButtonsLayout = new QVBoxLayout;
+
const int CONTEXT_BUTTON_MARGIN_LEFT = 2;
const int CONTEXT_BUTTON_MARGIN_TOP = 10;
const int CONTEXT_BUTTON_MARGIN_RIGHT = 0;
const int CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
const int CONTEXT_BUTTON_SPACING = 0;
-
- // --- GENERIC BUTTONS ---
- m_genericButtons = new QWidget;
-
- m_genericButtonsLayout = new QVBoxLayout;
m_genericButtonsLayout->setContentsMargins(CONTEXT_BUTTON_MARGIN_LEFT,
CONTEXT_BUTTON_MARGIN_TOP,
CONTEXT_BUTTON_MARGIN_RIGHT,
// --- ITEM RELATED BUTTONS ---
m_itemButtons = new QWidget(this);
m_itemButtonsLayout = new QHBoxLayout;
- /// @todo set margins
+
+ const int ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_LEFT = 2;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_RIGHT = 2;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_TOP = 2;
+ const int ITEM_CONTEXT_BUTTON_SPACING = 0;
+ m_itemButtonsLayout->setContentsMargins(ITEM_CONTEXT_BUTTON_MARGIN_LEFT,
+ ITEM_CONTEXT_BUTTON_MARGIN_TOP,
+ ITEM_CONTEXT_BUTTON_MARGIN_RIGHT,
+ ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM);
+ m_itemButtonsLayout->setSpacing(ITEM_CONTEXT_BUTTON_SPACING);
+
m_itemButtons->setLayout(m_itemButtonsLayout);
}
// --- LIST ITEM RELATED CONTEXT BUTTONS BAR ---
m_itemContextButtonBar = new ListItemContextButtonBar(this);
+ m_itemContextButtonBar->hide();
connect(this, SIGNAL(listItemSelectionChanged(bool)),
m_itemContextButtonBar, SLOT(onListItemSelectionChanged(bool)));