/src/libtomahawk/thirdparty/Qocoa/qsearchfield.h

http://github.com/tomahawk-player/tomahawk · C Header · 50 lines · 38 code · 12 blank · 0 comment · 0 complexity · c7cf1b4e0009c8839065bd0fb56d8d06 MD5 · raw file

  1. #ifndef QSEARCHFIELD_H
  2. #define QSEARCHFIELD_H
  3. #include <QWidget>
  4. #include <QPointer>
  5. #include <QMenu>
  6. #include "DllMacro.h"
  7. class QSearchFieldPrivate;
  8. class DLLEXPORT QSearchField : public QWidget
  9. {
  10. Q_OBJECT
  11. Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true);
  12. Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText);
  13. public:
  14. explicit QSearchField(QWidget *parent);
  15. QString text() const;
  16. QString placeholderText() const;
  17. void setFocus(Qt::FocusReason);
  18. void setMenu(QMenu *menu);
  19. public slots:
  20. void setText(const QString &text);
  21. void setPlaceholderText(const QString &text);
  22. void clear();
  23. void selectAll();
  24. void setFocus();
  25. signals:
  26. void textChanged(const QString &text);
  27. void editingFinished();
  28. void returnPressed();
  29. private slots:
  30. void popupMenu();
  31. protected:
  32. void changeEvent(QEvent*);
  33. void resizeEvent(QResizeEvent*);
  34. private:
  35. friend class QSearchFieldPrivate;
  36. QPointer <QSearchFieldPrivate> pimpl;
  37. };
  38. #endif // QSEARCHFIELD_H