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


C++ QWebHistory::goToItem方法代码示例

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


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

示例1: goToHistoryItem

void QtWebKitHelpViewer::goToHistoryItem(bool forward)
{
    QAction *action = qobject_cast<QAction *>(sender());
    QTC_ASSERT(action, return);
    QWebHistory *history = m_webView->history();
    QTC_ASSERT(history, return);
    bool ok = false;
    int index = action->data().toInt(&ok);
    QTC_ASSERT(ok, return);
    if (forward)
        history->goToItem(history->forwardItems(history->count()).at(index));
    else
        history->goToItem(history->backItems(history->count()).at(index));
}
开发者ID:acacid,项目名称:qt-creator,代码行数:14,代码来源:qtwebkithelpviewer.cpp

示例2: goBack

void BackButton::goBack()
{
    QAction * action = qobject_cast<QAction *>(sender());
    int index = action->data().toInt();
    QWebHistory * history = m_webView->history();
    history->goToItem(history->backItems(-index).first());
}
开发者ID:OS2World,项目名称:APP-INTERNET-Surfer,代码行数:7,代码来源:backbutton.cpp

示例3: openPrevious

void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
    QWebHistory *history = currentTab()->view()->history();
    QWebHistoryItem *item = 0;

    if (currentTab()->page()->isOnRekonqPage())
    {
        item = new QWebHistoryItem(history->currentItem());
    }
    else
    {
        if (history->canGoBack())
        {
            item = new QWebHistoryItem(history->backItem());
        }
    }

    if(!item)
        return;

    if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
    {
        Application::instance()->loadUrl(item->url(), Rekonq::NewTab);
    }
    else
    {
        history->goToItem(*item);
    }

    updateActions();
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:31,代码来源:mainwindow.cpp

示例4: goAtHistoryIndex

void NavigationBar::goAtHistoryIndex()
{
    QWebHistory* history = p_QupZilla->weView()->page()->history();

    if (QAction* action = qobject_cast<QAction*>(sender())) {
        history->goToItem(history->itemAt(action->data().toInt()));
    }

    refreshHistory();
}
开发者ID:naveen246,项目名称:qupzilla,代码行数:10,代码来源:navigationbar.cpp

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

示例6: loadUrlBackend

void BrowserWidget::loadUrlBackend(QUrl url, bool tryFromHistory) {
    if (url == homePageUrl) {
        emit loadingHomePage();
    } else if (tryFromHistory) {
        QWebHistory *history = webView->page()->history();
        for (int i = 0; i < history->count(); i++) {
            if (history->itemAt(i).url() == url) {
                history->goToItem(history->itemAt(i));
                urlChanging(history->itemAt(i).url()); // workaround
                return;
            }
        }
    }
    webView->load(url);
}
开发者ID:gabrys,项目名称:ffbrowser,代码行数:15,代码来源:browserwidget.cpp

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

示例8: restoreState

void WebKitBrowserExtension::restoreState(QDataStream &stream)
{
    KUrl u;
    QByteArray historyData;
    qint32 xOfs = -1, yOfs = -1, historyItemIndex = -1;
    stream >> u >> xOfs >> yOfs >> historyItemIndex >> historyData;

    QWebHistory* history = (view() ? view()->page()->history() : 0);
    if (history) {
        bool success = false;
        if (history->count() == 0) {   // Handle restoration: crash recovery, tab close undo, session restore
            if (!historyData.isEmpty()) {
                historyData = qUncompress(historyData); // uncompress the history data...
                QBuffer buffer (&historyData);
                if (buffer.open(QIODevice::ReadOnly)) {
                    QDataStream stream (&buffer);
                    view()->page()->setProperty("HistoryNavigationLocked", true);
                    stream >> *history;
                    QWebHistoryItem currentItem (history->currentItem());
                    if (currentItem.isValid()) {
                        if (currentItem.userData().isNull() && (xOfs != -1 || yOfs != -1)) {
                            const QPoint scrollPos (xOfs, yOfs);
                            currentItem.setUserData(scrollPos);
                        }
                        // NOTE 1: The following Konqueror specific workaround is necessary
                        // because Konqueror only preserves information for the last visited
                        // page. However, we save the entire history content in saveState and
                        // and hence need to elimiate all but the current item here.
                        // NOTE 2: This condition only applies when Konqueror is restored from
                        // abnormal termination ; a crash and/or a session restoration.
                        if (QCoreApplication::applicationName() == QLatin1String("konqueror")) {
                            history->clear();
                        }
                        //kDebug() << "Restoring URL:" << currentItem.url();
                        m_part->setProperty("NoEmitOpenUrlNotification", true);
                        history->goToItem(currentItem);
                    }
                }
            }
            success = (history->count() > 0);
        } else {        // Handle navigation: back and forward button navigation.
开发者ID:netrunner-debian-kde-extras,项目名称:webkitkde,代码行数:41,代码来源:kwebkitpart_ext.cpp

示例9: sipNoMethod

static PyObject *meth_QWebHistory_goToItem(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QWebHistoryItem* a0;
        QWebHistory *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QWebHistory, &sipCpp, sipType_QWebHistoryItem, &a0))
        {
            sipCpp->goToItem(*a0);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QWebHistory, sipName_goToItem, doc_QWebHistory_goToItem);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:22,代码来源:sipQtWebKitQWebHistory.cpp


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