Use visualization for highlighting tool.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-07 17:18:18 +02:00
parent ff5c6dbb17
commit aa7b2a4112
12 changed files with 26 additions and 43 deletions

View File

@ -74,7 +74,7 @@ void DialogHistory::DialogAccepted()
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
emit DialogClosed(QDialog::Accepted);
}
@ -103,12 +103,12 @@ void DialogHistory::cellClicked(int row, int column)
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
cursorToolRecordRow = row;
item = ui->tableWidget->item(cursorToolRecordRow, 0);
id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
emit ShowHistoryTool(id, true);
}
}
@ -434,7 +434,7 @@ void DialogHistory::ShowPoint()
cursorToolRecordRow = 0;
item = ui->tableWidget->item(0, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
emit ShowHistoryTool(id, true);
}
}
@ -466,6 +466,6 @@ void DialogHistory::closeEvent(QCloseEvent *event)
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
DialogTool::closeEvent(event);
}

View File

@ -63,10 +63,9 @@ signals:
/**
* @brief ShowHistoryTool signal change color of selected in records tool
* @param id id of tool
* @param color new color of tool
* @param enable true enable selection, false disable selection
*/
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
void ShowHistoryTool(quint32 id, bool enable);
protected:
virtual void closeEvent ( QCloseEvent * event );
private:

View File

@ -96,12 +96,11 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName)
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
void VAbstractSpline::ShowTool(quint32 id, bool enable)
{
ShowItem(this, id, color, enable);
ShowItem(this, id, enable);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -78,7 +78,7 @@ protected:
*/
virtual void RefreshGeometry ()=0;
virtual void ChangedActivDraw ( const QString &newName );
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ShowTool(quint32 id, bool enable);
virtual void SetFactor(qreal factor);
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );

View File

@ -64,13 +64,11 @@ VDrawTool::~VDrawTool()
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
void VDrawTool::ShowTool(quint32 id, bool enable)
{
Q_UNUSED(id);
Q_UNUSED(color);
Q_UNUSED(enable);
}

View File

@ -63,7 +63,7 @@ public:
virtual void SetLineColor(const QString &value);
public slots:
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ShowTool(quint32 id, bool enable);
virtual void ChangedActivDraw(const QString &newName) = 0;
void ChangedNameDraw(const QString &oldName, const QString &newName);
virtual void FullUpdateFromGuiOk(int result);
@ -161,24 +161,15 @@ protected:
* @brief ShowItem highlight tool.
* @param item tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void ShowItem(Item *item, quint32 id, Qt::GlobalColor color, bool enable)
void ShowItem(Item *item, quint32 id, bool enable)
{
SCASSERT(item != nullptr);
// if (id == item->id)
// {
// if (enable == false)
// {
// currentColor = baseColor;
// }
// else
// {
// currentColor = color;
// }
// item->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
// }
if (id == item->id)
{
ShowVisualization(enable);
}
}
private:
Q_DISABLE_COPY(VDrawTool)

View File

@ -211,12 +211,11 @@ void VToolLine::FullUpdateFromFile()
/**
* @brief ShowTool highlight tool.
* @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
void VToolLine::ShowTool(quint32 id, bool enable)
{
ShowItem(this, id, color, enable);
ShowItem(this, id, enable);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,7 +65,7 @@ public:
public slots:
virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName);
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ShowTool(quint32 id, bool enable);
virtual void SetFactor(qreal factor);
void Disable(bool disable);
protected:

View File

@ -139,12 +139,11 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
/**
* @brief ShowTool highlight tool.
* @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
void VToolPoint::ShowTool(quint32 id, bool enable)
{
ShowItem(this, id, color, enable);
ShowItem(this, id, enable);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ public:
public slots:
void NameChangePosition(const QPointF &pos);
virtual void ChangedActivDraw(const QString &newName);
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
virtual void ShowTool(quint32 id, bool enable);
virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
void Disable(bool disable);

View File

@ -857,12 +857,11 @@ void VPattern::haveLiteChange()
/**
* @brief ShowHistoryTool hightlight tool.
* @param id tool id.
* @param color hightlight color.
* @param enable enable or diasable hightlight.
*/
void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable)
void VPattern::ShowHistoryTool(quint32 id, bool enable)
{
emit ShowTool(id, color, enable);
emit ShowTool(id, enable);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -197,10 +197,9 @@ signals:
/**
* @brief ShowTool highlight tool.
* @param id tool id.
* @param color highlight color.
* @param enable enable or disable highlight.
*/
void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
void ShowTool(quint32 id, bool enable);
/**
* @brief ChangedCursor change cursor position.
* @param id tool id.
@ -214,7 +213,7 @@ signals:
public slots:
void LiteParseTree(const Document &parse);
void haveLiteChange();
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
void ShowHistoryTool(quint32 id, bool enable);
void NeedFullParsing();
void ClearScene();
protected: