From: hausmann Date: Wed, 7 Nov 2007 14:30:34 +0000 (+0000) Subject: Implemented createWindow() in QtLauncher. X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=55353543d5d5ea46e517d69a9072af1b6f5a62e8 Implemented createWindow() in QtLauncher. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27546 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 54f8d6599299..c84f80a77fef 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,14 @@ +2007-11-07 Simon Hausmann + + Reviewed by Lars. + + Implemented createWindow() in QtLauncher. + + * QtLauncher/main.cpp: + (WebPage::WebPage): + (MainWindow::MainWindow): + (WebPage::createWindow): + 2007-11-07 Simon Hausmann Reviewed by Lars. diff --git a/WebKit/qt/QtLauncher/main.cpp b/WebKit/qt/QtLauncher/main.cpp index f639685edbc4..b96cf060f81d 100644 --- a/WebKit/qt/QtLauncher/main.cpp +++ b/WebKit/qt/QtLauncher/main.cpp @@ -270,13 +270,21 @@ protected: QPushButton *clearButton; }; +class WebPage : public QWebPage +{ +public: + inline WebPage(QWidget *parent) : QWebPage(parent) {} + + virtual QWebPage *createWindow(); +}; + class MainWindow : public QMainWindow { Q_OBJECT public: - MainWindow(const QUrl &url) + MainWindow(const QUrl &url = QUrl()) { - page = new QWebPage(this); + page = new WebPage(this); InfoWidget *info = new InfoWidget(page); info->setGeometry(20, 20, info->sizeHint().width(), info->sizeHint().height()); @@ -320,10 +328,12 @@ public: hoverLabel = new HoverLabel(this); hoverLabel->hide(); - page->open(url); + if (url.isValid()) + page->open(url); info->raise(); } + inline QWebPage *webPage() const { return page; } protected slots: void changeLocation() { @@ -355,6 +365,12 @@ private: HoverLabel *hoverLabel; }; +QWebPage *WebPage::createWindow() +{ + MainWindow *mw = new MainWindow; + return mw->webPage(); +} + #include "main.moc" int main(int argc, char **argv)