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 @@ ...@@ -45,6 +45,7 @@
#endif #endif
#define HAS_QT45 ( QT_VERSION >= 0x040500 ) #define HAS_QT45 ( QT_VERSION >= 0x040500 )
#define HAS_QT47 ( QT_VERSION >= 0x040700 )
enum { enum {
DialogEventType = 0, DialogEventType = 0,
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <vlc_intf_strings.h> #include <vlc_intf_strings.h>
#if QT_VERSION < 0x040700
ClickLineEdit::ClickLineEdit( const QString &msg, QWidget *parent) : QLineEdit( parent ) ClickLineEdit::ClickLineEdit( const QString &msg, QWidget *parent) : QLineEdit( parent )
{ {
mDrawClickMsg = true; mDrawClickMsg = true;
...@@ -99,9 +101,7 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev ) ...@@ -99,9 +101,7 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev )
} }
QLineEdit::focusOutEvent( ev ); QLineEdit::focusOutEvent( ev );
} }
#endif
SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent ) SearchLineEdit::SearchLineEdit( QWidget *parent ) : QLineEdit( parent )
{ {
......
...@@ -29,6 +29,19 @@ ...@@ -29,6 +29,19 @@
#include <QLineEdit> #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 This class provides a QLineEdit which contains a greyed-out hinting
text as long as the user didn't enter any text text as long as the user didn't enter any text
...@@ -39,11 +52,11 @@ ...@@ -39,11 +52,11 @@
class ClickLineEdit : public QLineEdit class ClickLineEdit : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QString clickMessage READ clickMessage WRITE setPlaceholderText ) Q_PROPERTY( QString clickMessage READ placeholderText WRITE setPlaceholderText )
public: public:
ClickLineEdit( const QString &msg, QWidget *parent ); ClickLineEdit( const QString &msg, QWidget *parent );
void setPlaceholderText( const QString &msg ); void setPlaceholderText( const QString &msg );
const QString& clickMessage() const { return mClickMessage; } const QString& placeholderText() const { return mClickMessage; }
virtual void setText( const QString& txt ); virtual void setText( const QString& txt );
protected: protected:
virtual void paintEvent( QPaintEvent *e ); virtual void paintEvent( QPaintEvent *e );
...@@ -54,6 +67,7 @@ private: ...@@ -54,6 +67,7 @@ private:
QString mClickMessage; QString mClickMessage;
bool mDrawClickMsg; bool mDrawClickMsg;
}; };
#endif
class QVLCFramelessButton; class QVLCFramelessButton;
class SearchLineEdit : public QLineEdit 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