diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-02-20 10:24:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-20 10:55:36 +0100 |
commit | 2e44efa5056355ac2c069ad2bd8a8ba6562f3eb6 (patch) | |
tree | c62ee1585d0f15c90d70441e5d4b915fb399b812 | |
parent | 41e685d02ff7c881b90970f6fd8b6c7a2a2831c7 (diff) |
Webbrowser example: Fix crash due to deprecated code.v5.3.0-alpha1
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 <andy.shaw@digia.com>
-rw-r--r-- | examples/activeqt/webbrowser/main.cpp | 7 | ||||
-rw-r--r-- | examples/activeqt/webbrowser/mainwindow.ui | 21 | ||||
-rw-r--r-- | examples/activeqt/webbrowser/mainwindow_windowsmobile.ui | 21 |
3 files changed, 7 insertions, 42 deletions
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 <QApplication> #include <QMessageBox> #include <QProgressBar> +#include <QLineEdit> +#include <QLabel> #include <QStatusBar> #include <QMainWindow> #include <QAbstractEventDispatcher> @@ -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 @@ <property name="windowTitle" > <string>Address</string> </property> - <widget class="QLabel" name="lblAddress" > - <property name="objectName" > - <string notr="true" >lblAddress</string> - </property> - <property name="text" > - <string>Address</string> - </property> - </widget> - <widget class="QLineEdit" name="addressEdit" > - <property name="objectName" > - <string notr="true" >addressEdit</string> - </property> - </widget> <addaction name="actionGo" /> </widget> <widget class="QMenuBar" name="menubar" > @@ -271,14 +258,6 @@ <header>webaxwidget.h</header> </customwidget> </customwidgets> - <connections> - <connection> - <sender>addressEdit</sender> - <signal>returnPressed()</signal> - <receiver>actionGo</receiver> - <slot>trigger()</slot> - </connection> - </connections> <layoutdefault spacing="6" margin="11" /> <images> <image name="image0" > 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 @@ <property name="windowTitle" > <string>Address</string> </property> - <widget class="QLabel" name="lblAddress" > - <property name="objectName" > - <string notr="true" >lblAddress</string> - </property> - <property name="text" > - <string>Address</string> - </property> - </widget> - <widget class="QLineEdit" name="addressEdit" > - <property name="objectName" > - <string notr="true" >addressEdit</string> - </property> - </widget> <addaction name="actionGo" /> </widget> <widget class="QMenuBar" name="menubar" > @@ -264,14 +251,6 @@ </property> </actiongroup> </widget> - <connections> - <connection> - <sender>addressEdit</sender> - <signal>returnPressed()</signal> - <receiver>actionGo</receiver> - <slot>trigger()</slot> - </connection> - </connections> <layoutdefault spacing="6" margin="11" /> <images> <image name="image0" > |