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


C++ QWebPage::setLinkDelegationPolicy方法代码示例

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


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

示例1: QWebView

FeaturedArtistsWebView::FeaturedArtistsWebView(QWidget* parent,
                                               QString libraryPath,
                                               QString remoteURL,
                                               SongDownloader* downloader)
                       : QWebView(parent),
                         LibraryView() {
    m_sLibraryPath = libraryPath;
    m_sRemoteURL = remoteURL;
    m_sLocalErrorURL = "about:qt";
    m_bOfflineMode = false;
    m_pSongDownloader = downloader;

    QWidget::setContextMenuPolicy(Qt::PreventContextMenu);

    //Allow us to catch if opening the HTML file on promo.mixxx.org
    //fails, and display a local copy instead.
    connect(this, SIGNAL(loadFinished(bool)),
            this, SLOT(handleLoadFinished(bool)));

    //Load the promo tracks webpage
    QWebView::load(QUrl(m_sRemoteURL));

    //Let us manually handle links that are clicked via the linkClicked()
    //signal...
    QWebPage* page = QWebView::page();
    page->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    connect(this, SIGNAL(linkClicked(const QUrl&)),
            this, SLOT(handleClickedLink(const QUrl&)));

    QTimer* loadingTimer = new QTimer(this);
    connect(loadingTimer, SIGNAL(timeout()),
            this, SLOT(checkWebpageLoadingProgress()));
    loadingTimer->start(LOAD_TIMEOUT);
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:35,代码来源:featuredartistswebview.cpp

示例2: QMainWindow

HelpForm::HelpForm(QWidget *parent) :
    QMainWindow(parent,Qt::FramelessWindowHint),webview(new QMyWebView)
{
    setupUi(this);
    setCentralWidget(webview);
    QWebPage *page = webview->page();
    page->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    page->setContentEditable(FALSE);
    webview->setContextMenuPolicy(Qt::NoContextMenu);
    connect(page,SIGNAL(linkClicked(QUrl)),SLOT(loadUrl(QUrl)));
    connect(action_back,SIGNAL(triggered()),webview,SLOT(back()));
    connect(action_forward,SIGNAL(triggered()),webview,SLOT(forward()));
    connect(action_refresh,SIGNAL(triggered()),webview,SLOT(reload()));
}
开发者ID:httpftpli,项目名称:mdimh,代码行数:14,代码来源:helpform.cpp

示例3: init

void MainWindow::init(bool is_development) {
    //qApp->installEventFilter(this);
  
    setWindowTitle(settings->value("window_title").toString());

    if (settings->value("minified_state").toString() == "true") {
        setWindowState(Qt::WindowMinimized);
    }

    this->setMinimumWidth(430);
    this->setMinimumHeight(430);

    webView = new QWebView(this);
    if (settings->value("context_menu").toString() == "false") {
        webView->setContextMenuPolicy(Qt::NoContextMenu);
    }
    this->setCentralWidget(webView);

    m_network_manager = new QNetworkAccessManager(this);

    QWebPage *webPage = webView->page();
    webPage->setNetworkAccessManager(m_network_manager);
    webPage->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(webPage, &QWebPage::linkClicked, this, &MainWindow::onLinkClicked);
    connect(webPage->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared, this, &MainWindow::attachJsApi);

    webView->show();

    bootstrap(is_development);

    // restore saved window geometry from .ini file
    QVariant size = settings->value("main_window_geometry");
    if ( size.isNull() ) {
        this->setGeometry(QRect(500, 100, 700, 500));
    } else {
        this->setGeometry(size.toRect());
    }

    // restore saved zoom factor from .ini file
    qreal z = settings->value("zoom_factor").toReal();
    if ( z ) webView->page()->mainFrame()->setZoomFactor(z);

    m_jsApi = new JsApi(this);

    optionsDialog = new OptionsDialog(this);
    optionsDialog->m_version = m_version;
    connect(optionsDialog, SIGNAL(accepting()), m_jsApi, SLOT(onOptionsDialogAccepted()));

    QShortcut *zoomin = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus), this);
    connect(zoomin, &QShortcut::activated, this, &MainWindow::onZoomIn);

    QShortcut *zoomout = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus), this);
    connect(zoomout, &QShortcut::activated, this, &MainWindow::onZoomOut);

    QShortcut *shutdown = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
    connect(shutdown, &QShortcut::activated, m_jsApi, &JsApi::shutdown);

    QWebSettings::setObjectCacheCapacities(0, 0, 0);

    if (settings->value("webinspector").toString() == "true") {
        QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

        QWebInspector *inspector;
        inspector = new QWebInspector();
        inspector->setPage(webView->page());
        inspector->setGeometry(QRect(500, 10, 1000, 700));
        inspector->show();
    }

    QIcon icon = QIcon(application_path + "/" + APPNAME + ".png");
    m_trayIcon = new QSystemTrayIcon(this);
    m_trayIcon->setIcon(icon);
    m_trayIcon->show();
    connect(m_trayIcon, &QSystemTrayIcon::messageClicked, m_jsApi, &JsApi::onTrayMessageClicked);
    connect(m_trayIcon, &QSystemTrayIcon::activated, m_jsApi, &JsApi::onTrayIconActivated);
}
开发者ID:michaelfranzl,项目名称:popcorn,代码行数:76,代码来源:mainwindow.cpp

