X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FFancyLineEdit.h;h=ef6b45aa5fc7f6efe0a6bde78b66b458a0522f77;hb=161f7b7f62cb33dab681add6c5b5b68a887e2ea1;hp=ec472eed8c7ee8cc3f652f91693f7d3f39025b4c;hpb=1f81d78814354ab87c4df9afed0cb157c314a605;p=lyx.git diff --git a/src/frontends/qt4/FancyLineEdit.h b/src/frontends/qt4/FancyLineEdit.h index ec472eed8c..ef6b45aa5f 100644 --- a/src/frontends/qt4/FancyLineEdit.h +++ b/src/frontends/qt4/FancyLineEdit.h @@ -14,8 +14,8 @@ #ifndef FANCYLINEEDIT_H #define FANCYLINEEDIT_H -#include -#include +#include +#include namespace lyx { namespace frontend { @@ -29,23 +29,22 @@ class IconButton: public QAbstractButton Q_PROPERTY(bool autoHide READ hasAutoHide WRITE setAutoHide) Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) public: - explicit IconButton(QWidget *parent = 0); - void paintEvent(QPaintEvent *event); - void setPixmap(const QPixmap &pixmap) { m_pixmap = pixmap; update(); } - QPixmap pixmap() const { return m_pixmap; } - float iconOpacity() { return m_iconOpacity; } - void setIconOpacity(float value) { m_iconOpacity = value; update(); } - void animateShow(bool visible); - - void setAutoHide(bool hide) { m_autoHide = hide; } - bool hasAutoHide() const { return m_autoHide; } + explicit IconButton(QWidget *parent = 0); + void paintEvent(QPaintEvent *event); + void setPixmap(const QPixmap &pixmap) { m_pixmap = pixmap; update(); } + QPixmap pixmap() const { return m_pixmap; } + float iconOpacity() { return m_iconOpacity; } + void setIconOpacity(float value) { m_iconOpacity = value; update(); } + void animateShow(bool visible); + + void setAutoHide(bool hide) { m_autoHide = hide; } + bool hasAutoHide() const { return m_autoHide; } private: - float m_iconOpacity; - bool m_autoHide; - QPixmap m_pixmap; + float m_iconOpacity; + bool m_autoHide; + QPixmap m_pixmap; }; - /* A line edit with an embedded pixmap on one side that is connected to * a menu. Additionally, it can display a grayed hintText (like "Type Here to") * when not focused and empty. When connecting to the changed signals and @@ -60,57 +59,52 @@ class FancyLineEdit : public QLineEdit Q_ENUMS(Side) public: - enum Side {Left = 0, Right = 1}; + enum Side {Left = 0, Right = 1}; Q_SIGNALS: - void buttonClicked(Side side); - void leftButtonClicked(); - void rightButtonClicked(); + void buttonClicked(Side side); + void leftButtonClicked(); + void rightButtonClicked(); + void downPressed(); -#if QT_VERSION >= 0x040600 public: - explicit FancyLineEdit(QWidget *parent = 0); - ~FancyLineEdit(); + explicit FancyLineEdit(QWidget *parent = 0); + ~FancyLineEdit(); - QPixmap buttonPixmap(Side side) const; - void setButtonPixmap(Side side, const QPixmap &pixmap); + QPixmap buttonPixmap(Side side) const; + void setButtonPixmap(Side side, const QPixmap &pixmap); - QMenu *buttonMenu(Side side) const; - void setButtonMenu(Side side, QMenu *menu); + QMenu *buttonMenu(Side side) const; + void setButtonMenu(Side side, QMenu *menu); - void setButtonVisible(Side side, bool visible); - bool isButtonVisible(Side side) const; + void setButtonVisible(Side side, bool visible); + bool isButtonVisible(Side side) const; - void setButtonToolTip(Side side, const QString &); - void setButtonFocusPolicy(Side side, Qt::FocusPolicy policy); + void setButtonToolTip(Side side, const QString &); + void setButtonFocusPolicy(Side side, Qt::FocusPolicy policy); - // Set whether tabbing in will trigger the menu. - void setMenuTabFocusTrigger(Side side, bool v); - bool hasMenuTabFocusTrigger(Side side) const; + // Set whether tabbing in will trigger the menu. + void setMenuTabFocusTrigger(Side side, bool v); + bool hasMenuTabFocusTrigger(Side side) const; - // Set if icon should be hidden when text is empty - void setAutoHideButton(Side side, bool h); - bool hasAutoHideButton(Side side) const; + // Set if icon should be hidden when text is empty + void setAutoHideButton(Side side, bool h); + bool hasAutoHideButton(Side side) const; private Q_SLOTS: - void checkButtons(const QString &); - void iconClicked(); + void checkButtons(const QString &); + void iconClicked(); protected: - virtual void resizeEvent(QResizeEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void keyPressEvent(QKeyEvent *e); private: - void updateMargins(); + void updateMargins(); void updateButtonPositions(); - FancyLineEditPrivate *m_d; - QString m_oldText; -#else -public: - explicit FancyLineEdit(QWidget *parent = 0) - : QLineEdit(parent) - {} -#endif // QT_VERSION >= 0x040600*/ + FancyLineEditPrivate *m_d; + QString m_oldText; }; }