summaryrefslogtreecommitdiff
path: root/src/urlbar/listitem.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-01 15:38:45 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-01 15:38:45 +0200
commitb44a0fd574329a54a8377b5fe9e58748f846611f (patch)
treebd476baa50a84c2d03400eb7200a472bded93e57 /src/urlbar/listitem.cpp
parent3 pixels preview's dilemma (diff)
downloadrekonq-b44a0fd574329a54a8377b5fe9e58748f846611f.tar.xz
Cleaning awesome bar code a bit..
- update is better than repaint (this also probably solves the flickering results update) - right scope for some methods - removed KUrl use from there
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);
}
-