1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Address of hovered link won't stuck at screen when changing to other

window anymore.
This commit is contained in:
nowrep 2011-07-19 23:26:34 +02:00
parent 9801c59535
commit a8881c1d73
2 changed files with 64 additions and 23 deletions

View File

@ -2,38 +2,60 @@
#include "qupzilla.h"
#include "squeezelabelv1.h"
TipLabel::TipLabel(QupZilla* parent) : SqueezeLabelV1(parent) , p_QupZilla(parent)
{
m_timer = new QTimer();
m_timer->setInterval(300);
connect(m_timer, SIGNAL(timeout()), this, SLOT(checkMainWindowFocus()));
class TipLabel : public SqueezeLabelV1 {
public:
TipLabel()
{
setWindowFlags(Qt::ToolTip);
setForegroundRole(QPalette::ToolTipText);
setBackgroundRole(QPalette::ToolTipBase);
setPalette(QToolTip::palette());
ensurePolished();
setFrameStyle(QFrame::NoFrame);
setMargin(2);
}
setWindowFlags(Qt::ToolTip);
setForegroundRole(QPalette::ToolTipText);
setBackgroundRole(QPalette::ToolTipBase);
setPalette(QToolTip::palette());
ensurePolished();
setFrameStyle(QFrame::NoFrame);
setMargin(2);
}
void paintEvent(QPaintEvent *ev)
{
QStylePainter p(this);
QStyleOptionFrame opt;
opt.init(this);
p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
p.end();
void TipLabel::paintEvent(QPaintEvent *ev)
{
QStylePainter p(this);
QStyleOptionFrame opt;
opt.init(this);
p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
p.end();
SqueezeLabelV1::paintEvent(ev);
}
void TipLabel::show()
{
if (!p_QupZilla->weView()->hasFocus())
return;
m_timer->start();
SqueezeLabelV1::show();
}
void TipLabel::hide()
{
m_timer->stop();
SqueezeLabelV1::hide();
}
void TipLabel::checkMainWindowFocus()
{
if (!p_QupZilla->weView()->hasFocus())
hide();
}
SqueezeLabelV1::paintEvent(ev);
}
};
StatusBarMessage::StatusBarMessage(QupZilla* mainClass)
: QObject()
, p_QupZilla(mainClass)
{
m_statusBarText = new TipLabel();
m_statusBarText = new TipLabel(mainClass);
}
#define STATUS_Y_OFFSET -35

View File

@ -3,9 +3,28 @@
#include <QObject>
#include <QToolTip>
#include "squeezelabelv1.h"
class QupZilla;
class TipLabel;
class TipLabel : public SqueezeLabelV1 {
Q_OBJECT
public:
TipLabel(QupZilla* parent);
void paintEvent(QPaintEvent *ev);
void show();
void hide();
private slots:
void checkMainWindowFocus();
private:
QTimer* m_timer;
QupZilla* p_QupZilla;
};
class StatusBarMessage : public QObject
{
Q_OBJECT