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); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false); emit ShowHistoryTool(id, false);
emit DialogClosed(QDialog::Accepted); emit DialogClosed(QDialog::Accepted);
} }
@ -103,12 +103,12 @@ void DialogHistory::cellClicked(int row, int column)
{ {
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false); emit ShowHistoryTool(id, false);
cursorToolRecordRow = row; cursorToolRecordRow = row;
item = ui->tableWidget->item(cursorToolRecordRow, 0); item = ui->tableWidget->item(cursorToolRecordRow, 0);
id = qvariant_cast<quint32>(item->data(Qt::UserRole)); 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; cursorToolRecordRow = 0;
item = ui->tableWidget->item(0, 0); item = ui->tableWidget->item(0, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); 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); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false); emit ShowHistoryTool(id, false);
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }

View File

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

View File

@ -96,12 +96,11 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName)
/** /**
* @brief ShowTool highlight tool. * @brief ShowTool highlight tool.
* @param id object id in container * @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight. * @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 RefreshGeometry ()=0;
virtual void ChangedActivDraw ( const QString &newName ); 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 SetFactor(qreal factor);
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );

View File

@ -64,13 +64,11 @@ VDrawTool::~VDrawTool()
/** /**
* @brief ShowTool highlight tool. * @brief ShowTool highlight tool.
* @param id object id in container. * @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight. * @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(id);
Q_UNUSED(color);
Q_UNUSED(enable); Q_UNUSED(enable);
} }

View File

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

View File

@ -211,12 +211,11 @@ void VToolLine::FullUpdateFromFile()
/** /**
* @brief ShowTool highlight tool. * @brief ShowTool highlight tool.
* @param id object id in container * @param id object id in container
* @param color highlight color.
* @param enable enable or disable highlight. * @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: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName); 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 SetFactor(qreal factor);
void Disable(bool disable); void Disable(bool disable);
protected: protected:

View File

@ -139,12 +139,11 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
/** /**
* @brief ShowTool highlight tool. * @brief ShowTool highlight tool.
* @param id object id in container. * @param id object id in container.
* @param color highlight color.
* @param enable enable or disable highlight. * @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: public slots:
void NameChangePosition(const QPointF &pos); void NameChangePosition(const QPointF &pos);
virtual void ChangedActivDraw(const QString &newName); 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 SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
void Disable(bool disable); void Disable(bool disable);

View File

@ -857,12 +857,11 @@ void VPattern::haveLiteChange()
/** /**
* @brief ShowHistoryTool hightlight tool. * @brief ShowHistoryTool hightlight tool.
* @param id tool id. * @param id tool id.
* @param color hightlight color.
* @param enable enable or diasable hightlight. * @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. * @brief ShowTool highlight tool.
* @param id tool id. * @param id tool id.
* @param color highlight color.
* @param enable enable or disable highlight. * @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. * @brief ChangedCursor change cursor position.
* @param id tool id. * @param id tool id.
@ -214,7 +213,7 @@ signals:
public slots: public slots:
void LiteParseTree(const Document &parse); void LiteParseTree(const Document &parse);
void haveLiteChange(); void haveLiteChange();
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable); void ShowHistoryTool(quint32 id, bool enable);
void NeedFullParsing(); void NeedFullParsing();
void ClearScene(); void ClearScene();
protected: protected: