Skip to content

Commit

Permalink
#18. Исправлен margin для GraphNode
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexChernov committed Nov 16, 2014
1 parent 1083be0 commit 464546c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions app/rdo_studio/plugins/game5/src/graph_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ namespace

const double LEVEL_OF_LOW_DETAIL = 0.8;
const double LEVEL_OF_LOWER_DETAIL = 0.6;
const double WIDTH_MARGIN = 4;
const double HEIGHT_MARGIN = 4;
} // end anonymous namespace

GraphNode::GraphNode(const GraphNodeInfo& info, GraphNode* parentGraphNode, int width, int height)
: GraphNodeInfo (info )
, m_pParentGraphNode (parentGraphNode)
, m_graphOnLevelOrder(0 )
, m_isChecked (false )
, m_width (width )
, m_height (height )
: GraphNodeInfo (info)
, m_pParentGraphNode (parentGraphNode)
, m_graphOnLevelOrder(0)
, m_isChecked (false)
, m_width (width + WIDTH_MARGIN)
, m_height (height + HEIGHT_MARGIN)
{
setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges);
Expand All @@ -76,7 +78,7 @@ QRectF GraphNode::boundingRect() const
void GraphNode::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/)
{
QFont sceneFont = painter->font();
QRect nodeRect(-m_width / 2, -m_height / 2, m_width, m_height);
QRect nodeRect(-m_width / 2., -m_height / 2., m_width, m_height);
painter->setPen(QPen(Qt::black, 0));
if (m_isChecked)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ std::vector<GraphNodeInfo> PluginGame5GraphDialog::parseTrace(const std::vector<
const QRect nodeRectLV = fontMetrics.boundingRect(QRect(), Qt::AlignCenter, nodeTextLV);
const QRect nodeRectMV = fontMetrics.boundingRect(QRect(), Qt::AlignCenter, nodeTextMV);
const QRect nodeRectSV = fontMetrics.boundingRect(QRect(), Qt::AlignCenter, nodeTextSV);
m_nodeWidth = std::max(nodeRectLV.width() , std::max(nodeRectMV.width() , std::max(nodeRectSV.width() , m_nodeWidth ))) + 1;
m_nodeHeight = std::max(nodeRectLV.height(), std::max(nodeRectMV.height(), std::max(nodeRectSV.height(), m_nodeHeight))) + 1;
m_nodeWidth = std::max(nodeRectLV.width() , std::max(nodeRectMV.width() , std::max(nodeRectSV.width() , m_nodeWidth )));
m_nodeHeight = std::max(nodeRectLV.height(), std::max(nodeRectMV.height(), std::max(nodeRectSV.height(), m_nodeHeight)));
}

for (int nodeId: getSolutionNodes())
Expand Down

0 comments on commit 464546c

Please sign in to comment.