mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Address of hovered link won't stuck at screen when changing to other
window anymore.
This commit is contained in:
parent
9801c59535
commit
a8881c1d73
|
@ -2,11 +2,12 @@
|
|||
#include "qupzilla.h"
|
||||
#include "squeezelabelv1.h"
|
||||
|
||||
|
||||
class TipLabel : public SqueezeLabelV1 {
|
||||
public:
|
||||
TipLabel()
|
||||
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()));
|
||||
|
||||
setWindowFlags(Qt::ToolTip);
|
||||
setForegroundRole(QPalette::ToolTipText);
|
||||
setBackgroundRole(QPalette::ToolTipBase);
|
||||
|
@ -16,7 +17,7 @@ public:
|
|||
setMargin(2);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *ev)
|
||||
void TipLabel::paintEvent(QPaintEvent *ev)
|
||||
{
|
||||
QStylePainter p(this);
|
||||
QStyleOptionFrame opt;
|
||||
|
@ -26,14 +27,35 @@ public:
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
StatusBarMessage::StatusBarMessage(QupZilla* mainClass)
|
||||
: QObject()
|
||||
, p_QupZilla(mainClass)
|
||||
{
|
||||
m_statusBarText = new TipLabel();
|
||||
m_statusBarText = new TipLabel(mainClass);
|
||||
}
|
||||
|
||||
#define STATUS_Y_OFFSET -35
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user