Commit 0734535d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: misc simplifications and corrections

parent 9123d53b
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <vlc_keys.h> #include <vlc_keys.h>
QVLCFramelessButton::QVLCFramelessButton( QWidget *parent ) QVLCFramelessButton::QVLCFramelessButton( QWidget *parent )
: QPushButton( parent ) : QPushButton( parent )
{ {
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
} }
...@@ -51,13 +51,8 @@ void QVLCFramelessButton::paintEvent( QPaintEvent * ) ...@@ -51,13 +51,8 @@ void QVLCFramelessButton::paintEvent( QPaintEvent * )
painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix ); painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix );
} }
QSize QVLCFramelessButton::sizeHint() const
{
return iconSize();
}
QVLCElidingLabel::QVLCElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent ) QVLCElidingLabel::QVLCElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent )
: elideMode( mode ), QLabel( s, parent ) : elideMode( mode ), QLabel( s, parent )
{ } { }
void QVLCElidingLabel::setElideMode( Qt::TextElideMode mode ) void QVLCElidingLabel::setElideMode( Qt::TextElideMode mode )
...@@ -90,14 +85,6 @@ QString DebugLevelSpinBox::textFromValue( int v ) const ...@@ -90,14 +85,6 @@ QString DebugLevelSpinBox::textFromValue( int v ) const
return QString( "%1 (%2)" ).arg( v ).arg( texts[v] ); return QString( "%1 (%2)" ).arg( v ).arg( texts[v] );
} }
int DebugLevelSpinBox::mapTextToValue ( bool *ok )
{
int parsedvalue = cleanText().toInt();
/* fix range */
*ok = ( parsedvalue < 0 || parsedvalue > 2 )? FALSE : TRUE;
return parsedvalue;
}
/*************************************************************************** /***************************************************************************
* Hotkeys converters * Hotkeys converters
***************************************************************************/ ***************************************************************************/
......
...@@ -38,7 +38,7 @@ class QVLCFramelessButton : public QPushButton ...@@ -38,7 +38,7 @@ class QVLCFramelessButton : public QPushButton
Q_OBJECT Q_OBJECT
public: public:
QVLCFramelessButton( QWidget *parent = NULL ); QVLCFramelessButton( QWidget *parent = NULL );
QSize sizeHint() const; virtual QSize sizeHint() const { return iconSize(); }
protected: protected:
virtual void paintEvent( QPaintEvent * event ); virtual void paintEvent( QPaintEvent * event );
}; };
...@@ -51,11 +51,13 @@ public: ...@@ -51,11 +51,13 @@ public:
Qt::TextElideMode mode = Qt::ElideRight, Qt::TextElideMode mode = Qt::ElideRight,
QWidget * parent = NULL ); QWidget * parent = NULL );
void setElideMode( Qt::TextElideMode ); void setElideMode( Qt::TextElideMode );
protected:
virtual void paintEvent( QPaintEvent * event );
private: private:
void paintEvent( QPaintEvent * event );
Qt::TextElideMode elideMode; Qt::TextElideMode elideMode;
}; };
class QVLCStackedWidget : public QStackedWidget class QVLCStackedWidget : public QStackedWidget
{ {
public: public:
...@@ -72,8 +74,9 @@ class DebugLevelSpinBox : public QSpinBox ...@@ -72,8 +74,9 @@ class DebugLevelSpinBox : public QSpinBox
public: public:
DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { }; DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { };
protected: protected:
QString textFromValue( int ) const; virtual QString textFromValue( int ) const;
int mapTextToValue ( bool * ); /* DebugLevelSpinBox is read-only */
virtual int valueFromText( const QString& ) const { return -1; }
}; };
/* VLC Key/Wheel hotkeys interactions */ /* VLC Key/Wheel hotkeys interactions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment