Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Moved] QtWebKit not responding to mouse events?
Qt 6.11 is out! See what's new in the release blog

[Moved] QtWebKit not responding to mouse events?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kylebragger
    wrote on last edited by
    #1

    Just created a bare bones Qt windowed app to test out some Webkit stuff, but webkit isn't responding to any mouse events. Keyboard input works just fine, but not mouse. Here's the relevant code:

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include <QtWebKit/QtWebKit>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    QWebView *wv = new QWebView(this);
    wv->setGeometry(50, 50, 800, 600);
    wv->load(QUrl("http://google.com/"));
    wv->show();
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }
    @

    Am I missing something obvious? Somewhat new to Qt.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      The web view has a parent and "suffers" from event propagation through that, but it is not in a layout and it may fail to receive some events this way.

      Either construct the web view without a parent:

      @
      QWebView *wv = new QWebView;
      @

      You don't even need a main window in that case.

      Or - preferrred - put it into a layout of a widget of the main window.

      And even more preferrable: Add the webview to the UI you have created in designer and use that.

      PS:
      Moved to the general forum, as it's nothing webkit specific.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kylebragger
        wrote on last edited by
        #3

        [quote author="Volker" date="1313674766"]The web view has a parent and "suffers" from event propagation through that, but it is not in a layout and it may fail to receive some events this way.[/quote]

        Very good to know, thanks for the reply (and sorry for my late one).

        Kyle

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved