|
|
@ -567,19 +567,15 @@ void UBDockPalette::addTab(UBDockPaletteWidget *widget) |
|
|
|
* \brief Remove the given tab |
|
|
|
* \brief Remove the given tab |
|
|
|
* @param widgetName as the tab widget name |
|
|
|
* @param widgetName as the tab widget name |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void UBDockPalette::removeTab(const QString &widgetName) |
|
|
|
void UBDockPalette::removeTab(UBDockPaletteWidget* widget) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i = 0; i < mTabWidgets.size(); i++) |
|
|
|
int nWidget = mTabWidgets.indexOf(widget); |
|
|
|
|
|
|
|
if( nWidget >= 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); |
|
|
|
mpStackWidget->removeWidget(widget); |
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) |
|
|
|
mTabWidgets.remove(nWidget); |
|
|
|
{ |
|
|
|
widget->hide(); |
|
|
|
mpStackWidget->removeWidget(pCrntWidget); |
|
|
|
update(); |
|
|
|
mTabWidgets.remove(i); |
|
|
|
|
|
|
|
pCrntWidget->hide(); |
|
|
|
|
|
|
|
update(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
resizeTabs(); |
|
|
|
resizeTabs(); |
|
|
|
mCurrentTab = qMax(mCurrentTab - 1, 0); |
|
|
|
mCurrentTab = qMax(mCurrentTab - 1, 0); |
|
|
@ -607,17 +603,12 @@ int UBDockPalette::tabSpacing() |
|
|
|
* \brief Show the given widget |
|
|
|
* \brief Show the given widget |
|
|
|
* @param widgetName as the given widget name |
|
|
|
* @param widgetName as the given widget name |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void UBDockPalette::onShowTabWidget(const QString &widgetName) |
|
|
|
void UBDockPalette::onShowTabWidget(UBDockPaletteWidget* widget) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i = 0; i < mRegisteredWidgets.size(); i++) |
|
|
|
if (mRegisteredWidgets.contains(widget)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); |
|
|
|
widget->setVisibleState(true); |
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) |
|
|
|
addTab(widget); |
|
|
|
{ |
|
|
|
|
|
|
|
pCrntWidget->setVisibleState(true); |
|
|
|
|
|
|
|
addTab(pCrntWidget); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -625,16 +616,13 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName) |
|
|
|
* \brief Hide the given widget |
|
|
|
* \brief Hide the given widget |
|
|
|
* @param widgetName as the given widget name |
|
|
|
* @param widgetName as the given widget name |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void UBDockPalette::onHideTabWidget(const QString &widgetName) |
|
|
|
void UBDockPalette::onHideTabWidget(UBDockPaletteWidget* widget) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i = 0; i < mRegisteredWidgets.size(); i++){ |
|
|
|
if (mRegisteredWidgets.contains(widget)) |
|
|
|
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); |
|
|
|
{ |
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)){ |
|
|
|
widget->setVisibleState(false); |
|
|
|
pCrntWidget->setVisibleState(false); |
|
|
|
removeTab(widget); |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
removeTab(widgetName); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -644,8 +632,8 @@ void UBDockPalette::connectSignals() |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i=0; i < mRegisteredWidgets.size(); i++) |
|
|
|
for(int i=0; i < mRegisteredWidgets.size(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
connect(mRegisteredWidgets.at(i), SIGNAL(showTab(QString)), this, SLOT(onShowTabWidget(QString))); |
|
|
|
connect(mRegisteredWidgets.at(i), SIGNAL(showTab(UBDockPaletteWidget*)), this, SLOT(onShowTabWidget(UBDockPaletteWidget*))); |
|
|
|
connect(mRegisteredWidgets.at(i), SIGNAL(hideTab(QString)), this, SLOT(onHideTabWidget(QString))); |
|
|
|
connect(mRegisteredWidgets.at(i), SIGNAL(hideTab(UBDockPaletteWidget*)), this, SLOT(onHideTabWidget(UBDockPaletteWidget*))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -747,7 +735,7 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
removeTab(pNextWidget->name()); |
|
|
|
removeTab(pNextWidget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|