当前位置: 首页>>代码示例>>C++>>正文


C++ TabWidget::setCurrentIndex方法代码示例

本文整理汇总了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);
    }
}
开发者ID:bubapl,项目名称:QupZilla,代码行数:21,代码来源:webtab.cpp

示例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);
    }

}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:13,代码来源:navigationbar.cpp

示例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();
    }
}
开发者ID:Martii,项目名称:qupzilla,代码行数:17,代码来源:locationcompleter.cpp

示例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.");
    }
}
开发者ID:OpenRcon,项目名称:OpenRcon,代码行数:19,代码来源:SessionManager.cpp

示例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);
    }
}
开发者ID:naveen246,项目名称:qupzilla,代码行数:20,代码来源:navigationbar.cpp

示例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();
    }
}
开发者ID:593in,项目名称:qupzilla,代码行数:22,代码来源:locationcompleter.cpp


注:本文中的TabWidget::setCurrentIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。