From 2e44efa5056355ac2c069ad2bd8a8ba6562f3eb6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 20 Feb 2014 10:24:22 +0100 Subject: Webbrowser example: Fix crash due to deprecated code. The example uses a Qt Designer form with widgets on a QToolBar imported from Qt 3 which is not supported in Qt 4 and later. In the code generated by uic, a QLabel is constructed passing the toolbar as parent and added to the toolbar using QToolBar::addWidget() which then causes a crash in Qt 4. Move the widgets from the form into the class to avoid this. Task-number: QTBUG-36948 Change-Id: Ia4af871ce99faf555bebc6ebde19bcae0de4d29e Reviewed-by: Andy Shaw --- examples/activeqt/webbrowser/main.cpp | 7 +++++++ examples/activeqt/webbrowser/mainwindow.ui | 21 --------------------- .../activeqt/webbrowser/mainwindow_windowsmobile.ui | 21 --------------------- 3 files changed, 7 insertions(+), 42 deletions(-) (limited to 'examples') diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp index 51a9dce..e65526d 100644 --- a/examples/activeqt/webbrowser/main.cpp +++ b/examples/activeqt/webbrowser/main.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include #include @@ -74,6 +76,7 @@ public slots: private: QProgressBar *pb; + QLineEdit *addressEdit; }; //! [0] //! [1] @@ -81,6 +84,10 @@ MainWindow::MainWindow() { setupUi(this); + addressEdit = new QLineEdit; + tbAddress->insertWidget(actionGo, new QLabel(tr("Address"))); + tbAddress->insertWidget(actionGo, addressEdit); + connect(addressEdit, SIGNAL(returnPressed()), actionGo, SLOT(trigger())); connect(actionBack, SIGNAL(triggered()), WebBrowser, SLOT(GoBack())); connect(actionForward, SIGNAL(triggered()), WebBrowser, SLOT(GoForward())); diff --git a/examples/activeqt/webbrowser/mainwindow.ui b/examples/activeqt/webbrowser/mainwindow.ui index 12a0a32..9af0f8e 100644 --- a/examples/activeqt/webbrowser/mainwindow.ui +++ b/examples/activeqt/webbrowser/mainwindow.ui @@ -87,19 +87,6 @@ Address - - - lblAddress - - - Address - - - - - addressEdit - - @@ -271,14 +258,6 @@
webaxwidget.h
- - - addressEdit - returnPressed() - actionGo - trigger() - - diff --git a/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui index 98a9ddb..768dc43 100644 --- a/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui +++ b/examples/activeqt/webbrowser/mainwindow_windowsmobile.ui @@ -87,19 +87,6 @@ Address - - - lblAddress - - - Address - - - - - addressEdit - -
@@ -264,14 +251,6 @@ - - - addressEdit - returnPressed() - actionGo - trigger() - - -- cgit v1.2.1