本文整理汇总了C++中closeTab函数的典型用法代码示例。如果您正苦于以下问题:C++ closeTab函数的具体用法?C++ closeTab怎么用?C++ closeTab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了closeTab函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SIGNAL
void TabBar::contextMenuRequested(const QPoint &position)
{
QMenu menu;
menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab);
int index = tabAt(position);
if (-1 != index) {
QAction *action = menu.addAction(tr("Duplicate Tab"),
this, SLOT(cloneTab()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("&Close Tab"),
this, SLOT(closeTab()), QKeySequence::Close);
action->setData(index);
action = menu.addAction(tr("Close &Other Tabs"),
this, SLOT(closeOtherTabs()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("Reload Tab"),
this, SLOT(reloadTab()), QKeySequence::Refresh);
action->setData(index);
} else {
menu.addSeparator();
}
menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs()));
menu.exec(QCursor::pos());
}
示例2: closeTab
void FooTabWidget::closeOtherTabs(int index)
{
if (-1 == index)
{
return;
}
for (int i = count() - 1; i > index; --i)
{
closeTab(i);
}
for (int i = index - 1; i >= 0; --i)
{
closeTab(i);
}
}
示例3: tabBar
void WorkAreaTabWidget::ui_closeOtherTabsRequested(int index)
{
tabBar()->moveTab(index, 0);
while (count() > 1) {
closeTab(1); // close second tab
}
}
示例4: closeTab
void TabBar::closeTab()
{
if (QAction *action = qobject_cast<QAction*>(sender())) {
int index = action->data().toInt();
emit closeTab(index);
}
}
示例5: closeTab
void TabBar::slotCloseTab()
{
int index = indexClickedTab_;
if (index == -1) index = currentIndex();
emit closeTab(index);
}
示例6: currentIndex
/**
* @brief Overrides QTabWidget::keyPressEvent() in order to intercept
* tab close key shortcuts (Ctrl+F4 and Ctrl+W)
*/
void WorkAreaTabWidget::keyPressEvent(QKeyEvent *keyEvent)
{
if ((keyEvent->modifiers() & Qt::ControlModifier) &&
(keyEvent->key()==Qt::Key_F4 || keyEvent->key()==Qt::Key_W))
{
int index = currentIndex();
closeTab(index);
return;
}
if (KeyboardManager::isPreviousTabShortcut(keyEvent)) {
previousTab();
return;
} else if (KeyboardManager::isNextTabShortcut(keyEvent)) {
nextTab();
return;
} else if (KeyboardManager::isNewTabShortcut(keyEvent)) {
currentQueryWidget()->openNewTab();
return;
} else if (KeyboardManager::isSetFocusOnQueryLineShortcut(keyEvent)) {
currentQueryWidget()->setScriptFocus();
return;
} else if (KeyboardManager::isExecuteScriptShortcut(keyEvent)) {
currentQueryWidget()->execute();
return;
} else if (KeyboardManager::isAutoCompleteShortcut(keyEvent)) {
currentQueryWidget()->showAutocompletion();
return;
} else if (KeyboardManager::isHideAutoCompleteShortcut(keyEvent)) {
currentQueryWidget()->hideAutocompletion();
return;
}
QTabWidget::keyPressEvent(keyEvent);
}
示例7: QAction
void Manitou::createActions()
{
QAction *action = new QAction(tr("New Window"), this);
action->setShortcut(QKeySequence::New);
actionsMap.insert(Manitou::ActionNewWindow, action);
connect(action, SIGNAL(triggered()), SLOT(onOpenWindow()));
action = new QAction(tr("New Tab"), this);
action->setShortcut(QKeySequence::AddTab/*(Qt::CTRL + Qt::Key_T)*/);
actionsMap.insert(Manitou::ActionNewTab, action);
connect(action, SIGNAL(triggered()), SLOT(onOpenTab()));
action = new QAction(tr("Close Window"), this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
actionsMap.insert(Manitou::ActionCloseWindow, action);
connect(action, SIGNAL(triggered()), SLOT(closeWindow()));
action = new QAction(tr("Close Tab"), this);
actionsMap.insert(Manitou::ActionCloseTab, action);
connect(action, SIGNAL(triggered()), SLOT(closeTab()));
#ifdef Q_WS_MAC
// initialize dock menu (specific for Mac OS X)
dockMenu = new QMenu();
dockMenu->addAction(getAction(Manitou::ActionNewWindow));
qt_mac_set_dock_menu(dockMenu);
#endif
}
示例8: QPushButton
void WebBrowser::initGui()
{
// setup the tool bar
_back = new QPushButton( "|<< Back" );
_stop = new QPushButton( "stop" );
_reload = new QPushButton( "reload" );
_forward = new QPushButton( "Forward >>|" );
_newTab = new QPushButton( "nTab" );
_closeTab = new QPushButton( "cTab" );
_address = new QLineEdit();
_go = new QPushButton( "Go" );
QToolBar* toolBar = new QToolBar();
toolBar->addWidget( _back );
toolBar->addWidget( _stop );
toolBar->addWidget( _reload );
toolBar->addWidget( _forward );
toolBar->addSeparator();
toolBar->addWidget( _newTab );
toolBar->addWidget( _closeTab );
toolBar->addWidget( _address );
toolBar->addWidget( _go );
connect( _newTab, SIGNAL(released()), this, SLOT(newTab()) );
connect( _closeTab, SIGNAL(released()), this, SLOT(closeTab()) );
connect( _go, SIGNAL(released()), this, SLOT(goToAddress()) );
this->addToolBar( toolBar );
// setup the tab area
_tabWidget = new QTabWidget();
connect( _tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int)) );
setCentralWidget( _tabWidget );
}
示例9: QMenuBar
QMenuBar * Menu::createMenuBar(MainEngine *w)
{
QMenuBar *menuBar = new QMenuBar();
QMenu *fileMenu = menuBar->addMenu(tr("&File"));
fileMenu->addAction(tr("Load team"), this, SLOT(loadTeam()), tr("Ctrl+L", "Load team"));
fileMenu->addAction(tr("Close tab"), w, SLOT(closeTab()), tr("Ctrl+W", "Close tab"));
fileMenu->addAction(tr("Open &replay"),w,SLOT(loadReplayDialog()), Qt::CTRL+Qt::Key_R);
fileMenu->addAction(tr("&Quit"),qApp,SLOT(quit()),Qt::CTRL+Qt::Key_Q);
w->addThemeMenu(menuBar);
w->addStyleMenu(menuBar);
QMenu *langMenu = menuBar->addMenu(tr("&Language"));
QFile in ("languages.txt");
in.open(QIODevice::ReadOnly);
QSettings s;
QStringList langs = QString::fromUtf8(in.readAll()).trimmed().split('\n');
QActionGroup *ag = new QActionGroup(langMenu);
foreach(QString a, langs) {
QAction *act = langMenu->addAction(a,w, SLOT(changeLanguage()));
act->setCheckable(true);
act->setChecked(s.value("language").toString() == a.section("(", 1).section(")", 0, 0));
ag->addAction(act);
}
示例10: while
/* Handles closing all of the open editor windows when the window is closed */
void MainWindow::closeEvent(QCloseEvent *e)
{
int widgetCount = ui_tabWidget->count();
while(ui_tabWidget->count() > 0) {
ui_tabWidget->setCurrentIndex(0);
closeTab();
if(ui_tabWidget->count() == widgetCount) {
qWarning() << "Ignoring close event.";
e->ignore();
return;
}
--widgetCount;
}
//Close all other windows
hide();
QListIterator<QWidget *> i(qApp->topLevelWidgets());
while(i.hasNext()) {
QWidget *w = i.next();
if(w->isVisible())
w->close();
}
QMainWindow::closeEvent(e);
}
示例11: ScDockPalette
ShapePalette::ShapePalette( QWidget* parent) : ScDockPalette( parent, "Shap", 0)
{
setMinimumSize( QSize( 220, 240 ) );
setObjectName(QString::fromLocal8Bit("Shap"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
containerWidget = new QWidget(this);
vLayout = new QVBoxLayout( containerWidget );
vLayout->setSpacing( 0 );
vLayout->setMargin( 0 );
buttonLayout = new QHBoxLayout;
buttonLayout->setSpacing( 5 );
buttonLayout->setMargin( 0 );
importButton = new QToolButton(this);
importButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
importButton->setIcon(IconManager::instance()->loadIcon("16/document-open.png"));
importButton->setIconSize(QSize(16, 16));
buttonLayout->addWidget( importButton );
QSpacerItem* spacer = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
buttonLayout->addItem( spacer );
closeButton = new QToolButton(this);
closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
closeButton->setIcon(IconManager::instance()->loadIcon("16/close.png"));
closeButton->setIconSize(QSize(16, 16));
buttonLayout->addWidget( closeButton );
vLayout->addLayout( buttonLayout );
Frame3 = new QToolBox( this );
vLayout->addWidget(Frame3);
setWidget(containerWidget);
unsetDoc();
m_scMW = NULL;
languageChange();
connect(importButton, SIGNAL(clicked()), this, SLOT(Import()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeTab()));
}
示例12: QActionGroup
void MainWindow::setupActions()
{
buildActions = new QActionGroup(this);
buildActions->addAction(ui.action_Build);
buildActions->addAction(ui.action_Upload);
connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabHasChanged()));
connect(ui.action_New, SIGNAL(triggered()), this, SLOT(newProject()));
connect(ui.action_Open, SIGNAL(triggered()), this, SLOT(open()));
connect(ui.action_Save, SIGNAL(triggered()), this, SLOT(save()));
connect(ui.action_Saveas, SIGNAL(triggered()), this, SLOT(save_as()));
connect(ui.action_Close, SIGNAL(triggered()), this, SLOT(closeTab()));
connect(ui.actionUpPastebin, SIGNAL(triggered()), this, SLOT(uploadToPastebin()));
connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(undo()));
connect(ui.actionRedo, SIGNAL(triggered()), this, SLOT(redo()));
connect(ui.action_Copy, SIGNAL(triggered()), this, SLOT(copy()));
connect(ui.action_Cut, SIGNAL(triggered()), this, SLOT(cut()));
connect(ui.action_Find, SIGNAL(triggered(bool)), this, SLOT(showFindBox(bool)));
connect(ui.action_Paste, SIGNAL(triggered()), this, SLOT(paste()));
connect(ui.action_Build, SIGNAL(triggered()), this, SLOT(build()));
connect(ui.action_Upload, SIGNAL(triggered()), this, SLOT(upload()));
connect(ui.action_Utilities, SIGNAL(triggered()), this, SLOT(toggleDock()));
connect(ui.actionGo_to_the_next_tab, SIGNAL(triggered()), this, SLOT(nextTab()));
connect(ui.actionGo_to_the_previous_tab, SIGNAL(triggered()), this, SLOT(previousTab()));
connect(ui.action_Configure_the_IDE, SIGNAL(triggered()), this, SLOT(configure()));
connect(ui.action_Contextual_help, SIGNAL(triggered()), this, SLOT(contextualHelp()));
connect(ui.actionCommunityArduinoCC, SIGNAL(triggered()), this, SLOT(openCommunityArduinoCC()));
connect(ui.actionCommunityArduinoForums, SIGNAL(triggered()), this, SLOT(openCommunityArduinoForums()));
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about()));
connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(ui.lineFind, SIGNAL(returnPressed()), this, SLOT(find()));
connect(ui.lineReplace, SIGNAL(returnPressed()), this, SLOT(find()));
connect(ui.pushFind, SIGNAL(clicked()), this, SLOT(find()));
connect(ui.pushReplace, SIGNAL(clicked()), this, SLOT(replace()));
connect(ui.pushReplaceAll, SIGNAL(clicked()), this, SLOT(replaceAll()));
connect(this, SIGNAL(tabChanged(bool)), ui.pushReplace, SLOT(setEnabled(bool)));
connect(this, SIGNAL(tabChanged(bool)), ui.pushReplaceAll, SLOT(setEnabled(bool)));
connect(this, SIGNAL(tabChanged(bool)), ui.checkRegExp, SLOT(setEnabled(bool)));
connect(this, SIGNAL(tabChanged(bool)), ui.checkWordOnly, SLOT(setEnabled(bool)));
connect(this, SIGNAL(tabChanged(bool)), ui.menu_Libraries, SLOT(setEnabled(bool)));
connect(ui.action_Lib_Refresh, SIGNAL(triggered()), this, SLOT(refreshLibrariesMenu()));
connect(browser, SIGNAL(newProjectRequested()), this, SLOT(newProject()));
connect(browser, SIGNAL(newProjectRequested(const QString &, const QString &)), this, SLOT(newProject(const QString &, const QString &)));
connect(browser, SIGNAL(openProjectRequested()), this, SLOT(open()));
connect(browser, SIGNAL(openProjectRequested(const QString &)), this, SLOT(open(const QString &)));
connect(browser, SIGNAL(newPageLoaded(QUrl)), this, SLOT(tabContentHasChanged()));
connect(ui.action_Prev, SIGNAL(triggered()), browser, SLOT(back()));
connect(ui.action_Next, SIGNAL(triggered()), browser, SLOT(forward()));
connect(ideApp->projectHistory(), SIGNAL(historyUpdated(QString)), browser, SLOT(refresh()));
connect(ideApp->settings(), SIGNAL(fontChanged(const QFont &)), this, SLOT(setFont(const QFont &)));
connect(&pastebin, SIGNAL(finished(QNetworkReply*)), this, SLOT(pastebinUploadDone(QNetworkReply*)));
}
示例13: closeTab
void EditorTab::closeThis(void)
{
if (currentIndex() < 0) {
return;
}
closeTab(currentIndex());
}
示例14: WXUNUSED
void FractalImagesFrame::OnCloseFractal(wxCommandEvent& WXUNUSED(event))
{
int pos = m_tabs->GetSelection();
closeTab(pos);
updateMenu();
}
示例15: tr
void MainWindow::loadErrorHandler(const QString& fullpath)
{
QMessageBox::information(this, tr("Error!"),
tr("Cannot load %1.").arg(fullpath));
TabPage* page = qobject_cast<TabPage*>(sender());
auto idx = ui.tabWidget->indexOf(page);
closeTab(idx);
}