#include <QDebug>
+#include "panelcommon.h"
+
#include "listitemcontextbuttonbar.h"
ListItemContextButtonBar::ListItemContextButtonBar(QWidget *parent) :
m_contextButtons = contextButtons;
m_contextButtons->setParent(this);
-// m_contextButtons->setVisible(true);
-// setFixedHeight(m_contextButtons->height());
+ // widget must be temporarily visible so we can get the size, doesn't work with invisible widget
+ m_contextButtons->setVisible(true);
+ setFixedSize(m_contextButtons->size());
+ m_contextButtons->setVisible(false);
-// emit positionChangeRequested();
+ // center this widget horizontally to middle of the panel contents area
+ const int FROM_PANEL_CONTENTS_LEFT = PANEL_WIDTH / 2 - m_contextButtons->width() / 2;
+ const int Y = 0;
+ move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH + FROM_PANEL_CONTENTS_LEFT, Y);
}
else
m_itemButtons->hide();
}
-
-void PanelBase::resizeEvent(QResizeEvent *event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
-// int x = event->size().width() / 2 - m_itemButtons->width() / 2;
-// const int Y = 0;
-// m_itemButtons->move(x, Y);
-}
*/
PanelBase(QWidget *parent = 0);
-protected:
- void resizeEvent(QResizeEvent *event);
-
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
QWidget *itemContextButtons = static_cast<PanelBase *>(m_panelContentStack->widget(index))->itemButtons();
m_itemContextButtonBar->setContextButtons(itemContextButtons);
- const int FROM_PANEL_CONTENTS_LEFT = PANEL_WIDTH / 2 - itemContextButtons->width() / 2;
- const int Y = 0;
-
- m_itemContextButtonBar->move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH
- + FROM_PANEL_CONTENTS_LEFT, Y);
-
emit currentChanged(index);
}
}