|
|
|
@ -56,7 +56,7 @@ UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, co |
|
|
|
|
mTabWidgets.clear(); |
|
|
|
|
|
|
|
|
|
// We let 2 pixels in order to keep a small border for the resizing
|
|
|
|
|
setMinimumWidth(/*2*border() + 2*/0); |
|
|
|
|
setMinimumWidth(0); |
|
|
|
|
|
|
|
|
|
if (parent) |
|
|
|
|
{ |
|
|
|
@ -131,138 +131,6 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Handle the mouse move event |
|
|
|
|
* @param as the mouse event |
|
|
|
|
*/ |
|
|
|
|
//void UBDockPalette::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// QPoint p = event->pos();
|
|
|
|
|
|
|
|
|
|
// if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance()))
|
|
|
|
|
// {
|
|
|
|
|
// switch(mOrientation)
|
|
|
|
|
// {
|
|
|
|
|
// case eUBDockOrientation_Left:
|
|
|
|
|
// if(p.x() < collapseWidth() && p.x() >= minimumWidth())
|
|
|
|
|
// {
|
|
|
|
|
// resize(border(), height());
|
|
|
|
|
// mLastWidth = collapseWidth() + 1;
|
|
|
|
|
// mResized = true;
|
|
|
|
|
// }
|
|
|
|
|
// else if(p.x() <= maximumWidth() && p.x() >= minimumWidth())
|
|
|
|
|
// {
|
|
|
|
|
// resize(p.x(), height());
|
|
|
|
|
// mResized = true;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// case eUBDockOrientation_Right:
|
|
|
|
|
// if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width()))
|
|
|
|
|
// {
|
|
|
|
|
// resize(border(), height());
|
|
|
|
|
// mLastWidth = collapseWidth() + 1;
|
|
|
|
|
// mResized = true;
|
|
|
|
|
// }
|
|
|
|
|
// else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth()))
|
|
|
|
|
// {
|
|
|
|
|
// resize(parentWidget()->width() - (this->x() + p.x()), height());
|
|
|
|
|
// mResized = true;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
// case eUBDockOrientation_Top:
|
|
|
|
|
// case eUBDockOrientation_Bottom:
|
|
|
|
|
// if(p.y() <= maximumHeight())
|
|
|
|
|
// {
|
|
|
|
|
// resize(width(), p.y());
|
|
|
|
|
// mResized = true;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
// default:
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Handle the mouse press event |
|
|
|
|
* @param as the mouse event |
|
|
|
|
*/ |
|
|
|
|
//void UBDockPalette::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
//{
|
|
|
|
|
// mClickTime = QTime::currentTime();
|
|
|
|
|
// // The goal here is to verify if the user can resize the widget.
|
|
|
|
|
// // It is only possible to resize it if the border is selected
|
|
|
|
|
// QPoint p = event->pos();
|
|
|
|
|
// mMousePressPos = p;
|
|
|
|
|
// mResized = false;
|
|
|
|
|
|
|
|
|
|
// switch(mOrientation)
|
|
|
|
|
// {
|
|
|
|
|
// case eUBDockOrientation_Left:
|
|
|
|
|
// if((p.x() >= width() - 2 * border()) && (p.x() <= width()))
|
|
|
|
|
// {
|
|
|
|
|
// mCanResize = true;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// case eUBDockOrientation_Right:
|
|
|
|
|
// if((p.x() >= 0) && (p.x() <= 2 * border()))
|
|
|
|
|
// {
|
|
|
|
|
// mCanResize = true;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// case eUBDockOrientation_Top:
|
|
|
|
|
// // Not supported yet
|
|
|
|
|
// break;
|
|
|
|
|
// case eUBDockOrientation_Bottom:
|
|
|
|
|
// // Not supported yet
|
|
|
|
|
// break;
|
|
|
|
|
// default:
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Handle the mouse release event |
|
|
|
|
* @param event as the mouse event |
|
|
|
|
*/ |
|
|
|
|
//void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
//{
|
|
|
|
|
// Q_UNUSED(event);
|
|
|
|
|
// if(!mResized && mClickTime.elapsed() < CLICKTIME)
|
|
|
|
|
// {
|
|
|
|
|
// int nbTabs = mTabWidgets.size();
|
|
|
|
|
// int clickedTab = 0;
|
|
|
|
|
// // If the clicked position is in the tab, perform the related action
|
|
|
|
|
// if(eUBDockOrientation_Left == mOrientation)
|
|
|
|
|
// {
|
|
|
|
|
// if(mMousePressPos.x() >= width() - 2*border() &&
|
|
|
|
|
// mMousePressPos.y() >= mHTab &&
|
|
|
|
|
// mMousePressPos.x() <= width() &&
|
|
|
|
|
// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
|
|
|
|
|
// {
|
|
|
|
|
// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
|
|
|
|
|
// tabClicked(clickedTab);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else if(eUBDockOrientation_Right == mOrientation)
|
|
|
|
|
// {
|
|
|
|
|
// if(mMousePressPos.x() >= 0 &&
|
|
|
|
|
// mMousePressPos.x() <= 2*border() &&
|
|
|
|
|
// mMousePressPos.y() >= mHTab &&
|
|
|
|
|
// mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
|
|
|
|
|
// {
|
|
|
|
|
// clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
|
|
|
|
|
// tabClicked(clickedTab);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// mCanResize = false;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Handle the resize event |
|
|
|
|
* @param event as the resize event |
|
|
|
@ -356,52 +224,6 @@ void UBDockPalette::paintEvent(QPaintEvent *event) |
|
|
|
|
mHTab = height() - border() - nbTabs*TABSIZE - (nbTabs-1)*tabSpacing(); |
|
|
|
|
} |
|
|
|
|
painter.drawPath(path); |
|
|
|
|
|
|
|
|
|
// for(int i = 0; i < mTabWidgets.size(); i++)
|
|
|
|
|
// {
|
|
|
|
|
// UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i);
|
|
|
|
|
// if(NULL != pCrntWidget)
|
|
|
|
|
// {
|
|
|
|
|
// if(mOrientation == eUBDockOrientation_Left)
|
|
|
|
|
// {
|
|
|
|
|
// path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
|
|
|
|
|
// painter.drawPath(path);
|
|
|
|
|
// QPixmap iconPixmap;
|
|
|
|
|
// if(mCollapseWidth >= width())
|
|
|
|
|
// {
|
|
|
|
|
// // Get the collapsed icon
|
|
|
|
|
// iconPixmap = pCrntWidget->iconToRight();
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// // Get the expanded icon
|
|
|
|
|
// iconPixmap = pCrntWidget->iconToLeft();
|
|
|
|
|
// }
|
|
|
|
|
// painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap);
|
|
|
|
|
// }
|
|
|
|
|
// else if(mOrientation == eUBDockOrientation_Right)
|
|
|
|
|
// {
|
|
|
|
|
// path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
|
|
|
|
|
// painter.drawPath(path);
|
|
|
|
|
// QPixmap iconPixmap;
|
|
|
|
|
// if(mCollapseWidth >= width())
|
|
|
|
|
// {
|
|
|
|
|
// // Get the collapsed icon
|
|
|
|
|
// iconPixmap = pCrntWidget->iconToLeft();
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// // Get the expanded icon
|
|
|
|
|
// iconPixmap = pCrntWidget->iconToRight();
|
|
|
|
|
// }
|
|
|
|
|
// painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -758,12 +580,11 @@ UBTabDockPalete::UBTabDockPalete(UBDockPalette *dockPalette, QWidget *parent) : |
|
|
|
|
{ |
|
|
|
|
int numTabs = dock->mTabWidgets.size(); |
|
|
|
|
resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); |
|
|
|
|
// move(dock->width(), 20);
|
|
|
|
|
|
|
|
|
|
setAttribute(Qt::WA_TranslucentBackground); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBTabDockPalete::paintEvent(QPaintEvent */*event*/) |
|
|
|
|
void UBTabDockPalete::paintEvent(QPaintEvent *) |
|
|
|
|
{ |
|
|
|
|
int nTabs = dock->mTabWidgets.size(); |
|
|
|
|
if (nTabs <= 0) { |
|
|
|
@ -945,6 +766,3 @@ void UBTabDockPalete::mouseReleaseEvent(QMouseEvent *event) |
|
|
|
|
|
|
|
|
|
dock->mCanResize = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|