diff options
author | Jens Kilian <jens.kilian@advantest.com> | 2017-08-31 08:28:02 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-08-31 12:02:41 +0000 |
commit | e9b8a5839f026b4047895b8dc869e075da0bcf45 (patch) | |
tree | 778072b810fd21910e213014a31e0e638041477a /ui | |
parent | 5f1f891e2a8cb6a5241854884fae2aa8d69f28e6 (diff) |
Qt: Fix errors when compiling for Qt4.
This allows Wireshark to be built on RedHat EL 7.2, with Qt 4.8.5.
Bug: 13909
Change-Id: Ia39a288cc342afa2bd0217cb59dac84c3227086c
Reviewed-on: https://code.wireshark.org/review/23322
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window.cpp | 2 | ||||
-rw-r--r-- | ui/qt/main_window.h | 3 | ||||
-rw-r--r-- | ui/qt/rtp_player_dialog.cpp | 5 | ||||
-rw-r--r-- | ui/qt/uat_frame.cpp | 1 | ||||
-rw-r--r-- | ui/qt/widgets/drag_drop_toolbar.cpp | 6 | ||||
-rw-r--r-- | ui/qt/wireless_timeline.cpp | 23 | ||||
-rw-r--r-- | ui/qt/wireshark_application.cpp | 3 |
7 files changed, 39 insertions, 4 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index cd5a2ca53e..906c5bc981 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -220,6 +220,7 @@ static void plugin_if_mainwindow_update_toolbars(gconstpointer user_data) } } +#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) static void mainwindow_add_toolbar(const iface_toolbar *toolbar_entry) { if (gbl_cur_main_window_ && toolbar_entry) @@ -235,6 +236,7 @@ static void mainwindow_remove_toolbar(const gchar *menu_title) gbl_cur_main_window_->removeInterfaceToolbar(menu_title); } } +#endif QMenu* MainWindow::findOrAddMenu(QMenu *parent_menu, QString& menu_text) { QList<QAction *> actions = parent_menu->actions(); diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index a2ad55fafa..1e3ff04847 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -77,6 +77,9 @@ namespace Ui { class MainWindow; } +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +Q_DECLARE_METATYPE(QToolBar *) +#endif Q_DECLARE_METATYPE(ts_type) Q_DECLARE_METATYPE(ts_precision) diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp index aa413b9cad..df7f29d90a 100644 --- a/ui/qt/rtp_player_dialog.cpp +++ b/ui/qt/rtp_player_dialog.cpp @@ -94,6 +94,11 @@ enum { graph_data_col_ = src_port_col_ // QCPGraph }; +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +Q_DECLARE_METATYPE(RtpAudioStream *) +Q_DECLARE_METATYPE(QCPGraph *) +#endif + #ifdef QT_MULTIMEDIA_LIB static const double wf_graph_normal_width_ = 0.5; static const double wf_graph_selected_width_ = 2.0; diff --git a/ui/qt/uat_frame.cpp b/ui/qt/uat_frame.cpp index 699af26aa5..95aab9530f 100644 --- a/ui/qt/uat_frame.cpp +++ b/ui/qt/uat_frame.cpp @@ -36,6 +36,7 @@ #include <QLineEdit> #include <QKeyEvent> #include <QTreeWidgetItemIterator> +#include <QUrl> #include <QDebug> diff --git a/ui/qt/widgets/drag_drop_toolbar.cpp b/ui/qt/widgets/drag_drop_toolbar.cpp index 04f6c7d096..1b3cd47387 100644 --- a/ui/qt/widgets/drag_drop_toolbar.cpp +++ b/ui/qt/widgets/drag_drop_toolbar.cpp @@ -29,7 +29,9 @@ #include <QLayout> #include <QMimeData> #include <QMouseEvent> +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #include <QWindow> +#endif #define drag_drop_toolbar_action_ "drag_drop_toolbar_action_" @@ -97,9 +99,13 @@ bool DragDropToolBar::eventFilter(QObject * obj, QEvent * event) elem->property(drag_drop_toolbar_action_).toByteArray()); drag->setMimeData(mimeData); +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) qreal dpr = window()->windowHandle()->devicePixelRatio(); QPixmap pixmap(elem->size() * dpr); pixmap.setDevicePixelRatio(dpr); +#else + QPixmap pixmap(elem->size()); +#endif elem->render(&pixmap); drag->setPixmap(pixmap); diff --git a/ui/qt/wireless_timeline.cpp b/ui/qt/wireless_timeline.cpp index e2f734617c..1bcfea5bbf 100644 --- a/ui/qt/wireless_timeline.cpp +++ b/ui/qt/wireless_timeline.cpp @@ -114,7 +114,11 @@ static void accumulate_rgb(float rgb[TIMELINE_HEIGHT][3], int height, int dfilte void WirelessTimeline::mousePressEvent(QMouseEvent *event) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) start_x = last_x = event->localPos().x(); +#else + start_x = last_x = event->posF().x(); +#endif } @@ -123,8 +127,13 @@ void WirelessTimeline::mouseMoveEvent(QMouseEvent *event) if (event->buttons() == Qt::NoButton) return; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) qreal offset = event->localPos().x() - last_x; last_x = event->localPos().x(); +#else + qreal offset = event->posF().x() - last_x; + last_x = event->posF().x(); +#endif qreal shift = ((qreal) (end_tsf - start_tsf))/width() * offset; start_tsf -= shift; @@ -140,14 +149,19 @@ void WirelessTimeline::mouseMoveEvent(QMouseEvent *event) void WirelessTimeline::mouseReleaseEvent(QMouseEvent *event) { - qreal offset = event->localPos().x() - start_x; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + QPointF localPos = event->localPos(); +#else + QPointF localPos = event->posF(); +#endif + qreal offset = localPos.x() - start_x; /* if this was a drag, ignore it */ if (std::abs(offset) > 3) return; /* this was a click */ - guint num = find_packet(event->localPos().x()); + guint num = find_packet(localPos.x()); if (num == 0) return; @@ -474,7 +488,10 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe) QPainter p(this); // painting is done in device pixels in the x axis, get the ratio here - float ratio = p.device()->devicePixelRatio(); + float ratio = 1.0; +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) + ratio = p.device()->devicePixelRatio(); +#endif unsigned int packet; double zoom; diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 2e7d3b58e9..feb95725f1 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -81,6 +81,7 @@ #endif /* _WIN32 */ #include <QAction> +#include <QApplication> #include <QDesktopServices> #include <QDir> #include <QEvent> @@ -847,7 +848,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) : qApp->setStyleSheet(app_style_sheet); // If our window text is lighter than the window background, assume the theme is dark. - QPalette gui_pal = QGuiApplication::palette(); + QPalette gui_pal = qApp->palette(); prefs_set_gui_theme_is_dark(gui_pal.windowText().color().value() > gui_pal.window().color().value()); #ifdef HAVE_SOFTWARE_UPDATE |