summaryrefslogtreecommitdiff
path: root/src/urlbar/listitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/listitem.cpp')
-rw-r--r--src/urlbar/listitem.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index d9837c7e..ee63a156 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -46,9 +46,10 @@
#include <QFile>
#include <QMouseEvent>
+
ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
- : QWidget(parent),
- m_option()
+ : QWidget(parent)
+ , m_option()
{
QHBoxLayout *hLayout = new QHBoxLayout;
QVBoxLayout *vLayout = new QVBoxLayout;
@@ -101,6 +102,7 @@ ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
deactivate();
}
+
ListItem::~ListItem()
{
disconnect();
@@ -130,16 +132,17 @@ QString ListItem::guessNameFromUrl(QUrl url)
void ListItem::activate()
{
m_option.state |= QStyle::State_Selected;
- repaint();
+ update();
}
void ListItem::deactivate()
{
m_option.state &= ~QStyle::State_Selected;
- repaint();
+ update();
}
+
void ListItem::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
@@ -152,23 +155,25 @@ void ListItem::paintEvent(QPaintEvent *event)
}
}
+
void ListItem::enterEvent(QEvent *e)
{
m_option.state |= QStyle::State_MouseOver;
- repaint();
+ update();
QWidget::enterEvent(e);
}
+
void ListItem::leaveEvent(QEvent *e)
{
m_option.state &= ~QStyle::State_MouseOver;
- repaint();
+ update();
QWidget::enterEvent(e);
}
+
void ListItem::mousePressEvent(QMouseEvent *e)
{
emit itemClicked(this, e->button());
QWidget::mousePressEvent(e);
}
-