[Moved] QtWebKit not responding to mouse events?
-
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.
-
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. -
[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