From 58b3989181f761d03a6c0a3fafef6e758fb6562a Mon Sep 17 00:00:00 2001 From: Pekka Nissinen Date: Mon, 30 Aug 2010 14:52:26 +0300 Subject: [PATCH] Added a temporary borders around tab bar and context button bar. Used ONLY for debugging purposes! --- src/ui/panelcontextbuttonbar.cpp | 35 ++++++++++++++++++++--------------- src/ui/paneltabbar.cpp | 17 +++++++++++++++++ src/ui/paneltabbar.h | 7 +++++++ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/src/ui/panelcontextbuttonbar.cpp b/src/ui/panelcontextbuttonbar.cpp index 48a15b4..be6e9d0 100644 --- a/src/ui/panelcontextbuttonbar.cpp +++ b/src/ui/panelcontextbuttonbar.cpp @@ -100,6 +100,22 @@ bool PanelContextButtonBar::isBarVisible() const return m_visible; } +void PanelContextButtonBar::move(int x, int y) +{ + qDebug() << __PRETTY_FUNCTION__; + + if (m_visible) + QWidget::move(x, y - height()); + else + QWidget::move(x, y); + + QPoint hiddenPosition(x, y); + m_stateHidden->assignProperty(this, "pos", hiddenPosition); + + QPoint visiblePosition(x, y - height()); + m_stateVisible->assignProperty(this, "pos", visiblePosition); +} + void PanelContextButtonBar::paintEvent(QPaintEvent *event) { qDebug() << __PRETTY_FUNCTION__; @@ -119,22 +135,11 @@ void PanelContextButtonBar::paintEvent(QPaintEvent *event) painter.drawPixmap(CONTEXT_BUTTON_BAR_TOP_X, CONTEXT_BUTTON_BAR_TOP_Y, m_barTop); painter.drawTiledPixmap(m_barRect, m_barTile); -} - -void PanelContextButtonBar::move(int x, int y) -{ - qDebug() << __PRETTY_FUNCTION__; + // Temporary border, REMOVE WHEN NOT NEEDED ANYMORE! + painter.setPen(Qt::red); + painter.drawRect(this->rect().x(), this->rect().y(), + this->rect().width() - 1, this->rect().height() - 1); - if (m_visible) - QWidget::move(x, y - height()); - else - QWidget::move(x, y); - - QPoint hiddenPosition(x, y); - m_stateHidden->assignProperty(this, "pos", hiddenPosition); - - QPoint visiblePosition(x, y - height()); - m_stateVisible->assignProperty(this, "pos", visiblePosition); } void PanelContextButtonBar::setContextButtons(QWidget *contextButtons) diff --git a/src/ui/paneltabbar.cpp b/src/ui/paneltabbar.cpp index c375a3c..8f394dd 100644 --- a/src/ui/paneltabbar.cpp +++ b/src/ui/paneltabbar.cpp @@ -26,6 +26,9 @@ #include "paneltabbar.h" +// REMOVE WHEN NOT NEEDED ANYMORE +#include + const int APPEND_INDEX = -1; const int NO_ACTIVE_TABS = -1; @@ -75,6 +78,20 @@ int PanelTabBar::insertTab(int index, const QIcon& icon) return index; } +// Used to draw temporary border around widget, REMOVE WHEN NOT NEEDED ANYMORE! +void PanelTabBar::paintEvent(QPaintEvent *event) +{ + qDebug() << __PRETTY_FUNCTION__; + + Q_UNUSED(event); + + QPainter painter(this); + + painter.setPen(Qt::red); + painter.drawRect(this->rect().x(), this->rect().y(), + this->rect().width() - 1, this->rect().height() - 1); +} + void PanelTabBar::removeTab(int index) { qDebug() << __PRETTY_FUNCTION__; diff --git a/src/ui/paneltabbar.h b/src/ui/paneltabbar.h index 9e555da..439ae07 100644 --- a/src/ui/paneltabbar.h +++ b/src/ui/paneltabbar.h @@ -44,6 +44,13 @@ public: PanelTabBar(QWidget *parent = 0); /******************************************************************************* + * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS + ******************************************************************************/ +protected: + // Used to draw temporary border around widget, REMOVE WHEN NOT NEEDED ANYMORE! + void paintEvent(QPaintEvent *event); + +/******************************************************************************* * MEMBER FUNCTIONS AND SLOTS ******************************************************************************/ public: -- 1.7.9.5