]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.cpp
Delete the "QPainter::begin: A paint device can only be painted by one painter at...
[vlc] / modules / gui / qt4 / util / customwidgets.cpp
index 907e71ccc1fcd9dd4b3c8b9c14314d17cdbff01b..ba58004ae9520e00ba6752e4ccf39924e72056f1 100644 (file)
@@ -3,7 +3,7 @@
  ****************************************************************************
  * Copyright (C) 2006 the VideoLAN team
  * Copyright (C) 2004 Daniel Molkentin <molkentin@kde.org>
- * $Id: qvlcframe.hpp 16283 2006-08-17 18:16:09Z zorglub $
+ * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  * The "ClickLineEdit" control is based on code by  Daniel Molkentin
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "customwidgets.hpp"
 #include <QPainter>
 #include <QLineEdit>
-#include <QPainter>
 #include <QColorGroup>
 #include <QRect>
 #include <QKeyEvent>
@@ -57,9 +59,9 @@ void ClickLineEdit::setText( const QString &txt )
 
 void ClickLineEdit::paintEvent( QPaintEvent *pe )
 {
-    QPainter p( this );
     QLineEdit::paintEvent( pe );
     if ( mDrawClickMsg == true && !hasFocus() ) {
+        QPainter p( this );
         QPen tmp = p.pen();
         p.setPen( palette().color( QPalette::Disabled, QPalette::Text ) );
         QRect cr = contentsRect();
@@ -67,6 +69,7 @@ void ClickLineEdit::paintEvent( QPaintEvent *pe )
         cr.setLeft( cr.left() + 3 );
         p.drawText( cr, Qt::AlignLeft | Qt::AlignVCenter, mClickMessage );
         p.setPen( tmp );
+        p.end();
     }
 }
 
@@ -178,6 +181,8 @@ int qtWheelEventToVLCKey( QWheelEvent *e )
 
 QString VLCKeyToString( int val )
 {
+    const char *base = KeyToString (val & ~KEY_MODIFIER);
+
     QString r = "";
     if( val & KEY_MODIFIER_CTRL )
         r+= "Ctrl+";
@@ -186,14 +191,6 @@ QString VLCKeyToString( int val )
     if( val & KEY_MODIFIER_SHIFT )
         r+= "Shift+";
 
-    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);
-    for( unsigned int i = 0; i< i_keys; i++ )
-    {
-        if( vlc_keys[i].i_key_code == (val& ~KEY_MODIFIER) )
-        {
-            r+= vlc_keys[i].psz_key_string;
-        }
-    }
-    return r;
+    return r + (base ? base : "Unset");
 }