mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 14:28:24 +01:00
Correctly paint hover state in DropDownButton
This commit is contained in:
parent
996d112ebb
commit
f95bd4aab8
@ -32,7 +32,9 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
DropDownButton::DropDownButton( QWidget* parent )
|
DropDownButton::DropDownButton( QWidget* parent )
|
||||||
: QComboBox( parent )
|
: QComboBox( parent )
|
||||||
|
, m_hovering( false )
|
||||||
{
|
{
|
||||||
|
setAttribute( Qt::WA_Hover, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ DropDownButton::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
setupPainter( &p );
|
setupPainter( &p );
|
||||||
|
|
||||||
drawPrimitive( &p, contentsRect(), currentText(), true, true );
|
drawPrimitive( &p, contentsRect(), currentText(), m_hovering, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,6 +120,22 @@ DropDownButton::mousePressEvent( QMouseEvent* event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DropDownButton::enterEvent( QEvent * event )
|
||||||
|
{
|
||||||
|
m_hovering = true;
|
||||||
|
QWidget::enterEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DropDownButton::leaveEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
m_hovering = false;
|
||||||
|
QWidget::leaveEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DropDownButton::setupPainter( QPainter* p )
|
DropDownButton::setupPainter( QPainter* p )
|
||||||
{
|
{
|
||||||
|
@ -42,11 +42,15 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
void mousePressEvent( QMouseEvent* event );
|
void mousePressEvent( QMouseEvent* event );
|
||||||
|
void enterEvent( QEvent* event );
|
||||||
|
void leaveEvent( QEvent* event );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setupPainter( QPainter* p );
|
static void setupPainter( QPainter* p );
|
||||||
|
|
||||||
|
bool m_hovering;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DROPDOWNBUTTON_H
|
#endif // DROPDOWNBUTTON_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user