本文整理汇总了C++中TabWidget::removeTab方法的典型用法代码示例。如果您正苦于以下问题:C++ TabWidget::removeTab方法的具体用法?C++ TabWidget::removeTab怎么用?C++ TabWidget::removeTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabWidget
的用法示例。
在下文中一共展示了TabWidget::removeTab方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveTab
void TabWidget::moveTab(QWidget* what,TabWidget *where){
TabWidget* from = dynamic_cast<TabWidget*>(what->parentWidget());
if(!from){
return;
}
if(from == where){
/*We check that even if it is the same TabWidget, it really exists.*/
bool found = false;
for (int i =0; i < from->count(); ++i) {
if (what == from->tabAt(i)) {
found = true;
break;
}
}
if (found) {
return;
}
//it wasn't found somehow
}
from->removeTab(what);
assert(where);
where->appendTab(what);
what->setParent(where);
where->getGui()->getApp()->triggerAutoSave();
}
示例2: closeSession
void SessionManager::closeSession(GameWidget *gameWidget, int index)
{
TabWidget *tabWidget = TabWidget::getInstance();
Client *client = gameWidget->getClient();
ServerEntry *serverEntry = client->getServerEntry();
tabWidget->removeTab(index);
client->getConnection()->hostDisconnect();
// Remove the ServerEntry from the list.
if (sessions.remove(serverEntry)) {
emit (onSessionClosed());
} else {
qDebug() << tr("This session does not exist.");
}
delete gameWidget;
}
示例3: unregisterTab
void
Gui::removeGroupGui(NodeGraph* tab,
bool deleteData)
{
tab->hide();
if (_imp->_lastFocusedGraph == tab) {
_imp->_lastFocusedGraph = 0;
}
TabWidget* container = dynamic_cast<TabWidget*>( tab->parentWidget() );
if (container) {
container->removeTab(tab, true);
}
if (deleteData) {
std::list<NodeGraph*>::iterator it = std::find(_imp->_groups.begin(), _imp->_groups.end(), tab);
if ( it != _imp->_groups.end() ) {
_imp->_groups.erase(it);
}
unregisterTab(tab);
tab->deleteLater();
}
}
示例4: logic_error
void
Gui::removeViewerTab(ViewerTab* tab,
bool initiatedFromNode,
bool deleteData)
{
assert(tab);
unregisterTab(tab);
if (tab == _imp->_activeViewer) {
_imp->_activeViewer = 0;
}
NodeGraph* graph = 0;
NodeGroupPtr isGrp;
NodeCollectionPtr collection;
if ( tab->getInternalNode() && tab->getInternalNode()->getNode() ) {
NodeCollectionPtr collection = tab->getInternalNode()->getNode()->getGroup();
isGrp = toNodeGroup(collection);
}
if (isGrp) {
NodeGraphI* graph_i = isGrp->getNodeGraph();
assert(graph_i);
graph = dynamic_cast<NodeGraph*>(graph_i);
} else {
graph = getNodeGraph();
}
assert(graph);
if (!graph) {
throw std::logic_error("");
}
ViewerTab* lastSelectedViewer = graph->getLastSelectedViewer();
if (lastSelectedViewer == tab) {
bool foundOne = false;
NodesList nodes;
if (collection) {
nodes = collection->getNodes();
}
for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) {
ViewerNodePtr isViewer = (*it)->isEffectViewerNode();
if ( !isViewer || ( isViewer == tab->getInternalNode() ) || !(*it)->isActivated() ) {
continue;
}
OpenGLViewerI* viewerI = isViewer->getUiContext();
assert(viewerI);
ViewerGL* glViewer = dynamic_cast<ViewerGL*>(viewerI);
assert(glViewer);
if (glViewer) {
graph->setLastSelectedViewer( glViewer->getViewerTab() );
}
foundOne = true;
break;
}
if (!foundOne) {
graph->setLastSelectedViewer(0);
}
}
ViewerNodePtr viewerNode = tab->getInternalNode();
ViewerInstancePtr internalViewer;
if (viewerNode) {
internalViewer = viewerNode->getInternalViewerNode();
}
if (internalViewer) {
internalViewer->abortAnyEvaluation();
if (getApp()->getLastViewerUsingTimeline() == internalViewer) {
getApp()->discardLastViewerUsingTimeline();
}
}
if (!initiatedFromNode) {
assert(_imp->_nodeGraphArea);
///call the deleteNode which will call this function again when the node will be deactivated.
NodePtr internalNode = tab->getInternalNode()->getNode();
NodeGuiIPtr guiI = internalNode->getNodeGui();
NodeGuiPtr gui = boost::dynamic_pointer_cast<NodeGui>(guiI);
assert(gui);
NodeGraphI* graph_i = internalNode->getGroup()->getNodeGraph();
assert(graph_i);
NodeGraph* graph = dynamic_cast<NodeGraph*>(graph_i);
assert(graph);
if (graph) {
graph->removeNode(gui);
}
} else {
tab->hide();
TabWidget* container = dynamic_cast<TabWidget*>( tab->parentWidget() );
if (container) {
container->removeTab(tab, false);
}
if (deleteData) {
QMutexLocker l(&_imp->_viewerTabsMutex);
std::list<ViewerTab*>::iterator it = std::find(_imp->_viewerTabs.begin(), _imp->_viewerTabs.end(), tab);
if ( it != _imp->_viewerTabs.end() ) {
_imp->_viewerTabs.erase(it);
//.........这里部分代码省略.........
示例5: getApp
void
Gui::wipeLayout()
{
std::list<TabWidgetI*> panesCpy = getApp()->getTabWidgetsSerialization();
getApp()->clearTabWidgets();
std::list<SerializableWindow*> floatingWidgets = getApp()->getFloatingWindowsSerialization();
FloatingWidget* projectFW = _imp->_projectGui->getPanel()->getFloatingWindow();
for (std::list<SerializableWindow*>::const_iterator it = floatingWidgets.begin(); it != floatingWidgets.end(); ++it) {
if (!projectFW || (*it) != projectFW) {
FloatingWidget* isFloating = dynamic_cast<FloatingWidget*>(*it);
if (isFloating) {
isFloating->deleteLater();
}
}
}
getApp()->clearFloatingWindows();
// Re-add the project window
if (projectFW) {
getApp()->registerFloatingWindow(projectFW);
}
for (std::list<TabWidgetI*>::iterator it = panesCpy.begin(); it != panesCpy.end(); ++it) {
TabWidget* pane = dynamic_cast<TabWidget*>(*it);
if (!pane) {
continue;
}
///Conserve tabs by removing them from the tab widgets. This way they will not be deleted.
while ( pane->count() > 0 ) {
pane->removeTab(0, false);
}
//(*it)->setParent(NULL);
pane->deleteLater();
}
std::list<SplitterI*> splittersCpy = getApp()->getSplittersSerialization();
getApp()->clearSplitters();
for (std::list<SplitterI*>::iterator it = splittersCpy.begin(); it != splittersCpy.end(); ++it) {
if (_imp->_leftRightSplitter != *it) {
Splitter* isSplitter = dynamic_cast<Splitter*>(*it);
if (!isSplitter) {
continue;
}
while ( isSplitter->count() > 0 ) {
isSplitter->widget(0)->setParent(NULL);
}
//(*it)->setParent(NULL);
isSplitter->deleteLater();
}
}
Splitter *newSplitter = new Splitter(Qt::Horizontal,this, _imp->_centralWidget);
newSplitter->addWidget(_imp->_toolBox);
newSplitter->setObjectName_mt_safe( _imp->_leftRightSplitter->objectName_mt_safe() );
_imp->_mainLayout->removeWidget(_imp->_leftRightSplitter);
getApp()->unregisterSplitter(_imp->_leftRightSplitter);
_imp->_leftRightSplitter->deleteLater();
_imp->_leftRightSplitter = newSplitter;
_imp->_leftRightSplitter->setChildrenCollapsible(false);
_imp->_mainLayout->addWidget(newSplitter);
getApp()->registerSplitter(newSplitter);
// Re-create new menu actions
createMenuActions();
} // Gui::wipeLayout