Fixed moving labels and added warning icon to detail dialog when detail name is empty

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-08 00:46:33 +02:00
parent 5aa75f2aff
commit 6e1dce0cd7
2 changed files with 12 additions and 3 deletions

View File

@ -257,11 +257,15 @@ void DialogDetail::NameDetailChanged()
{ {
flagName = false; flagName = false;
ChangeColor(labelEditNamePoint, Qt::red); ChangeColor(labelEditNamePoint, Qt::red);
QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png");
ui.tabWidget->setTabIcon(1, icon);
} }
else else
{ {
flagName = true; flagName = true;
ChangeColor(labelEditNamePoint, okColor); ChangeColor(labelEditNamePoint, okColor);
QIcon icon;
ui.tabWidget->setTabIcon(1, icon);
} }
} }
CheckState(); CheckState();

View File

@ -242,11 +242,16 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
QPointF pt = m_ptStartPos + ptDiff; QPointF pt = m_ptStartPos + ptDiff;
pt.setX(pt.x() + m_rectBoundingBox.width()/2); pt.setX(pt.x() + m_rectBoundingBox.width()/2);
pt.setY(pt.y() + m_rectBoundingBox.height()/2); pt.setY(pt.y() + m_rectBoundingBox.height()/2);
if (parentItem()->boundingRect().contains(pt) == true) QRectF rectBB = parentItem()->boundingRect();
if (rectBB.contains(pt) == false)
{ {
setPos(m_ptStartPos + ptDiff); pt.setX(qMin(rectBB.right(), qMax(pt.x(), rectBB.left())));
UpdateBox(); pt.setY(qMin(rectBB.bottom(), qMax(pt.y(), rectBB.top())));
} }
pt.setX(pt.x() - m_rectBoundingBox.width()/2);
pt.setY(pt.y() - m_rectBoundingBox.height()/2);
setPos(pt);
UpdateBox();
} }
else if (m_eMode == mResize) else if (m_eMode == mResize)
{ {