Commit 9123d53b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: use Qt4.7 clickLineEdit, if possible

parent 8a7513fe
......@@ -45,6 +45,7 @@
#endif
#define HAS_QT45 ( QT_VERSION >= 0x040500 )
#define HAS_QT47 ( QT_VERSION >= 0x040700 )
enum {
DialogEventType = 0,
......
......@@ -40,6 +40,8 @@
#include <vlc_intf_strings.h>
#if QT_VERSION < 0x040700
ClickLineEdit::ClickLineEdit( const QString &msg, QWidget *parent) : QLineEdit( parent )
{
mDrawClickMsg = true;
......@@ -99,9 +101,7 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev )
}
QLineEdit::focusOutEvent( ev );
}
#endif
SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent )
{
......
......@@ -29,6 +29,19 @@
#include <QLineEdit>
#include <qt4.hpp>
#if HAS_QT47
class ClickLineEdit : public QLineEdit
{
Q_OBJECT
public:
ClickLineEdit( const QString &msg, QWidget *parent ) : QLineEdit( parent )
{
QLineEdit::setPlaceholderText ( msg );
}
};
#else
/**
This class provides a QLineEdit which contains a greyed-out hinting
text as long as the user didn't enter any text
......@@ -39,11 +52,11 @@
class ClickLineEdit : public QLineEdit
{
Q_OBJECT
Q_PROPERTY( QString clickMessage READ clickMessage WRITE setPlaceholderText )
Q_PROPERTY( QString clickMessage READ placeholderText WRITE setPlaceholderText )
public:
ClickLineEdit( const QString &msg, QWidget *parent );
void setPlaceholderText( const QString &msg );
const QString& clickMessage() const { return mClickMessage; }
const QString& placeholderText() const { return mClickMessage; }
virtual void setText( const QString& txt );
protected:
virtual void paintEvent( QPaintEvent *e );
......@@ -54,6 +67,7 @@ private:
QString mClickMessage;
bool mDrawClickMsg;
};
#endif
class QVLCFramelessButton;
class SearchLineEdit : public QLineEdit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment