本文整理汇总了C++中TabWidget::setCurrentIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ TabWidget::setCurrentIndex方法的具体用法?C++ TabWidget::setCurrentIndex怎么用?C++ TabWidget::setCurrentIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabWidget
的用法示例。
在下文中一共展示了TabWidget::setCurrentIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pinTab
void WebTab::pinTab(int index)
{
TabWidget* tabWidget = p_QupZilla->tabWidget();
if (!tabWidget) {
return;
}
if (m_pinned) { //Unpin tab
m_pinned = false;
tabWidget->setTabText(index, m_view.data()->title());
tabWidget->getTabBar()->updateCloseButton(index);
}
else { // Pin tab
m_pinned = true;
tabWidget->setCurrentIndex(0); // <<-- those 2 lines fixes
tabWidget->getTabBar()->moveTab(index, 0); // | weird behavior with bad
tabWidget->setTabText(0, ""); // | tabwidget update if we
tabWidget->setCurrentIndex(0); // <<-- are moving current tab
tabWidget->getTabBar()->updateCloseButton(0);
}
}
示例2: loadHistoryItemInNewTab
void NavigationBar::loadHistoryItemInNewTab(const QWebHistoryItem &item)
{
TabWidget* tabWidget = m_window->tabWidget();
int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex());
QWebHistory* history = m_window->weView(tabIndex)->page()->history();
history->goToItem(item);
if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {
tabWidget->setCurrentIndex(tabIndex);
}
}
示例3: switchToTab
void LocationCompleter::switchToTab(BrowserWindow* window, int tab)
{
Q_ASSERT(window);
Q_ASSERT(tab >= 0);
TabWidget* tabWidget = window->tabWidget();
if (window->isActiveWindow() || tabWidget->currentIndex() != tab) {
tabWidget->setCurrentIndex(tab);
window->show();
window->activateWindow();
window->raise();
}
else {
tabWidget->webTab()->setFocus();
}
}
示例4: openSession
void SessionManager::openSession(ServerEntry *serverEntry)
{
// Add ServerEntry to the list.
if (!sessions.contains(serverEntry)) {
sessions.insert(serverEntry);
TabWidget *tabWidget = TabWidget::getInstance();
GameEntry gameEntry = GameManager::getGame(serverEntry->getGameType());
GameWidget *gameWidget = SessionManager::getGameWidget(serverEntry);
int index = tabWidget->addTab(gameWidget, QIcon(gameEntry.getIcon()), serverEntry->getName());
tabWidget->setTabToolTip(index, QString("%1:%2").arg(serverEntry->getHost()).arg(serverEntry->getPort()));
tabWidget->setCurrentIndex(index);
emit (onSessionOpened());
} else {
qDebug() << tr("Already connected to this server.");
}
}
示例5: goAtHistoryIndexInNewTab
void NavigationBar::goAtHistoryIndexInNewTab(int index)
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
index = action->data().toInt();
}
if (index == -1) {
return;
}
TabWidget* tabWidget = p_QupZilla->tabWidget();
int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex());
QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history();
history->goToItem(history->itemAt(index));
if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {
tabWidget->setCurrentIndex(tabIndex);
}
}
示例6: switchToTab
void LocationCompleter::switchToTab(BrowserWindow* window, int tab)
{
Q_ASSERT(window);
Q_ASSERT(tab >= 0);
closePopup();
// Clear locationbar
emit clearCompletion();
TabWidget* tabWidget = window->tabWidget();
if (window->isActiveWindow() || tabWidget->currentIndex() != tab) {
tabWidget->setCurrentIndex(tab);
window->show();
window->activateWindow();
window->raise();
}
else {
window->weView()->setFocus();
}
}