diff --git a/ui/qt/capture_filter_edit.cpp b/ui/qt/capture_filter_edit.cpp index c1a26bd658..df54093646 100644 --- a/ui/qt/capture_filter_edit.cpp +++ b/ui/qt/capture_filter_edit.cpp @@ -83,7 +83,10 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) : { setAccessibleName(tr("Capture filter entry")); - empty_filter_message_ = QString(tr("Enter a capture filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS); + placeholder_text_ = QString(tr("Enter a capture filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS); +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + setPlaceholderText(placeholder_text_); +#endif // DFCombo // Bookmark (star) @@ -205,6 +208,7 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) : syntax_thread->start(); } +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) void CaptureFilterEdit::paintEvent(QPaintEvent *evt) { SyntaxLineEdit::paintEvent(evt); @@ -225,11 +229,12 @@ void CaptureFilterEdit::paintEvent(QPaintEvent *evt) { cr.setLeft(cr.left() + 2); cr.setRight(cr.right() - 2); - p.drawText(cr, Qt::AlignLeft|Qt::AlignVCenter, empty_filter_message_); + p.drawText(cr, Qt::AlignLeft|Qt::AlignVCenter, placeholder_text_); } // else check filter syntax and set the background accordingly // XXX - Should we add little warning/error icons as well? } +#endif // QT < 4.7 void CaptureFilterEdit::resizeEvent(QResizeEvent *) { diff --git a/ui/qt/capture_filter_edit.h b/ui/qt/capture_filter_edit.h index 58e26949bd..020799622f 100644 --- a/ui/qt/capture_filter_edit.h +++ b/ui/qt/capture_filter_edit.h @@ -34,7 +34,9 @@ public: explicit CaptureFilterEdit(QWidget *parent = 0, bool plain = false); protected: +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) void paintEvent(QPaintEvent *evt); +#endif void resizeEvent(QResizeEvent *); // void focusInEvent(QFocusEvent *evt); // void focusOutEvent(QFocusEvent *evt); @@ -52,7 +54,7 @@ private slots: private: bool plain_; bool field_name_only_; - QString empty_filter_message_; + QString placeholder_text_; QToolButton *bookmark_button_; QToolButton *clear_button_; QToolButton *apply_button_;