|
|
@ -29,20 +29,20 @@ |
|
|
|
* \brief The constructor |
|
|
|
* \brief The constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, const char *name) |
|
|
|
UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, const char *name) |
|
|
|
:QWidget(parent, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint) |
|
|
|
:QWidget(parent, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint) |
|
|
|
, mOrientation(eUBDockOrientation_Left) |
|
|
|
, mOrientation(eUBDockOrientation_Left) |
|
|
|
, mPreferredWidth(100) |
|
|
|
, mPreferredWidth(100) |
|
|
|
, mPreferredHeight(100) |
|
|
|
, mPreferredHeight(100) |
|
|
|
, mCanResize(false) |
|
|
|
, mCanResize(false) |
|
|
|
, mResized(false) |
|
|
|
, mResized(false) |
|
|
|
, mCollapseWidth(150) |
|
|
|
, mCollapseWidth(150) |
|
|
|
, mLastWidth(-1) |
|
|
|
, mLastWidth(-1) |
|
|
|
, mHTab(0) |
|
|
|
, mHTab(0) |
|
|
|
, mpStackWidget(NULL) |
|
|
|
, mpStackWidget(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mCurrentTab(0) |
|
|
|
, mCurrentTab(0) |
|
|
|
, mPaletteType(paletteType) |
|
|
|
, mPaletteType(paletteType) |
|
|
|
, mTabPalette(new UBTabDockPalette(this, parent)) |
|
|
|
, mTabPalette(new UBTabDockPalette(this, parent)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
@ -302,12 +302,6 @@ void UBDockPalette::showTabWidget(int tabIndex) |
|
|
|
mpStackWidget->setCurrentIndex(tabIndex); |
|
|
|
mpStackWidget->setCurrentIndex(tabIndex); |
|
|
|
mCurrentTab = tabIndex; |
|
|
|
mCurrentTab = tabIndex; |
|
|
|
|
|
|
|
|
|
|
|
// Expand it if collapsed
|
|
|
|
|
|
|
|
if(mLastWidth != -1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
toggleCollapseExpand(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the current tab index
|
|
|
|
// Update the current tab index
|
|
|
|
if(NULL != (dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex)))){ |
|
|
|
if(NULL != (dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex)))){ |
|
|
|
mCrntTabWidget = dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex))->name(); |
|
|
|
mCrntTabWidget = dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex))->name(); |
|
|
@ -320,17 +314,11 @@ void UBDockPalette::showTabWidget(int tabIndex) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void UBDockPalette::toggleCollapseExpand() |
|
|
|
void UBDockPalette::toggleCollapseExpand() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(mLastWidth == -1) |
|
|
|
if(width() < mCollapseWidth) |
|
|
|
{ |
|
|
|
resize(mLastWidth,height()); |
|
|
|
// The palette must be collapsed
|
|
|
|
else{ |
|
|
|
mLastWidth = width(); |
|
|
|
mLastWidth = width(); |
|
|
|
resize(0, height()); |
|
|
|
resize(0,height()); |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// The palette will be expanded
|
|
|
|
|
|
|
|
resize(mLastWidth, height()); |
|
|
|
|
|
|
|
mLastWidth = -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -498,7 +486,7 @@ void UBDockPalette::moveTabs() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); |
|
|
|
mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); |
|
|
|
} |
|
|
|
} |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); |
|
|
|
QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); |
|
|
|
|
|
|
|
|
|
|
@ -575,9 +563,9 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) |
|
|
|
|
|
|
|
|
|
|
|
UBTabDockPalette::UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent) : |
|
|
|
UBTabDockPalette::UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent) : |
|
|
|
QWidget(parent) |
|
|
|
QWidget(parent) |
|
|
|
, dock(dockPalette) |
|
|
|
, dock(dockPalette) |
|
|
|
, mVerticalOffset(0) |
|
|
|
, mVerticalOffset(0) |
|
|
|
, mFlotable(false) |
|
|
|
, mFlotable(false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int numTabs = dock->mTabWidgets.size(); |
|
|
|
int numTabs = dock->mTabWidgets.size(); |
|
|
|
resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); |
|
|
|
resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); |
|
|
@ -703,7 +691,7 @@ void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) |
|
|
|
p.setX(p.x() + dock->width()); |
|
|
|
p.setX(p.x() + dock->width()); |
|
|
|
if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
dock->resize(0, dock->height()); |
|
|
|
dock->resize(0, dock->height()); |
|
|
|
dock->mLastWidth = dock->collapseWidth() + 1; |
|
|
|
//dock->mLastWidth = dock->collapseWidth() + 1;
|
|
|
|
dock->mResized = true; |
|
|
|
dock->mResized = true; |
|
|
|
} else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
} else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
dock->resize(p.x(), dock->height()); |
|
|
|
dock->resize(p.x(), dock->height()); |
|
|
@ -715,7 +703,7 @@ void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) |
|
|
|
p.setX(p.x() - 2 * dock->border()); |
|
|
|
p.setX(p.x() - 2 * dock->border()); |
|
|
|
if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { |
|
|
|
if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { |
|
|
|
dock->resize(0, dock->height()); |
|
|
|
dock->resize(0, dock->height()); |
|
|
|
dock->mLastWidth = dock->collapseWidth() + 1; |
|
|
|
//dock->mLastWidth = dock->collapseWidth() + 1;
|
|
|
|
dock->mResized = true; |
|
|
|
dock->mResized = true; |
|
|
|
} else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { |
|
|
|
} else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { |
|
|
|
dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); |
|
|
|
dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); |
|
|
|