position if the tabs had a different amount of context buttons (ie. reverted back to the old
repositionContextButtonBar/positionChangeRequested signal/slot combination).
Reviewed by: Jussi Laitinen
user/user.h
QT += network \
webkit
-
DEFINES += QT_NO_DEBUG_OUTPUT
simulator {
* @brief Class for for drawing a vertical line between panel content and tab bar
*
* @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class PanelBar : public QWidget
{
/**
* @brief Base class for panels
*
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class PanelBase : public QWidget
{
* @brief Stack class for tabbed panel widgets
*
* @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class PanelContentStack : public QStackedWidget
{
connect(animation, SIGNAL(finished()),
this, SLOT(contextButtonBarStateChanged()));
- QPoint hiddenPosition(this->pos().x(), this->pos().y());
+ QPoint hiddenPosition(pos().x(), pos().y());
m_stateHidden->assignProperty(this, "pos", hiddenPosition);
- QPoint visiblePosition(this->pos().x(), this->pos().y() - height());
+ QPoint visiblePosition(pos().x(), pos().y() - height());
m_stateVisible->assignProperty(this, "pos", visiblePosition);
stateMachine->start();
m_stateVisible->assignProperty(this, "pos", visiblePosition);
}
-void PanelContextButtonBar::resizeEvent(QResizeEvent *event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QWidget::resizeEvent(event);
-
- QPoint visiblePosition(pos().x(), pos().y() - height());
- m_stateVisible->assignProperty(this, "pos", visiblePosition);
-}
-
void PanelContextButtonBar::setContextButtons(QWidget *contextButtons)
{
qDebug() << __PRETTY_FUNCTION__;
m_contextButtons->setVisible(true);
setFixedHeight(m_contextButtons->height());
+
+ emit positionChangeRequested();
}
void PanelContextButtonBar::showContextButtonBar()
class QState;
+/**
+ * @brief Base class for panel context button bar
+ *
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ */
class PanelContextButtonBar : public QWidget
{
Q_OBJECT
*/
void paintEvent(QPaintEvent *event);
- /**
- * @brief Resizes the bar
- *
- * @param event Resize event
- */
- void resizeEvent(QResizeEvent *event);
-
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
void barVisible();
/**
+ * @brief This signal is called when context button bar needs to be repositioned
+ */
+ void positionChangeRequested();
+
+ /**
* @brief Signal that is sent when the context button bar state must be changed
*/
void toggleState();
/**
* @brief Class for tab button
*
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class PanelTab : public QToolButton
{
/**
* @brief Class for tab bar
*
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class PanelTabBar : public QWidget
{
connect(m_panelContextButtonBar, SIGNAL(barHidden()),
this, SLOT(closePanel()));
+ connect(m_panelContextButtonBar, SIGNAL(positionChangeRequested()),
+ this, SLOT(repositionContextButtonBar()));
+
// --- PANEL CONTENT ---
m_panelContentStack = new PanelContentStack(this);
m_panelContentStack->move(PANEL_TAB_WIDTH + PANEL_BAR_WIDTH, PANEL_TOP_Y);
}
}
+void TabbedPanel::repositionContextButtonBar()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X, height());
+}
+
void TabbedPanel::resizePanel(const QSize &size)
{
qDebug() << __PRETTY_FUNCTION__;
* @brief Class for tabbed panels
*
* @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class TabbedPanel : public QWidget
{
private slots:
/**
+ * @brief Repositions context button bar
+ */
+ void repositionContextButtonBar();
+
+ /**
* @brief Sets the panel at current index active
*
* @param index Index of the panel
* DATA MEMBERS
******************************************************************************/
private:
- bool m_open; ///< Current state of the panel
- bool m_closeRequestPending;
+ bool m_open; ///< Current state of the panel
+ bool m_closeRequestPending; ///< Indicates wheater the panel is waiting to be closed
- QState *m_stateClosed; ///< State of the closed panel
- QState *m_stateOpened; ///< State of the opened panel
+ QState *m_stateClosed; ///< State of the closed panel
+ QState *m_stateOpened; ///< State of the opened panel
PanelBar *m_panelBar; ///< Widget for panel bar
PanelContentStack *m_panelContentStack; ///< Stack for panel widgets