本文整理汇总了C++中closeTab函数的典型用法代码示例。如果您正苦于以下问题:C++ closeTab函数的具体用法?C++ closeTab怎么用?C++ closeTab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了closeTab函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:agnelterry,项目名称:arora,代码行数:31,代码来源:tabbar.cpp
示例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);
}
}
开发者ID:uzi18,项目名称:fooaudio-phonon,代码行数:16,代码来源:footabwidget.cpp
示例3: tabBar
void WorkAreaTabWidget::ui_closeOtherTabsRequested(int index)
{
tabBar()->moveTab(index, 0);
while (count() > 1) {
closeTab(1); // close second tab
}
}
开发者ID:davidau,项目名称:robomongo,代码行数:7,代码来源:WorkAreaTabWidget.cpp
示例4: closeTab
void TabBar::closeTab()
{
if (QAction *action = qobject_cast<QAction*>(sender())) {
int index = action->data().toInt();
emit closeTab(index);
}
}
开发者ID:agnelterry,项目名称:arora,代码行数:7,代码来源:tabbar.cpp
示例5: closeTab
void TabBar::slotCloseTab()
{
int index = indexClickedTab_;
if (index == -1) index = currentIndex();
emit closeTab(index);
}
开发者ID:Manasmitha,项目名称:quiterss,代码行数:7,代码来源:tabbar.cpp
示例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);
}
开发者ID:Linutux,项目名称:robomongo,代码行数:39,代码来源:WorkAreaTabWidget.cpp
示例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
}
开发者ID:ddksaku,项目名称:manitou,代码行数:28,代码来源:Manitou.cpp
示例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 );
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:35,代码来源:WebBrowser.cpp
示例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);
}
开发者ID:Angryn00b,项目名称:pokemon-online,代码行数:25,代码来源:menu.cpp
示例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);
}
开发者ID:antimatter15,项目名称:kiss,代码行数:27,代码来源:MainWindow.cpp
示例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()));
}
开发者ID:WOF-Softwares,项目名称:ScribusCTL,代码行数:35,代码来源:shapepalette.cpp
示例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*)));
}
开发者ID:coolshou,项目名称:arduide-1,代码行数:59,代码来源:MainWindow.cpp
示例13: closeTab
void EditorTab::closeThis(void)
{
if (currentIndex() < 0) {
return;
}
closeTab(currentIndex());
}
开发者ID:Ermakov-D,项目名称:mariamole,代码行数:8,代码来源:editortab.cpp
示例14: WXUNUSED
void FractalImagesFrame::OnCloseFractal(wxCommandEvent& WXUNUSED(event))
{
int pos = m_tabs->GetSelection();
closeTab(pos);
updateMenu();
}
开发者ID:svenhertle,项目名称:fractalimages,代码行数:8,代码来源:FractalImagesFrame.cpp
示例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);
}
开发者ID:zsy056,项目名称:imgresize,代码行数:8,代码来源:main_window.cpp
示例16: tabAt
void TabBar::contextMenuEvent(QContextMenuEvent* event)
{
int index = tabAt(event->pos());
m_clickedTab = index;
QMenu menu;
menu.addAction(IconProvider::newTabIcon(), tr("&New tab"), m_window, SLOT(addTab()));
menu.addSeparator();
if (index != -1) {
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
if (!webTab) {
return;
}
if (m_window->weView(m_clickedTab)->isLoading()) {
menu.addAction(QIcon::fromTheme(QSL("process-stop")), tr("&Stop Tab"), this, SLOT(stopTab()));
}
else {
menu.addAction(QIcon::fromTheme(QSL("view-refresh")), tr("&Reload Tab"), this, SLOT(reloadTab()));
}
menu.addAction(QIcon::fromTheme("tab-duplicate"), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
if (count() > 1 && !webTab->isPinned()) {
menu.addAction(QIcon::fromTheme("tab-detach"), tr("D&etach Tab"), this, SLOT(detachTab()));
}
menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
menu.addAction(webTab->isMuted() ? tr("Un&mute Tab") : tr("&Mute Tab"), this, SLOT(muteTab()));
#endif
menu.addSeparator();
menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
menu.addSeparator();
menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
menu.addSeparator();
menu.addAction(tr("Close Ot&her Tabs"), this, SLOT(closeAllButCurrent()));
menu.addAction(QIcon::fromTheme("window-close"), tr("Cl&ose"), this, SLOT(closeTab()));
menu.addSeparator();
}
else {
menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
menu.addSeparator();
menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
}
m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(m_tabWidget->canRestoreTab());
// Prevent choosing first option with double rightclick
const QPoint pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(true);
}
开发者ID:gnikandrov,项目名称:qupzilla,代码行数:58,代码来源:tabbar.cpp
示例17: QMenu
void PlaylistWindow::on_tabWidget_customContextMenuRequested(const QPoint &pos)
{
QMenu *m = new QMenu(this);
m->addAction(tr("&New Playlist"), this, SLOT(newTab()));
m->addAction(tr("&Remove Playlist"), this, SLOT(closeTab()));
m->addAction(tr("&Duplicate Playlist"), this, SLOT(duplicateTab()));
m->addAction(tr("&Import Playlist"), this, SLOT(importTab()));
m->addAction(tr("&Export Playlist"), this, SLOT(exportTab()));
m->exec(ui->tabWidget->mapToGlobal(pos));
}
开发者ID:Frechdachs,项目名称:mpc-qt,代码行数:10,代码来源:playlistwindow.cpp
示例18: MainMenu
void BrowserWindow::setupMenu()
{
#ifdef Q_OS_MAC
static MainMenu* macMainMenu = 0;
if (!macMainMenu) {
macMainMenu = new MainMenu(this, 0);
macMainMenu->initMenuBar(new QMenuBar(0));
}
else {
macMainMenu->setWindow(this);
}
m_mainMenu = macMainMenu;
m_mainMenu->initSuperMenu(m_superMenu);
#else
setMenuBar(new MenuBar(this));
m_mainMenu = new MainMenu(this, this);
m_mainMenu->initMenuBar(menuBar());
m_mainMenu->initSuperMenu(m_superMenu);
#endif
// Setup other shortcuts
QShortcut* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this);
QShortcut* reloadBypassCacheAction2 = new QShortcut(QKeySequence(QSL("Ctrl+Shift+R")), this);
connect(reloadBypassCacheAction, SIGNAL(activated()), this, SLOT(reloadBypassCache()));
connect(reloadBypassCacheAction2, SIGNAL(activated()), this, SLOT(reloadBypassCache()));
QShortcut* closeTabAction = new QShortcut(QKeySequence(QSL("Ctrl+W")), this);
QShortcut* closeTabAction2 = new QShortcut(QKeySequence(QSL("Ctrl+F4")), this);
connect(closeTabAction, SIGNAL(activated()), this, SLOT(closeTab()));
connect(closeTabAction2, SIGNAL(activated()), this, SLOT(closeTab()));
QShortcut* reloadAction = new QShortcut(QKeySequence("Ctrl+R"), this);
connect(reloadAction, SIGNAL(activated()), this, SLOT(reload()));
QShortcut* openLocationAction = new QShortcut(QKeySequence("Alt+D"), this);
connect(openLocationAction, SIGNAL(activated()), this, SLOT(openLocation()));
QShortcut* inspectorAction = new QShortcut(QKeySequence(QSL("F12")), this);
connect(inspectorAction, SIGNAL(activated()), this, SLOT(toggleWebInspector()));
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:43,代码来源:browserwindow.cpp
示例19: tabBar
void MainTab::mousePressEvent(QMouseEvent* event)
{
if(event->buttons() == Qt::MidButton)
{
QTabBar* bar = tabBar();
m_index = bar->tabAt(bar->mapFrom(this, event->pos()));
closeTab();
}
QTabWidget::mousePressEvent(event);
}
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:10,代码来源:MainTab.cpp
示例20: currentTabIndex
void MainWindow::closeTabTriggered()
{
int index = currentTabIndex();
if (index == -1) {
close();
} else {
closeTab(index);
}
}
开发者ID:joonhwan,项目名称:monkeylogviewer,代码行数:10,代码来源:MainWindow.cpp
注:本文中的closeTab函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论