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