Add Indicator for PositionLocked state
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGCustomImage::QGCustomImage()
|
||||
QGCustomImage::QGCustomImage()
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setAcceptHoverEvents(false);
|
||||
@@ -74,6 +74,12 @@ bool QGCustomImage::load(QString fileSpec)
|
||||
return(success);
|
||||
}
|
||||
|
||||
QSize QGCustomImage::imageSize(void)
|
||||
{
|
||||
QSize result = m_px.size();
|
||||
return result;
|
||||
}
|
||||
|
||||
void QGCustomImage::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QPointF>
|
||||
#include <QSize>
|
||||
#include <QByteArray>
|
||||
#include <QPixmap>
|
||||
|
||||
@@ -52,6 +53,7 @@ public:
|
||||
virtual void centerAt(QPointF centerPos);
|
||||
virtual void centerAt(double cX, double cY);
|
||||
virtual bool load(QString fileSpec);
|
||||
virtual QSize imageSize(void);
|
||||
|
||||
protected:
|
||||
QPixmap m_px;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "QGCustomText.h"
|
||||
#include "QGICaption.h"
|
||||
#include "QGCustomClip.h"
|
||||
#include "QGCustomImage.h"
|
||||
#include "QGIViewClip.h"
|
||||
#include "ViewProviderDrawingView.h"
|
||||
#include "MDIViewPage.h"
|
||||
@@ -106,6 +107,13 @@ QGIView::QGIView()
|
||||
addToGroup(m_border);
|
||||
m_caption = new QGICaption();
|
||||
addToGroup(m_caption);
|
||||
m_lock = new QGCustomImage();
|
||||
m_lock->setParentItem(m_label);
|
||||
m_lock->load(QString::fromUtf8(":/icons/techdraw-lock.png"));
|
||||
QSize sizeLock = m_lock->imageSize();
|
||||
m_lockWidth = (double) sizeLock.width();
|
||||
m_lockHeight = (double) sizeLock.height();
|
||||
m_lock->hide();
|
||||
|
||||
isVisible(true);
|
||||
}
|
||||
@@ -393,12 +401,18 @@ void QGIView::drawCaption()
|
||||
|
||||
void QGIView::drawBorder()
|
||||
{
|
||||
auto feat = getViewObject();
|
||||
if (feat == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawCaption();
|
||||
//show neither
|
||||
auto vp = static_cast<ViewProviderDrawingView*>(getViewProvider(getViewObject()));
|
||||
if (!borderVisible && !vp->KeepLabel.getValue()) {
|
||||
m_label->hide();
|
||||
m_border->hide();
|
||||
m_lock->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -406,6 +420,7 @@ void QGIView::drawBorder()
|
||||
//double margin = 2.0;
|
||||
m_label->hide();
|
||||
m_border->hide();
|
||||
m_lock->hide();
|
||||
|
||||
m_label->setDefaultTextColor(m_colCurrent);
|
||||
m_font.setFamily(getPrefFont());
|
||||
@@ -439,6 +454,17 @@ void QGIView::drawBorder()
|
||||
displayArea.top(),
|
||||
frameWidth,
|
||||
frameHeight);
|
||||
|
||||
double lockX = labelArea.left();
|
||||
double lockY = labelArea.bottom() - (2 * m_lockHeight);
|
||||
if (feat->isLocked()) {
|
||||
m_lock->setZValue(ZVALUE::LOCK);
|
||||
m_lock->setPos(lockX,lockY);
|
||||
m_lock->show();
|
||||
} else {
|
||||
m_lock->hide();
|
||||
}
|
||||
|
||||
prepareGeometryChange();
|
||||
m_border->setRect(frameArea.adjusted(-2,-2,2,2));
|
||||
m_border->setPos(0.,0.);
|
||||
|
||||
@@ -47,6 +47,7 @@ class QGCustomText;
|
||||
class QGICaption;
|
||||
class MDIViewPage;
|
||||
class QGIViewClip;
|
||||
class QGCustomImage;
|
||||
|
||||
class TechDrawGuiExport QGIView : public QGraphicsItemGroup
|
||||
{
|
||||
@@ -141,7 +142,11 @@ protected:
|
||||
QGCustomLabel* m_label;
|
||||
QGCustomBorder* m_border;
|
||||
QGICaption* m_caption;
|
||||
QGCustomImage* m_lock;
|
||||
QPen m_decorPen;
|
||||
double m_lockWidth;
|
||||
double m_lockHeight;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<file>icons/arrow-down.svg</file>
|
||||
<file>icons/arrow-ccw.svg</file>
|
||||
<file>icons/arrow-cw.svg</file>
|
||||
<file>icons/techdraw-lock.png</file>
|
||||
<file>translations/TechDraw_af.qm</file>
|
||||
<file>translations/TechDraw_zh-CN.qm</file>
|
||||
<file>translations/TechDraw_zh-TW.qm</file>
|
||||
|
||||
BIN
src/Mod/TechDraw/Gui/Resources/icons/techdraw-lock.png
Normal file
BIN
src/Mod/TechDraw/Gui/Resources/icons/techdraw-lock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -17,5 +17,6 @@ namespace ZVALUE {
|
||||
const int SECTIONLINE = 80; //TODO: change to "DECORATION"? section lines, symmetry lines, etc?
|
||||
const int HIGHLIGHT = 80;
|
||||
const int MATTING = 100;
|
||||
const int LOCK = 200;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user