fixed grips of palette issue. The position of the grip palette follow the menu bar position

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent fde0d49d6b
commit 64215876f0
  1. 36
      src/board/UBBoardPaletteManager.cpp
  2. 1
      src/board/UBBoardPaletteManager.h
  3. 21
      src/gui/UBDockPalette.cpp
  4. 15
      src/gui/UBDockPalette.h

@ -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);
}

@ -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();

@ -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) {

@ -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

Loading…
Cancel
Save