Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:32:37+00:00 2026-06-03T06:32:37+00:00

How to make QML WebView Element use Qt::openUrlExternally instead of some visual newWindowComponent ?

  • 0

How to make QML WebView Element use Qt::openUrlExternally instead of some visual newWindowComponent?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:32:39+00:00Added an answer on June 3, 2026 at 6:32 am

    I don’t think there is a simple way to do this using QML. You can do this with the standard QWebView, but there isn’t a way to access this functionality from within QML. You would need to re-wrap QWebView and expose more functions.

    An example using the standard C++ interfaces:

    test.cpp

    #include <QtGui>
    #include <QtWebKit>
    #include "handler.hpp"
    
    int main(int argc, char** argv)
    {
        QApplication app(argc, argv);
    
        QWebView view;
        view.load(QUrl::fromUserInput("http://qt-project.org/"));
    
        view.page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    
        LinkHandler handler;
    
        QObject::connect(
            &view, SIGNAL(linkClicked(const QUrl&)),
            &handler, SLOT(open(const QUrl&)));
    
        view.show();
    
        return app.exec();
    }
    

    handler.hpp

    #ifndef _HANDLER_HPP_
    #define _HANDLER_HPP_
    
    #include <QtGui>
    
    class LinkHandler : public QObject
    {
        Q_OBJECT
        public:
            LinkHandler();
    
        public slots:
            void open(const QUrl& url);
    };
    
    #endif
    

    handler.cpp

    #include "handler.hpp"
    
    LinkHandler::LinkHandler() : QObject() {}
    
    void LinkHandler::open(const QUrl& url)
    {
        QDesktopServices::openUrl(url);
    }
    

    CMakeLists.txt

    cmake_minimum_required(VERSION 2.8)
    
    find_package(Qt4 4.8 REQUIRED QtCore QtGui QtWebkit)
    include(${QT_USE_FILE})
    
    qt4_wrap_cpp(MOC_FILES handler.hpp)
    add_executable(test
        test.cpp
        handler.hpp
        handler.cpp
        ${MOC_FILES})
    target_link_libraries(test ${QT_LIBRARIES})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make some game, I use I lot of graphics. I make class that
Make it on Linux. The reason to use more than one version of Vim,
I want to make my QML Grid scrollable as soon as the content is
I make some script, that have modal window on fancybox and on load it's
Make javaScript and CSS External Source . Does that mean I should use JavaScript
How is it possible in QML to automatically stretch element so that all its
I'm trying to use Qt Quick Components for Desktop from http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ I can build
I make iphone application. I use for root controller tab bar controller. One of
Thinking of implementing a LDAP-viewer in QML. The first step is obviously to make
I just realized that (according to some QML Bugreport) there is JSON Delegate for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.