Compile fix for qt versions below 4.6.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38961 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2011-06-05 23:24:56 +00:00
parent 7f43e4339a
commit 7559973969
3 changed files with 19 additions and 5 deletions

View File

@ -26,6 +26,8 @@
#include <QtGui/QStyle> #include <QtGui/QStyle>
#include <QtGui/QPaintEvent> #include <QtGui/QPaintEvent>
#if QT_VERSION >= 0x040600
enum { margin = 6 }; enum { margin = 6 };
#define ICONBUTTON_HEIGHT 18 #define ICONBUTTON_HEIGHT 18
@ -302,4 +304,6 @@ void IconButton::animateShow(bool visible)
} }
#endif // QT_VERSION >= 0x040600
#include "moc_FancyLineEdit.cpp" #include "moc_FancyLineEdit.cpp"

View File

@ -62,6 +62,13 @@ class FancyLineEdit : public QLineEdit
public: public:
enum Side {Left = 0, Right = 1}; enum Side {Left = 0, Right = 1};
Q_SIGNALS:
void buttonClicked(Side side);
void leftButtonClicked();
void rightButtonClicked();
#if QT_VERSION >= 0x040600
public:
explicit FancyLineEdit(QWidget *parent = 0); explicit FancyLineEdit(QWidget *parent = 0);
~FancyLineEdit(); ~FancyLineEdit();
@ -85,11 +92,6 @@ public:
void setAutoHideButton(Side side, bool h); void setAutoHideButton(Side side, bool h);
bool hasAutoHideButton(Side side) const; bool hasAutoHideButton(Side side) const;
Q_SIGNALS:
void buttonClicked(Side side);
void leftButtonClicked();
void rightButtonClicked();
private Q_SLOTS: private Q_SLOTS:
void checkButtons(const QString &); void checkButtons(const QString &);
void iconClicked(); void iconClicked();
@ -103,6 +105,12 @@ private:
FancyLineEditPrivate *m_d; FancyLineEditPrivate *m_d;
QString m_oldText; QString m_oldText;
#else
public:
explicit FancyLineEdit(QWidget *parent = 0)
: QLineEdit(parent)
{}
#endif // QT_VERSION >= 0x040600*/
}; };
} }

View File

@ -75,10 +75,12 @@ PanelStack::PanelStack(QWidget * parent)
search_->setPlaceholderText(qt_("Search")); search_->setPlaceholderText(qt_("Search"));
#endif #endif
#if QT_VERSION >= 0x040600
search_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "png")); search_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "png"));
search_->setButtonVisible(FancyLineEdit::Right, true); search_->setButtonVisible(FancyLineEdit::Right, true);
search_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text")); search_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
search_->setAutoHideButton(FancyLineEdit::Right, true); search_->setAutoHideButton(FancyLineEdit::Right, true);
#endif
connect(search_, SIGNAL(rightButtonClicked()), this, SLOT(resetSearch())); connect(search_, SIGNAL(rightButtonClicked()), this, SLOT(resetSearch()));
connect(search_, SIGNAL(textEdited(QString)), this, SLOT(filterChanged(QString))); connect(search_, SIGNAL(textEdited(QString)), this, SLOT(filterChanged(QString)));