2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vgraphicssimpletextitem.cpp
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2013-11-15 13:41:26 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
#include "vgraphicssimpletextitem.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QFlags>
|
2014-06-17 11:50:11 +02:00
|
|
|
#include <QFont>
|
2015-06-15 15:59:19 +02:00
|
|
|
#include <QGraphicsScene>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QGraphicsSceneMouseEvent>
|
2015-11-25 18:26:37 +01:00
|
|
|
#include <QGraphicsView>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QKeyEvent>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMessageLogger>
|
|
|
|
#include <QPalette>
|
|
|
|
#include <QPoint>
|
|
|
|
#include <QPolygonF>
|
|
|
|
#include <QRectF>
|
|
|
|
#include <Qt>
|
2013-07-13 12:51:31 +02:00
|
|
|
|
2016-01-15 13:57:47 +01:00
|
|
|
#include "vmaingraphicsscene.h"
|
|
|
|
#include "vmaingraphicsview.h"
|
2017-06-19 14:26:29 +02:00
|
|
|
#include "global.h"
|
2017-10-23 20:10:48 +02:00
|
|
|
#include "vscenepoint.h"
|
2017-10-29 12:46:58 +01:00
|
|
|
#include "../vmisc/vmath.h"
|
2018-01-01 15:16:50 +01:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
2017-10-23 20:10:48 +02:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief VGraphicsSimpleTextItem default constructor.
|
|
|
|
* @param parent parent object.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent)
|
2017-10-28 12:02:51 +02:00
|
|
|
: QGraphicsSimpleTextItem(parent),
|
|
|
|
selectionType(SelectionType::ByMouseRelease),
|
2018-10-22 12:28:58 +02:00
|
|
|
m_oldScale(1),
|
|
|
|
m_showParentTooltip(true)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2017-10-28 12:02:51 +02:00
|
|
|
Init();
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief VGraphicsSimpleTextItem constructor.
|
|
|
|
* @param text text.
|
|
|
|
* @param parent parent object.
|
|
|
|
*/
|
2013-09-10 14:29:06 +02:00
|
|
|
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent )
|
2017-10-28 12:02:51 +02:00
|
|
|
: QGraphicsSimpleTextItem(text, parent),
|
|
|
|
selectionType(SelectionType::ByMouseRelease),
|
2018-10-22 12:28:58 +02:00
|
|
|
m_oldScale(1),
|
|
|
|
m_showParentTooltip(true)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2017-10-28 12:02:51 +02:00
|
|
|
Init();
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
|
|
|
|
2017-06-19 14:26:29 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
|
|
|
{
|
2017-10-23 20:10:48 +02:00
|
|
|
auto UpdateLine = [this]()
|
|
|
|
{
|
|
|
|
if (VScenePoint *parent = dynamic_cast<VScenePoint *>(parentItem()))
|
|
|
|
{
|
|
|
|
parent->RefreshLine();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-08 18:22:55 +02:00
|
|
|
QFont font = this->font();
|
|
|
|
if (font.pointSize() != qApp->Settings()->GetLabelFontSize())
|
|
|
|
{
|
|
|
|
font.setPointSize(qApp->Settings()->GetLabelFontSize());
|
|
|
|
setFont(font);
|
|
|
|
}
|
|
|
|
|
2017-10-23 20:10:48 +02:00
|
|
|
QGraphicsScene *scene = this->scene();
|
|
|
|
const qreal scale = SceneScale(scene);
|
|
|
|
if (scale > 1 && not VFuzzyComparePossibleNulls(m_oldScale, scale))
|
2017-06-19 14:26:29 +02:00
|
|
|
{
|
2017-09-30 20:13:22 +02:00
|
|
|
setScale(1/scale);
|
2019-05-05 16:31:45 +02:00
|
|
|
CorrectLabelPosition();
|
2017-10-23 20:10:48 +02:00
|
|
|
UpdateLine();
|
|
|
|
m_oldScale = scale;
|
|
|
|
}
|
|
|
|
else if (scale <= 1 && not VFuzzyComparePossibleNulls(m_oldScale, 1.0))
|
|
|
|
{
|
|
|
|
setScale(1);
|
2019-05-05 16:31:45 +02:00
|
|
|
CorrectLabelPosition();
|
2017-10-23 20:10:48 +02:00
|
|
|
UpdateLine();
|
|
|
|
m_oldScale = 1;
|
2017-06-19 14:26:29 +02:00
|
|
|
}
|
|
|
|
|
2017-10-27 08:13:51 +02:00
|
|
|
if (QGraphicsView *view = scene->views().at(0))
|
2017-10-23 20:10:48 +02:00
|
|
|
{
|
2017-10-27 08:13:51 +02:00
|
|
|
VMainGraphicsView::NewSceneRect(scene, view, this);
|
2017-10-23 20:10:48 +02:00
|
|
|
}
|
2017-10-29 10:06:17 +01:00
|
|
|
PaintWithFixItemHighlightSelected<QGraphicsSimpleTextItem>(this, painter, option, widget);
|
2017-06-19 14:26:29 +02:00
|
|
|
}
|
|
|
|
|
2015-02-04 12:47:53 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::setEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
QGraphicsSimpleTextItem::setEnabled(enabled);
|
|
|
|
const QPalette palet = this->scene()->palette();
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
setBrush(palet.brush(QPalette::Active, QPalette::Text));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setBrush(palet.brush(QPalette::Disabled, QPalette::Text));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-31 19:10:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::LabelSelectionType(const SelectionType &type)
|
|
|
|
{
|
|
|
|
selectionType = type;
|
|
|
|
}
|
|
|
|
|
2018-10-22 12:28:58 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::SetShowParentTooltip(bool show)
|
|
|
|
{
|
|
|
|
m_showParentTooltip = show;
|
|
|
|
}
|
|
|
|
|
2019-05-05 16:31:45 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-09-10 16:13:35 +02:00
|
|
|
// cppcheck-suppress passedByValue
|
2019-05-05 16:31:45 +02:00
|
|
|
void VGraphicsSimpleTextItem::SetRealPos(QPointF pos)
|
|
|
|
{
|
|
|
|
m_realPos = pos;
|
|
|
|
|
|
|
|
CorrectLabelPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::CorrectLabelPosition()
|
|
|
|
{
|
|
|
|
const qreal scale = SceneScale(scene());
|
|
|
|
QPointF newPos = m_realPos;
|
|
|
|
|
|
|
|
if (scale > 1)
|
|
|
|
{
|
2019-05-11 17:37:08 +02:00
|
|
|
QLineF line(m_destination, m_realPos);
|
2019-05-05 16:31:45 +02:00
|
|
|
line.setLength(line.length() / scale);
|
|
|
|
newPos = line.p2();
|
|
|
|
}
|
|
|
|
|
|
|
|
blockSignals(true);
|
|
|
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
|
|
|
setPos(newPos);
|
|
|
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
|
|
blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief itemChange handle item change.
|
|
|
|
* @param change change.
|
|
|
|
* @param value value.
|
|
|
|
* @return value.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
|
|
|
{
|
|
|
|
if (change == ItemPositionChange && scene())
|
|
|
|
{
|
2015-11-25 14:45:38 +01:00
|
|
|
// Each time we move something we call recalculation scene rect. In some cases this can cause moving
|
|
|
|
// objects positions. And this cause infinite redrawing. That's why we wait the finish of saving the last move.
|
|
|
|
static bool changeFinished = true;
|
|
|
|
if (changeFinished)
|
|
|
|
{
|
|
|
|
changeFinished = false;
|
2015-11-25 18:26:37 +01:00
|
|
|
if (scene())
|
|
|
|
{
|
2015-12-05 17:27:38 +01:00
|
|
|
const QList<QGraphicsView *> viewList = scene()->views();
|
|
|
|
if (not viewList.isEmpty())
|
2015-11-25 18:26:37 +01:00
|
|
|
{
|
2017-10-02 15:25:18 +02:00
|
|
|
if (VMainGraphicsView *view = qobject_cast<VMainGraphicsView *>(viewList.at(0)))
|
2015-12-05 17:27:38 +01:00
|
|
|
{
|
2020-06-20 11:20:39 +02:00
|
|
|
view->EnsureItemVisibleWithDelay(this, VMainGraphicsView::scrollDelay);
|
2015-12-05 17:27:38 +01:00
|
|
|
}
|
2015-11-25 18:26:37 +01:00
|
|
|
}
|
|
|
|
}
|
2019-05-05 16:31:45 +02:00
|
|
|
|
|
|
|
m_realPos = value.toPointF();
|
|
|
|
const qreal scale = SceneScale(scene());
|
|
|
|
if (scale > 1)
|
|
|
|
{
|
|
|
|
QLineF line(QPointF(), m_realPos);
|
|
|
|
line.setLength(line.length() * scale);
|
|
|
|
m_realPos = line.p2();
|
|
|
|
}
|
|
|
|
emit NameChangePosition(m_realPos + this->parentItem()->pos());
|
|
|
|
|
2015-11-25 14:45:38 +01:00
|
|
|
changeFinished = true;
|
|
|
|
}
|
2013-07-13 12:51:31 +02:00
|
|
|
}
|
2017-10-30 07:34:18 +01:00
|
|
|
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
2016-04-05 19:14:12 +02:00
|
|
|
{
|
2017-10-30 07:34:18 +01:00
|
|
|
setFlag(QGraphicsItem::ItemIsFocusable, value.toBool());
|
2016-04-05 19:14:12 +02:00
|
|
|
emit PointSelected(value.toBool());
|
|
|
|
}
|
2017-10-30 07:34:18 +01:00
|
|
|
return QGraphicsSimpleTextItem::itemChange(change, value);
|
2013-07-28 00:18:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
2014-08-19 13:16:00 +02:00
|
|
|
* @brief hoverEnterEvent handle hover enter events.
|
|
|
|
* @param event hover enter event.
|
2014-06-13 19:02:41 +02:00
|
|
|
*/
|
2014-08-19 13:16:00 +02:00
|
|
|
void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2015-03-19 12:13:13 +01:00
|
|
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
|
|
|
{
|
2017-08-01 13:35:48 +02:00
|
|
|
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
2015-03-19 12:13:13 +01:00
|
|
|
}
|
2018-01-01 15:16:50 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
setCursor(qApp->getSceneView()->viewport()->cursor());
|
|
|
|
}
|
|
|
|
|
2016-03-31 16:01:41 +02:00
|
|
|
this->setBrush(Qt::green);
|
2017-08-23 13:50:48 +02:00
|
|
|
|
2018-10-22 12:28:58 +02:00
|
|
|
QGraphicsItem *parent = parentItem();
|
|
|
|
if(parent && m_showParentTooltip)
|
2017-08-23 13:50:48 +02:00
|
|
|
{
|
|
|
|
setToolTip(parent->toolTip());
|
|
|
|
}
|
|
|
|
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsSimpleTextItem::hoverEnterEvent(event);
|
2013-07-28 00:18:06 +02:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief hoverLeaveEvent handle hover leave events.
|
|
|
|
* @param event hover leave event.
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
|
|
{
|
2019-05-08 14:19:03 +02:00
|
|
|
this->setBrush(m_baseColor);
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsSimpleTextItem::hoverLeaveEvent(event);
|
2013-07-28 00:18:06 +02:00
|
|
|
}
|
2014-01-09 13:51:09 +01:00
|
|
|
|
2014-05-02 13:11:30 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-06-13 19:02:41 +02:00
|
|
|
/**
|
|
|
|
* @brief contextMenuEvent handle context menu events.
|
|
|
|
* @param event context menu event.
|
|
|
|
*/
|
2014-01-09 13:51:09 +01:00
|
|
|
void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|
|
|
{
|
|
|
|
emit ShowContextMenu(event);
|
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|
|
|
{
|
2016-03-31 16:01:41 +02:00
|
|
|
// Special for not selectable item first need to call standard mousePressEvent then accept event
|
|
|
|
QGraphicsSimpleTextItem::mousePressEvent(event);
|
2016-05-24 11:43:30 +02:00
|
|
|
|
|
|
|
// Somehow clicking on notselectable object do not clean previous selections.
|
|
|
|
if (not (flags() & ItemIsSelectable) && scene())
|
|
|
|
{
|
|
|
|
scene()->clearSelection();
|
|
|
|
}
|
|
|
|
|
2015-03-19 12:13:13 +01:00
|
|
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
2014-08-19 13:16:00 +02:00
|
|
|
{
|
2015-03-19 12:13:13 +01:00
|
|
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
|
|
|
{
|
2017-08-01 13:35:48 +02:00
|
|
|
SetItemOverrideCursor(this, cursorArrowCloseHand, 1, 1);
|
2017-10-31 09:31:50 +01:00
|
|
|
event->accept();
|
2015-03-19 12:13:13 +01:00
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
}
|
2016-03-31 19:10:20 +02:00
|
|
|
if (selectionType == SelectionType::ByMouseRelease)
|
|
|
|
{
|
|
|
|
event->accept(); // This help for not selectable items still receive mouseReleaseEvent events
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-31 09:31:50 +01:00
|
|
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
|
|
|
{
|
|
|
|
emit PointChoosed();
|
|
|
|
event->accept();
|
|
|
|
}
|
2016-03-31 19:10:20 +02:00
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
|
|
{
|
2015-03-19 12:13:13 +01:00
|
|
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
2014-08-19 13:16:00 +02:00
|
|
|
{
|
2015-03-19 12:13:13 +01:00
|
|
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
|
|
|
{
|
2017-08-01 13:35:48 +02:00
|
|
|
SetItemOverrideCursor(this, cursorArrowOpenHand, 1, 1);
|
2015-03-19 12:13:13 +01:00
|
|
|
}
|
2014-08-19 13:16:00 +02:00
|
|
|
}
|
2016-02-11 12:05:08 +01:00
|
|
|
|
2017-10-31 09:31:50 +01:00
|
|
|
if (selectionType == SelectionType::ByMouseRelease && IsSelectedByReleaseEvent(this, event))
|
2016-03-31 19:10:20 +02:00
|
|
|
{
|
|
|
|
emit PointChoosed();
|
|
|
|
}
|
2016-03-31 16:01:41 +02:00
|
|
|
|
2014-08-19 13:16:00 +02:00
|
|
|
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
|
|
|
}
|
2014-10-24 20:17:23 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::keyReleaseEvent(QKeyEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->key())
|
|
|
|
{
|
|
|
|
case Qt::Key_Delete:
|
|
|
|
emit DeleteTool();
|
|
|
|
return; //Leave this method immediately after call!!!
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
QGraphicsSimpleTextItem::keyReleaseEvent ( event );
|
|
|
|
}
|
2017-10-28 12:02:51 +02:00
|
|
|
|
2019-05-08 14:19:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-05-11 17:37:08 +02:00
|
|
|
void VGraphicsSimpleTextItem::SetDestination(const QPointF &destination)
|
|
|
|
{
|
|
|
|
m_destination = destination;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2019-05-08 14:19:03 +02:00
|
|
|
QColor VGraphicsSimpleTextItem::BaseColor() const
|
|
|
|
{
|
|
|
|
return m_baseColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::SetBaseColor(const QColor &baseColor)
|
|
|
|
{
|
|
|
|
m_baseColor = baseColor;
|
|
|
|
setBrush(m_baseColor);
|
|
|
|
}
|
|
|
|
|
2017-10-28 12:02:51 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsSimpleTextItem::Init()
|
|
|
|
{
|
|
|
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
|
|
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
|
|
|
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
|
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
|
|
|
|
this->setAcceptHoverEvents(true);
|
|
|
|
QFont font = this->font();
|
2019-05-08 18:22:55 +02:00
|
|
|
font.setPointSize(qApp->Settings()->GetLabelFontSize());
|
|
|
|
setFont(font);
|
|
|
|
m_oldScale = minVisibleFontSize / qApp->Settings()->GetLabelFontSize();
|
2017-10-28 12:02:51 +02:00
|
|
|
setScale(m_oldScale);
|
|
|
|
}
|