diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index b029d2b7..fd45df13 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -908,18 +908,6 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var) mStylusPalette->setVisible(bVisible); // always show stylus palette at startup } -/* -UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent) -{ - mpDesktopLibWidget = new UBLibWidget(); - mDesktopRightPalette = new UBRightPalette(parent); - mDesktopRightPalette->registerWidget(mpDesktopLibWidget); - mDesktopRightPalette->addTabWidget(mpDesktopLibWidget); - mDesktopRightPalette->connectSignals(); - - return mDesktopRightPalette; -} -*/ void UBBoardPaletteManager::connectToDocumentController() { @@ -951,27 +939,3 @@ void UBBoardPaletteManager::stopDownloads() mRightPalette->removeTab(mpDownloadWidget); } } - -QRect UBBoardPaletteManager::GetFreeRectGlobalCoords() const -{ - QPoint topLeft, bottomRight; - if (mLeftPalette) { - int x = mLeftPalette->getTabPaletteRect().topRight().x(); - int y = 0; - if (x || y) { - topLeft.setX(x); - topLeft.setY(y); - topLeft = mContainer->mapToGlobal(topLeft); - } - } - if (mRightPalette) { - int x = mRightPalette->getTabPaletteRect().topLeft().x(); - int y = mRightPalette->height(); - if (x || y) { - bottomRight.setX(x); - bottomRight.setY(y); - bottomRight = mContainer->mapToGlobal(bottomRight); - } - } - return QRect(topLeft, bottomRight); -} diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 2c126614..e90e9ed5 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -63,7 +63,6 @@ class UBBoardPaletteManager : public QObject void changeMode(eUBDockPaletteWidgetMode newMode, bool isInit = false); void startDownloads(); void stopDownloads(); - QRect GetFreeRectGlobalCoords() const; signals: void connectToDocController(); diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 05db3206..824726a5 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -42,7 +42,7 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co , mpLayout(NULL) , mCurrentTab(0) , mPaletteType(paletteType) - , mTabPalette(new UBTabDockPalete(this, parent)) + , mTabPalette(new UBTabDockPalette(this, parent)) { setObjectName(name); @@ -346,6 +346,8 @@ void UBDockPalette::setTabsOrientation(eUBDockTabOrientation orientation) /** * \brief Update the tab position regarding the toolbar position (up or down) */ +#include "board/UBBoardController.h" +#include "domain/UBGraphicsScene.h" void UBDockPalette::onToolbarPosUpdated() { // Get the position of the tab @@ -357,6 +359,7 @@ void UBDockPalette::onToolbarPosUpdated() { setTabsOrientation(eUBDockTabOrientation_Down); } + moveTabs(); update(); } @@ -491,13 +494,13 @@ void UBDockPalette::onAllDownloadsFinished() void UBDockPalette::moveTabs() { - if (!mHTab) { + // if (!mHTab) { if(eUBDockTabOrientation_Up == mTabsOrientation) { mHTab = border(); } else { mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); } - } +// } QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); @@ -572,7 +575,7 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) } -UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) : +UBTabDockPalette::UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent) : QWidget(parent) , dock(dockPalette) , mVerticalOffset(0) @@ -584,7 +587,7 @@ UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) : setAttribute(Qt::WA_TranslucentBackground); } -void UBTabDockPalete::paintEvent(QPaintEvent *) +void UBTabDockPalette::paintEvent(QPaintEvent *) { int nTabs = dock->mTabWidgets.size(); if (nTabs <= 0) { @@ -654,11 +657,11 @@ void UBTabDockPalete::paintEvent(QPaintEvent *) painter.restore(); } } -UBTabDockPalete::~UBTabDockPalete() +UBTabDockPalette::~UBTabDockPalette() { } -void UBTabDockPalete::mousePressEvent(QMouseEvent *event) +void UBTabDockPalette::mousePressEvent(QMouseEvent *event) { dock->mClickTime = QTime::currentTime(); // The goal here is to verify if the user can resize the widget. @@ -684,7 +687,7 @@ void UBTabDockPalete::mousePressEvent(QMouseEvent *event) break; } } -void UBTabDockPalete::mouseMoveEvent(QMouseEvent *event) +void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) { QPoint p = event->pos(); @@ -735,7 +738,7 @@ void UBTabDockPalete::mouseMoveEvent(QMouseEvent *event) } } } -void UBTabDockPalete::mouseReleaseEvent(QMouseEvent *event) +void UBTabDockPalette::mouseReleaseEvent(QMouseEvent *event) { Q_UNUSED(event); if(!dock->mResized && dock->mClickTime.elapsed() < CLICKTIME) { diff --git a/src/gui/UBDockPalette.h b/src/gui/UBDockPalette.h index 0d660e0a..a513db75 100644 --- a/src/gui/UBDockPalette.h +++ b/src/gui/UBDockPalette.h @@ -32,7 +32,7 @@ #include "UBDockPaletteWidget.h" #define TABSIZE 50 //Height of the tab of the palette -#define CLICKTIME 1000000 //Clicktime to expand or collapse paltte +#define CLICKTIME 1000000 //Clicktime to expand or collapse palette /** * \brief The dock positions @@ -53,15 +53,15 @@ typedef enum class UBDockPalette; -class UBTabDockPalete : public QWidget +class UBTabDockPalette : public QWidget { Q_OBJECT friend class UBDockPalette; public: - UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent = 0); - ~UBTabDockPalete(); + UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent = 0); + ~UBTabDockPalette(); protected: virtual void mousePressEvent(QMouseEvent *event); @@ -87,7 +87,7 @@ typedef enum class UBDockPalette : public QWidget { Q_OBJECT - friend class UBTabDockPalete; + friend class UBTabDockPalette; public: UBDockPalette(eUBDockPaletteType paletteType, QWidget* parent=0, const char* name="UBDockPalette"); @@ -102,9 +102,6 @@ public: virtual void assignParent(QWidget *widget); virtual void setVisible(bool visible); -// virtual void mouseMoveEvent(QMouseEvent *event); -// virtual void mousePressEvent(QMouseEvent *event); -// virtual void mouseReleaseEvent(QMouseEvent *event); virtual void paintEvent(QPaintEvent *event); virtual void enterEvent(QEvent *); virtual void leaveEvent(QEvent *); @@ -192,7 +189,7 @@ private: private: eUBDockPaletteType mPaletteType; - UBTabDockPalete *mTabPalette; + UBTabDockPalette *mTabPalette; }; #endif // UBDOCKPALETTE_H diff --git a/src/gui/UBLeftPalette.cpp b/src/gui/UBLeftPalette.cpp index 8dbfba90..00e0a4d9 100644 --- a/src/gui/UBLeftPalette.cpp +++ b/src/gui/UBLeftPalette.cpp @@ -23,13 +23,13 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name): UBDockPalette(eUBDockPaletteType_LEFT, parent) { - setObjectName(name); - setOrientation(eUBDockOrientation_Left); + setObjectName(name); + setOrientation(eUBDockOrientation_Left); - mLastWidth = UBSettings::settings()->leftLibPaletteWidth->get().toInt(); - mCollapseWidth = 150; + mLastWidth = UBSettings::settings()->leftLibPaletteWidth->get().toInt(); + mCollapseWidth = 150; - resize(mLastWidth, parentWidget()->height()); + resize(mLastWidth, parentWidget()->height()); } /**