make link licking and text selection -actually- work
svn path=/trunk/KDE/kdelibs/; revision=1095290
This commit is contained in:
parent
2025c72039
commit
9e5a7b85c1
@ -115,6 +115,7 @@ Label::Label(QGraphicsWidget *parent)
|
||||
{
|
||||
QLabel *native = new QLabel;
|
||||
native->setWindowFlags(native->windowFlags()|Qt::BypassGraphicsProxyWidget);
|
||||
native->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
d->textSelectable = false;
|
||||
connect(native, SIGNAL(linkActivated(QString)), this, SIGNAL(linkActivated(QString)));
|
||||
connect(native, SIGNAL(linkHovered(QString)), this, SIGNAL(linkHovered(QString)));
|
||||
@ -189,7 +190,7 @@ bool Label::hasScaledContents() const
|
||||
|
||||
void Label::setTextSelectable(bool enable)
|
||||
{
|
||||
d->textSelectable = enable;
|
||||
d->textSelectable = enable;
|
||||
}
|
||||
|
||||
bool Label::textSelectable() const
|
||||
@ -251,10 +252,14 @@ void Label::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
|
||||
void Label::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (!d->textSelectable) {
|
||||
event->ignore();
|
||||
} else {
|
||||
QGraphicsProxyWidget::mousePressEvent(event);
|
||||
QGraphicsProxyWidget::mousePressEvent(event);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void Label::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (d->textSelectable) {
|
||||
QGraphicsProxyWidget::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,7 @@ public Q_SLOTS:
|
||||
protected:
|
||||
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
Loading…
Reference in New Issue
Block a user