示例4: INoteView

CWizDocumentView::CWizDocumentView(CWizExplorerApp& app, QWidget* parent)
    : INoteView(parent)
    , m_app(app)
    , m_dbMgr(app.databaseManager())
    , m_userSettings(app.userSettings())
    #ifdef USEWEBENGINE
    , m_web(new CWizDocumentWebEngine(app, this))
    , m_comments(new QWebEngineView(this))
    #else
    , m_web(new CWizDocumentWebView(app, this))
    , m_commentWidget(new CWizLocalProgressWebView(app.mainWindow()))
    #endif
    , m_title(new TitleBar(app, this))
    , m_passwordView(new CWizUserCipherForm(app, this))
    , m_viewMode(app.userSettings().noteViewMode())
    , m_transitionView(new CWizDocumentTransitionView(this))
    , m_bLocked(false)
    , m_bEditingMode(false)
    , m_noteLoaded(false)
    , m_editStatusSyncThread(new CWizDocumentEditStatusSyncThread(this))
    //, m_editStatusCheckThread(new CWizDocumentStatusCheckThread(this))
    , m_editStatus(0)
    , m_sizeHint(QSize(200, 1))
{
    m_title->setEditor(m_web);

    QVBoxLayout* layoutDoc = new QVBoxLayout();
    layoutDoc->setContentsMargins(0, 0, 0, 0);
    layoutDoc->setSpacing(0);

    m_docView = new QWidget(this);
    m_docView->setLayout(layoutDoc);

    m_tab = new QStackedWidget(this);
    //
    m_passwordView->setGeometry(this->geometry());
    connect(m_passwordView, SIGNAL(cipherCheckRequest()), SLOT(onCipherCheckRequest()));
    //
    m_msgWidget = new QWidget(this);
    QVBoxLayout* layoutMsg = new QVBoxLayout();
    m_msgWidget->setLayout(layoutMsg);
    m_msgLabel = new QLabel(m_msgWidget);
    m_msgLabel->setAlignment(Qt::AlignCenter);
    m_msgLabel->setWordWrap(true);
    layoutMsg->addWidget(m_msgLabel);
    //
    m_tab->addWidget(m_docView);
    m_tab->addWidget(m_passwordView);
    m_tab->addWidget(m_msgWidget);
    m_tab->setCurrentWidget(m_docView);    

    m_web->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_comments = m_commentWidget->web();
    QWebPage *commentPage = new QWebPage(m_comments);
    commentPage->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    m_comments->setPage(commentPage);
    m_comments->history()->setMaximumItemCount(0);
    m_comments->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    m_comments->settings()->globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
    m_comments->settings()->globalSettings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
    m_comments->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
    m_comments->setAcceptDrops(false);
    connect(m_comments, SIGNAL(loadFinished(bool)), m_title, SLOT(onCommentPageLoaded(bool)));
    connect(m_comments, SIGNAL(linkClicked(QUrl)), m_web, SLOT(onEditorLinkClicked(QUrl)));
    connect(m_comments->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            SLOT(on_comment_populateJavaScriptWindowObject()));
    connect(m_commentWidget, SIGNAL(widgetStatusChanged()), SLOT(on_commentWidget_statusChanged()));

    m_commentWidget->hide();

    QWidget* wgtEditor = new QWidget(m_docView);
    QVBoxLayout* layoutEditor = new QVBoxLayout(wgtEditor);
    layoutEditor->setSpacing(0);
    layoutEditor->setContentsMargins(0, 5, 0, 0);
    layoutEditor->addWidget(m_title);
    layoutEditor->addWidget(m_web);
    layoutEditor->setStretchFactor(m_title, 0);
    layoutEditor->setStretchFactor(m_web, 1);

    m_splitter = new CWizSplitter(this);
    m_splitter->addWidget(wgtEditor);
    m_splitter->addWidget(m_commentWidget);
    m_splitter->setOrientation(Qt::Horizontal);

    layoutDoc->addWidget(m_splitter);
//    layoutDoc->setStretchFactor(m_title, 0);
//    layoutDoc->setStretchFactor(m_splitter, 1);

#ifdef USEWEBENGINE
    QLineEdit *commandLine = new QLineEdit(this);
    layoutDoc->addWidget(commandLine);
    connect(commandLine, SIGNAL(returnPressed()), SLOT(on_command_request()));
#endif

    QVBoxLayout* layoutMain = new QVBoxLayout(this);
    layoutMain->setContentsMargins(0, 0, 0, 0);
    setLayout(layoutMain);
    layoutMain->addWidget(m_tab);

    //
//.........这里部分代码省略.........
开发者ID:AlvaroSacari,项目名称:WizQTClient,代码行数:101,代码来源:wizDocumentView.cpp

示例5: setLinkDelegationPolicy

void QWebPageProto::setLinkDelegationPolicy(QWebPage::LinkDelegationPolicy policy)
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    item->setLinkDelegationPolicy(policy);
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:6,代码来源:qwebpageproto.cpp


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