]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.hpp
Qt: selector cosmetic polish
[vlc] / modules / gui / qt4 / util / customwidgets.hpp
index ea5b3309a1b84470b51e15899a33581ca98245fd..77d57651a673d46966a742857fdfc9a5909a2a6f 100644 (file)
@@ -28,6 +28,7 @@
 #define _CUSTOMWIDGETS_H_
 
 #include <QLineEdit>
+#include <QPushButton>
 
 /**
   This class provides a QLineEdit which contains a greyed-out hinting
@@ -56,71 +57,46 @@ private:
     bool mDrawClickMsg;
 };
 
-class QToolButton;
-class SearchLineEdit : public QFrame
+class QVLCFramelessButton : public QPushButton
 {
-    Q_OBJECT
+    Q_OBJECT;
 public:
-    SearchLineEdit( QWidget *parent );
-
-private:
-    ClickLineEdit *searchLine;
-    QToolButton   *clearButton;
-
-private slots:
-    void updateText( const QString& );
-
-signals:
-    void textChanged( const QString& );
+    QVLCFramelessButton( QWidget *parent = NULL );
+    QSize sizeHint() const;
+protected:
+    virtual void paintEvent( QPaintEvent * event );
 };
 
-/*****************************************************************
- * Custom views
- *****************************************************************/
-#include <QMouseEvent>
-#include <QTreeView>
-#include <QCursor>
-#include <QPoint>
-#include <QModelIndex>
+class QLabel;
 
-/**
-  Special QTreeView that can emit rightClicked()
-  */
-class QVLCTreeView : public QTreeView
+class SearchLineEdit : public QLineEdit
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
-    void mouseReleaseEvent( QMouseEvent* e )
-    {
-        if( e->button() & Qt::RightButton )
-            return; /* Do NOT forward to QTreeView!! */
-        QTreeView::mouseReleaseEvent( e );
-    }
+    SearchLineEdit( QWidget *parent = NULL );
 
-    void mousePressEvent( QMouseEvent* e )
-    {
-        if( e->button() & Qt::RightButton )
-        {
-            emit rightClicked( indexAt( QPoint( e->x(), e->y() ) ),
-                               QCursor::pos() );
-            return;
-        }
-        if( e->button() & Qt::LeftButton )
-        {
-            if( !indexAt( QPoint( e->x(), e->y() ) ).isValid() )
-                clearSelection();
-        }
-        QTreeView::mousePressEvent( e );
-    }
+private:
+    void resizeEvent ( QResizeEvent * event );
+    void focusInEvent( QFocusEvent *event );
+    void focusOutEvent( QFocusEvent *event );
+    void paintEvent( QPaintEvent *event );
+    void setMessageVisible( bool on );
+    QVLCFramelessButton   *clearButton;
+    bool message;
+    QLabel *msg;
+
+public slots:
+    void clear();
 
-signals:
-    void rightClicked( QModelIndex, QPoint  );
+private slots:
+    void updateText( const QString& );
 };
 
 /* VLC Key/Wheel hotkeys interactions */
 
 class QKeyEvent;
 class QWheelEvent;
+class QInputEvent;
 
 int qtKeyModifiersToVLC( QInputEvent* e );
 int qtEventToVLCKey( QKeyEvent *e );