|
|
|
@ -540,35 +540,35 @@ int UBDockPalette::customMargin() |
|
|
|
|
* \brief Add the given tab widget |
|
|
|
|
* @param widget as the given widget |
|
|
|
|
*/ |
|
|
|
|
void UBDockPalette::addTab(UBDockPaletteWidget *widget) |
|
|
|
|
{ |
|
|
|
|
if(!mTabWidgets.contains(widget)) |
|
|
|
|
{ |
|
|
|
|
widget->setVisible(true); |
|
|
|
|
mTabWidgets.append(widget); |
|
|
|
|
mpStackWidget->addWidget(widget); |
|
|
|
|
mpStackWidget->setCurrentWidget(widget); |
|
|
|
|
update(); |
|
|
|
|
} |
|
|
|
|
void UBDockPalette::addTab(UBDockPaletteWidget *widget) |
|
|
|
|
{ |
|
|
|
|
if(!mTabWidgets.contains(widget) && widget->visibleState()) |
|
|
|
|
{ |
|
|
|
|
widget->setVisible(true); |
|
|
|
|
mTabWidgets.append(widget); |
|
|
|
|
mpStackWidget->addWidget(widget); |
|
|
|
|
mpStackWidget->setCurrentWidget(widget); |
|
|
|
|
update(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/**
|
|
|
|
|
* \brief Remove the given tab |
|
|
|
|
* @param widgetName as the tab widget name |
|
|
|
|
*/ |
|
|
|
|
void UBDockPalette::removeTab(const QString &widgetName) |
|
|
|
|
{ |
|
|
|
|
for(int i = 0; i < mTabWidgets.size(); i++) |
|
|
|
|
{ |
|
|
|
|
UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); |
|
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) |
|
|
|
|
{ |
|
|
|
|
mpStackWidget->removeWidget(pCrntWidget); |
|
|
|
|
mTabWidgets.remove(i); |
|
|
|
|
pCrntWidget->hide(); |
|
|
|
|
update(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
void UBDockPalette::removeTab(const QString &widgetName) |
|
|
|
|
{ |
|
|
|
|
for(int i = 0; i < mTabWidgets.size(); i++) |
|
|
|
|
{ |
|
|
|
|
UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i); |
|
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) |
|
|
|
|
{ |
|
|
|
|
mpStackWidget->removeWidget(pCrntWidget); |
|
|
|
|
mTabWidgets.remove(i); |
|
|
|
|
pCrntWidget->hide(); |
|
|
|
|
update(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -600,6 +600,7 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName) |
|
|
|
|
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); |
|
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)) |
|
|
|
|
{ |
|
|
|
|
pCrntWidget->setVisibleState(true); |
|
|
|
|
addTab(pCrntWidget); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -612,6 +613,13 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName) |
|
|
|
|
*/ |
|
|
|
|
void UBDockPalette::onHideTabWidget(const QString &widgetName) |
|
|
|
|
{ |
|
|
|
|
for(int i = 0; i < mRegisteredWidgets.size(); i++){ |
|
|
|
|
UBDockPaletteWidget* pCrntWidget = mRegisteredWidgets.at(i); |
|
|
|
|
if(NULL != pCrntWidget && (pCrntWidget->name() == widgetName)){ |
|
|
|
|
pCrntWidget->setVisibleState(false); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
removeTab(widgetName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|