本文整理汇总了C++中removeTab函数的典型用法代码示例。如果您正苦于以下问题:C++ removeTab函数的具体用法?C++ removeTab怎么用?C++ removeTab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeTab函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void TabView::close(int index)
{
assert(index >= 0 && index < count());
if (index < 0 || index >= count())
return;
if (auto pTab = qobject_cast<Tab*>(widget(index))) {
removeTab(index);
pTab->deleteLater();
}
emit countChanged(count());
}
示例2: get_editor
/**
* @brief Closes the editor at the specified index without confirmation.
* @param index An editor index.
*/
void EditorTabs::remove_editor(int index) {
Editor* editor = get_editor(index);
QString path = editor->get_file_path();
undo_group->removeStack(&editor->get_undo_stack());
// Tell the quest that this file is now closed.
editor->get_quest().set_path_open(path, false);
editors.remove(path);
removeTab(index);
}
示例3: saveWorkSheet
void Workspace::removeWorkSheet()
{
WorkSheet *current = (WorkSheet*)currentWidget();
if ( current ) {
saveWorkSheet( current );
removeTab(indexOf( current ));
mSheetList.removeAll( current );
} else {
QString msg = i18n( "There are no tabs that could be deleted." );
KMessageBox::error( this, msg );
}
}
示例4: removeTab
void TabbedArea::death(const Event& event)
{
Widget* source = event.getSource();
Tab* tab = dynamic_cast<Tab*>(source);
if (tab != NULL)
{
removeTab(tab);
}
else
{
BasicContainer::death(event);
}
}
示例5: qMin
bool TabWidget::swapTabs(int index1, int index2)
{
if (index1==index2)
return false;
int t1 = qMin(index1,index2);
int t2 = qMax(index1,index2);
index1=t1;
index2=t2;
QString name1 = tabBar()->tabText(index1);
QString name2 = tabBar()->tabText(index2);
QWidget *editor1 = widget(index1);
QWidget *editor2 = widget(index2);
removeTab(index2);
removeTab(index1);
insertTab(index1,editor2,name2);
insertTab(index2,editor1,name1);
return true;
}
示例6: IF_FAILED_RET
//----------------------------------------------------------------------------
//
HRESULT CAnchoAddonService::removeTabs(LPDISPATCH aTabs, LPDISPATCH aCallback)
{
VariantVector tabs;
IF_FAILED_RET(addJSArrayToVariantVector(aTabs, tabs));
for(VariantVector::iterator it = tabs.begin(); it != tabs.end(); ++it) {
if( it->vt == VT_I4 ) {
removeTab(it->intVal, aCallback);
} else {
ATLTRACE(L"Problem with specified tabId - not an integer\n");
}
}
return S_OK;
}
示例7: removeTab
TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id,
bool _add_stretch, bool _text_is_tooltip )
{
// already tab with id?
if( m_tabs.contains( _id ) )
{
// then remove it
removeTab( _id );
}
QString caption = ( _text_is_tooltip ) ? QString( "" ) : _text;
// create tab-button
TabButton * b = new TabButton( caption, _id, this );
connect( b, SIGNAL( clicked( int ) ), this, SLOT( tabClicked( int ) ) );
b->setIconSize( QSize( 48, 48 ) );
b->setFixedSize( 64, 64 );
b->show();
if( _text_is_tooltip )
{
ToolTip::add( b, _text );
}
// small workaround, because QBoxLayout::addWidget(...) doesn't
// work properly, so we first have to remove all tabs from the
// layout and them add them in the correct order
QMap<int, QPair<TabButton *, QWidget *> >::iterator it;
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->removeWidget( it.value().first );
}
m_tabs.insert( _id, qMakePair( b, _w ) );
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->addWidget( it.value().first );
}
if( _add_stretch )
{
m_layout->addStretch();
}
// we assume, parent-widget is a widget acting as widget-stack so all
// widgets have the same size and only the one on the top is visible
_w->setFixedSize( _w->parentWidget()->size() );
b->setFont( pointSize<8>( b->font() ) );
return( b );
}
示例8: insertTab
void TabWidget::showSubownerTab( bool b )
{
if ( b && !mSubVisible )
{
insertTab( 1, mSubownerTab, QIcon( ":/icons/conf/targets.png" ), "Subowned SRs" );
mSubVisible = true;
}
else if ( !b && mSubVisible )
{
removeTab( indexOf( mSubownerTab ) );
mSubVisible = false;
}
rebuildMaps();
}
示例9: tabAboutToRemove
bool TaskbarPreviews::WasTabRemoved(HWND hwnd)
{
QWidget *internal = m_tabs.internal(hwnd);
if (internal) {
QWidget *owner = m_tabs.owner(hwnd);
bool ignore = false;
emit tabAboutToRemove(m_tabs.user(hwnd), &ignore);
if (!ignore) {
SetNoTabActive((HWND)owner->winId());
removeTab(m_tabs.user(hwnd));
}
return true;
} else
return false;
}
示例10: widget
void TabWidget::removeTextEdit(QString title)
{
for(int i = 0; i < count(); i++)
{
if(title.compare(tabText(i)) == 0)
{
QWidget *tabwidget = widget(i);
if(tabwidget)
{
removeTab(i);
delete tabwidget;
}
}
}
}
示例11: removeTab
void CChartTable::slotCloseTab( int _iTabIndex )
{
QMutex* __pqMutexDataChange = QVCTRuntime::useMutexDataChange();
__pqMutexDataChange->lock();
CChart* __poChart = (CChart*)widget( _iTabIndex );
removeTab( _iTabIndex );
delete __poChart;
if( QTabWidget::currentIndex() < 0 )
{
oGeoPositionReference = CDataPosition::UNDEFINED;
fdScaleReference = -1.0;
}
__pqMutexDataChange->unlock();
bProjectModified = true;
}
示例12: QModelIndex
//! [3]
void AddressWidget::addEntry(QString name, QString address)
{
if (!table->getContacts().contains({ name, address })) {
table->insertRows(0, 1, QModelIndex());
QModelIndex index = table->index(0, 0, QModelIndex());
table->setData(index, name, Qt::EditRole);
index = table->index(0, 1, QModelIndex());
table->setData(index, address, Qt::EditRole);
removeTab(indexOf(newAddressTab));
} else {
QMessageBox::information(this, tr("Duplicate Name"),
tr("The name \"%1\" already exists.").arg(name));
}
}
示例13: beginResetModel
void DeclarativeTabModel::clear()
{
if (count() == 0)
return;
beginResetModel();
for (int i = m_tabs.count() - 1; i >= 0; --i) {
removeTab(m_tabs.at(i), i);
}
emit countChanged();
closeActiveTab();
endResetModel();
// No need guard anything as all tabs got closed.
m_activeTabClosed = false;
}
示例14: Q_ASSERT
/*!
\brief TabWidget::closeTab
\param index
*/
void TabWidget::closeTab(int index)
{
Q_ASSERT(index < count());
if(index < 0) {
index = currentIndex();
}
QWidget *widget = this->widget(index);
if(widget && widget->close()) {
removeTab(index);
widget->deleteLater();
}
emit tabClosed(index);
}
示例15: removeTab
GUI::Widget::TabManager::TabContainerPtrType GUI::Widget::TabManager::addTab(const TabKeyType& key, TabContainerPtrType container) {
removeTab(key);
if (!container) {
//Create container if one was not given.
container.reset(new GUI::Widget::Container());
}
tabs[key] = container;
if (tabs.size() == 1) {
selectedTabKey = tabs.begin()->first;
}
return container;
}