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


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

本文整理汇总了C++中TabWidget::currentIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ TabWidget::currentIndex方法的具体用法?C++ TabWidget::currentIndex怎么用?C++ TabWidget::currentIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TabWidget的用法示例。


在下文中一共展示了TabWidget::currentIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: saveYourSession

bool SessionManager::saveYourSession(int index)
{
    kDebug() << "SAVING YOUR OWN SESSION...";
    
    const QString & sessionPath = KStandardDirs::locateLocal("appdata" , QL1S("usersessions/"));
    const QString & sessionName = QL1S("ses") + QString::number(index);
    
    QFile sessionFile(sessionPath + sessionName);
    if (!sessionFile.open(QFile::WriteOnly | QFile::Truncate))
    {
        kDebug() << "Unable to open session file" << sessionFile.fileName();
        return false;
    }
    
    RekonqWindowList wl = rApp->rekonqWindowList();
    QDomDocument document("session");
    QDomElement session = document.createElement("session");
    document.appendChild(session);

    Q_FOREACH(const QWeakPointer<RekonqWindow> &w, wl)
    {
        if (w.data()->isPrivateBrowsingMode())
            continue;
        
        QDomElement window = document.createElement("window");
        int tabInserted = 0;

        window.setAttribute("name", w.data()->objectName());
        
        TabWidget *tw = w.data()->tabWidget();
        for (signed int tabNo = 0; tabNo < tw->count(); tabNo++)
        {
            KUrl u = tw->webWindow(tabNo)->url();

            tabInserted++;
            QDomElement tab = document.createElement("tab");
            tab.setAttribute("title", tw->webWindow(tabNo)->title()); // redundant, but needed for closedSites()
            // as there's not way to read out the historyData
            tab.setAttribute("url", u.url());
            if (tw->currentIndex() == tabNo)
            {
                tab.setAttribute("currentTab", 1);
            }
            if (tw->tabBar()->tabData(tabNo).toBool()) // pinned tab info
            {
                tab.setAttribute("pinned", 1);
            }
            QByteArray history;
            QDataStream historyStream(&history, QIODevice::ReadWrite);
            historyStream << *(tw->webWindow(tabNo)->page()->history());
            QDomCDATASection historySection = document.createCDATASection(history.toBase64());

            tab.appendChild(historySection);
            window.appendChild(tab);
        }
        
        if (tabInserted > 0)
            session.appendChild(window);
    }

    QTextStream TextStream(&sessionFile);
    document.save(TextStream, 2);
    sessionFile.close();

    return true;
}
开发者ID:ksarend,项目名称:rekonq,代码行数:66,代码来源:sessionmanager.cpp


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