[vlc-commits] commit: Qt: simplification (Jean-Baptiste Kempf )
git at videolan.org
git at videolan.org
Tue Nov 30 21:47:07 CET 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Nov 30 21:00:48 2010 +0100| [5f47703c35b8c5a68050523043e8f33aeee737b1] | committer: Jean-Baptiste Kempf
Qt: simplification
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f47703c35b8c5a68050523043e8f33aeee737b1
---
modules/gui/qt4/dialogs/plugins.cpp | 1 +
modules/gui/qt4/util/customwidgets.cpp | 8 +----
modules/gui/qt4/util/searchlineedit.cpp | 53 ++++++++++++++-----------------
modules/gui/qt4/util/searchlineedit.hpp | 6 +---
4 files changed, 27 insertions(+), 41 deletions(-)
diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 96c9447..9be087f 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -51,6 +51,7 @@
#include <QPainter>
#include <QStyleOptionViewItem>
#include <QKeyEvent>
+#include <QPushButton>
PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp
index 58c1df2..13df63a 100644
--- a/modules/gui/qt4/util/customwidgets.cpp
+++ b/modules/gui/qt4/util/customwidgets.cpp
@@ -29,19 +29,13 @@
#endif
#include "customwidgets.hpp"
-#include "qt4.hpp" /*needed for qtr and CONNECT, but not necessary */
+#include "qt4.hpp" /*needed for qtr and CONNECT, but not necessary */
#include <QPainter>
-#include <QColorGroup>
#include <QRect>
#include <QKeyEvent>
#include <QWheelEvent>
-#include <QHBoxLayout>
-#include <QStyle>
-#include <QStyleOption>
-#include <vlc_intf_strings.h>
#include <vlc_keys.h>
-#include <wctype.h> /* twolower() */
QVLCFramelessButton::QVLCFramelessButton( QWidget *parent )
: QPushButton( parent )
diff --git a/modules/gui/qt4/util/searchlineedit.cpp b/modules/gui/qt4/util/searchlineedit.cpp
index e46383b..a398ccc 100644
--- a/modules/gui/qt4/util/searchlineedit.cpp
+++ b/modules/gui/qt4/util/searchlineedit.cpp
@@ -34,16 +34,11 @@
#include "qt4.hpp" /*needed for qtr and CONNECT, but not necessary */
#include <QPainter>
-#include <QColorGroup>
#include <QRect>
-#include <QKeyEvent>
-#include <QWheelEvent>
-#include <QHBoxLayout>
#include <QStyle>
#include <QStyleOption>
+
#include <vlc_intf_strings.h>
-#include <vlc_keys.h>
-#include <wctype.h> /* twolower() */
ClickLineEdit::ClickLineEdit( const QString &msg, QWidget *parent) : QLineEdit( parent )
{
@@ -158,41 +153,41 @@ void SearchLineEdit::updateText( const QString& text )
void SearchLineEdit::resizeEvent ( QResizeEvent * event )
{
- QLineEdit::resizeEvent( event );
- int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0,this);
- clearButton->resize( clearButton->sizeHint().width(), height() );
- clearButton->move( width() - clearButton->width() - frameWidth, 0 );
+ QLineEdit::resizeEvent( event );
+ int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0,this);
+ clearButton->resize( clearButton->sizeHint().width(), height() );
+ clearButton->move( width() - clearButton->width() - frameWidth, 0 );
}
void SearchLineEdit::focusInEvent( QFocusEvent *event )
{
- if( message )
- {
- setMessageVisible( false );
- }
- QLineEdit::focusInEvent( event );
+ if( message )
+ {
+ setMessageVisible( false );
+ }
+ QLineEdit::focusInEvent( event );
}
void SearchLineEdit::focusOutEvent( QFocusEvent *event )
{
- if( text().isEmpty() )
- {
- setMessageVisible( true );
- }
- QLineEdit::focusOutEvent( event );
+ if( text().isEmpty() )
+ {
+ setMessageVisible( true );
+ }
+ QLineEdit::focusOutEvent( event );
}
void SearchLineEdit::paintEvent( QPaintEvent *event )
{
- QLineEdit::paintEvent( event );
- if( !message ) return;
- QStyleOption option;
- option.initFrom( this );
- QRect rect = style()->subElementRect( QStyle::SE_LineEditContents, &option, this )
- .adjusted( 3, 0, clearButton->width() + 1, 0 );
- QPainter painter( this );
- painter.setPen( palette().color( QPalette::Disabled, QPalette::Text ) );
- painter.drawText( rect, Qt::AlignLeft | Qt::AlignVCenter, qtr( I_PL_FILTER ) );
+ QLineEdit::paintEvent( event );
+ if( !message ) return;
+ QStyleOption option;
+ option.initFrom( this );
+ QRect rect = style()->subElementRect( QStyle::SE_LineEditContents, &option, this )
+ .adjusted( 3, 0, clearButton->width() + 1, 0 );
+ QPainter painter( this );
+ painter.setPen( palette().color( QPalette::Disabled, QPalette::Text ) );
+ painter.drawText( rect, Qt::AlignLeft | Qt::AlignVCenter, qtr( I_PL_FILTER ) );
}
void SearchLineEdit::searchEditingFinished()
diff --git a/modules/gui/qt4/util/searchlineedit.hpp b/modules/gui/qt4/util/searchlineedit.hpp
index a824950..b17b7c5 100644
--- a/modules/gui/qt4/util/searchlineedit.hpp
+++ b/modules/gui/qt4/util/searchlineedit.hpp
@@ -28,12 +28,7 @@
#define _SEARCHLINEEDIT_H_
#include <QLineEdit>
-#include <QPushButton>
-#include <QLabel>
-#include <QStackedWidget>
-#include <QSpinBox>
-class QVLCFramelessButton;
/**
This class provides a QLineEdit which contains a greyed-out hinting
text as long as the user didn't enter any text
@@ -60,6 +55,7 @@ private:
bool mDrawClickMsg;
};
+class QVLCFramelessButton;
class SearchLineEdit : public QLineEdit
{
Q_OBJECT
More information about the vlc-commits
mailing list