Commit 5f47703c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: simplification

parent e14f4778
......@@ -51,6 +51,7 @@
#include <QPainter>
#include <QStyleOptionViewItem>
#include <QKeyEvent>
#include <QPushButton>
PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
......
......@@ -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 )
......
......@@ -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()
......
......@@ -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
......
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