Use setPlaceholderText in CaptureFilterEdit.

Matches a recent change in DisplayFilterEdit.

Change-Id: I22d0f4a327ecae0e2065302a003037d19162b74d
Reviewed-on: https://code.wireshark.org/review/8401
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-05-11 10:25:27 -07:00
parent c9ec0be83f
commit e37ae1000d
2 changed files with 10 additions and 3 deletions

View File

@ -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 *)
{

View File

@ -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_;