Set constant width
[situare] / src / ui / listitemcontextbuttonbar.cpp
index d7b6551..45fc2e0 100644 (file)
@@ -42,6 +42,11 @@ ListItemContextButtonBar::ListItemContextButtonBar(QWidget *parent) :
     const int BAR_HEIGHT = 78;
     setFixedHeight(BAR_HEIGHT);
 
+    const int BUTTON_WIDTH = 74;
+    const int BUTTON_COUNT = 3;
+    const int HORIZONTAL_MARGIN = 10;
+    setFixedWidth(BUTTON_COUNT * BUTTON_WIDTH + 2 * HORIZONTAL_MARGIN);
+
     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");
@@ -87,11 +92,11 @@ void ListItemContextButtonBar::changeButtons()
     m_newContextButtons = 0;
     m_contextButtons->setParent(this);
     m_contextButtons->show();
-    setFixedWidth(m_contextButtons->width());
+//    setFixedWidth(m_contextButtons->width());
 
     // center this widget horizontally to middle of the panel contents area and set outside of
     // the view
-    const int FROM_PANEL_CONTENTS_LEFT = PANEL_WIDTH / 2 - m_contextButtons->width() / 2;
+    const int FROM_PANEL_CONTENTS_LEFT = PANEL_WIDTH / 2 - width() / 2;
     move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH + FROM_PANEL_CONTENTS_LEFT, -size().height());
 
     // update new target values for animations