Skip to content

Commit

Permalink
Add highlight bounding rectangle on hover to MultiStepRangesBackgroun…
Browse files Browse the repository at this point in the history
…d item #422
  • Loading branch information
trevorsandy committed Sep 20, 2020
1 parent e63db0e commit a46f4fe
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/PKGBUILD
Expand Up @@ -2,7 +2,7 @@
# Last Update: July 23, 2019
# Copyright (c) 2017 - 2019 by Trevor SANDY
pkgname=lpub3d
pkgver=2.4.0.1687
pkgver=2.4.0.1688
pkgrel=1
pkgdesc="An LDraw Building Instruction Editor"
url="https://github.com/trevorsandy/lpub3d.git"
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/alldeps/debian/changelog
@@ -1,5 +1,5 @@
lpub3d (2.4.0.1687) debian; urgency=medium
lpub3d (2.4.0.1688) debian; urgency=medium

* LPub3D version 2.4.0.1.1687_20200920 for Linux
* LPub3D version 2.4.0.1.1688_20200920 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Sun, 20 Sep 2020 09:20:57 +0200
-- Trevor SANDY <trevor.sandy@gmail.com> Sun, 20 Sep 2020 09:21:36 +0200
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/debian/lpub3d.dsc
Expand Up @@ -2,7 +2,7 @@ Format: 1.0
Source: lpub3d
Binary: lpub3d
Architecture: any
Version: 2.4.0.1687
Version: 2.4.0.1688
Maintainer: Trevor SANDY <trevor.sandy@gmail.com>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
4 changes: 2 additions & 2 deletions builds/linux/obs/alldeps/lpub3d.spec
Expand Up @@ -116,7 +116,7 @@ BuildRequires: fdupes
Summary: An LDraw Building Instruction Editor
Name: lpub3d
Icon: lpub3d.xpm
Version: 2.4.0.1687
Version: 2.4.0.1688
Release: <B_CNT>%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -728,5 +728,5 @@ update-mime-database /usr/share/mime >/dev/null || true
update-desktop-database || true
%endif

* Sun Sep 20 2020 - trevor.dot.sandy.at.gmail.dot.com 2.4.0.1687
* Sun Sep 20 2020 - trevor.dot.sandy.at.gmail.dot.com 2.4.0.1688
- LPub3D Linux package (rpm) release
Binary file modified builds/utilities/ci/secure/.secrets.tar.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion builds/utilities/version.info
@@ -1 +1 @@
2 4 0 1 1687 915e26e
2 4 0 1 1688 e63db0e
2 changes: 1 addition & 1 deletion mainApp/docs/README.txt
@@ -1,4 +1,4 @@
LPub3D 2.4.0.1.1687 (20 09 2020 09:20:57)
LPub3D 2.4.0.1.1688 (20 09 2020 09:21:36)

Features, enhancements, fixes and changes
------------
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/RELEASE_NOTES.html
Expand Up @@ -9,7 +9,7 @@
<table class="tg">
<tr>
<th class="tg-0pky">
<h4><a id="LPub3D_0"></a>LPub3D 2.4.0.1.1687 (20 09 2020 09:20:57)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.4.0.1.1688 (20 09 2020 09:21:36)</h4>
<hr>
<p>
LPub3D Continuous release.<br>
Expand Down
2 changes: 1 addition & 1 deletion mainApp/org.trevorsandy.lpub3d.appdata.xml
Expand Up @@ -68,7 +68,7 @@
<binary>lpub3d24</binary>
​</provides>
<releases>
<release version="2.4.0.1687" date="2020-09-20">
<release version="2.4.0.1688" date="2020-09-20">
<description>
<p>LPub3D Linux AppImage package</p>
</description>
Expand Down
32 changes: 31 additions & 1 deletion mainApp/ranges_item.cpp
Expand Up @@ -38,7 +38,9 @@ MultiStepRangesBackgroundItem::MultiStepRangesBackgroundItem(
Steps *_steps,
QRectF rect,
QGraphicsItem *parent,
Meta *_meta)
Meta *_meta):
isHovered(false),
mouseIsDown(false)
{
meta = _meta;
//page = dynamic_cast<Page *>(_steps);
Expand All @@ -49,6 +51,8 @@ MultiStepRangesBackgroundItem::MultiStepRangesBackgroundItem(
setParentItem(parent);
setToolTip("Steps Group - right-click to modify");
setFlag(QGraphicsItem::ItemIsSelectable,true);
setFlag(QGraphicsItem::ItemIsFocusable, true);
setAcceptHoverEvents(true);
setFlag(QGraphicsItem::ItemIsMovable,true);
setData(ObjectId, MultiStepsBackgroundObj);
setZValue(MULTISTEPSBACKGROUND_ZVALUE_DEFAULT);
Expand All @@ -57,6 +61,7 @@ MultiStepRangesBackgroundItem::MultiStepRangesBackgroundItem(
void MultiStepRangesBackgroundItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsItem::mousePressEvent(event);
mouseIsDown = true;
positionChanged = false;
position = pos();
}
Expand All @@ -69,6 +74,7 @@ void MultiStepRangesBackgroundItem::mouseMoveEvent(QGraphicsSceneMouseEvent *eve

void MultiStepRangesBackgroundItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
mouseIsDown = false;
QGraphicsItem::mouseReleaseEvent(event);

if (isSelected() && (flags() & QGraphicsItem::ItemIsMovable) && positionChanged) {
Expand All @@ -84,6 +90,30 @@ void MultiStepRangesBackgroundItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *
}
}

void MultiStepRangesBackgroundItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
isHovered = !this->isSelected() && !mouseIsDown;
QGraphicsItem::hoverEnterEvent(event);
}

void MultiStepRangesBackgroundItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
isHovered = false;
QGraphicsItem::hoverLeaveEvent(event);
}

void MultiStepRangesBackgroundItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen pen;
pen.setColor(isHovered ? QColor(Preferences::sceneGuideColor) : Qt::black);
pen.setWidth(0/*cosmetic*/);
pen.setStyle(isHovered ? Qt::PenStyle(Preferences::sceneGuidesLine) : Qt::NoPen);
painter->setPen(pen);
painter->setBrush(Qt::transparent);
painter->drawRect(this->boundingRect());
QGraphicsRectItem::paint(painter,option,widget);
}

MultiStepRangeBackgroundItem::MultiStepRangeBackgroundItem(
Steps *_steps,
Range *_range,
Expand Down
5 changes: 5 additions & 0 deletions mainApp/ranges_item.h
Expand Up @@ -54,6 +54,11 @@ class MultiStepRangesBackgroundItem : public QGraphicsRectItem, public MetaItem
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
bool isHovered;
bool mouseIsDown;
};

class Range;
Expand Down

0 comments on commit a46f4fe

Please sign in to comment.