Verified Commit fdc0a09f authored by ita1024's avatar ita1024

Fix the text alignment on boundary objects

parent 4b6c77b1
...@@ -4,6 +4,8 @@ Semantik 1.2.1 ...@@ -4,6 +4,8 @@ Semantik 1.2.1
* Fix double prompts for overwriting files * Fix double prompts for overwriting files
* Fix invisible map variables immediately after opening a map * Fix invisible map variables immediately after opening a map
* Fix the tab navigation on the document generator dialog * Fix the tab navigation on the document generator dialog
* Fix the text alignment on boundary objects (diagrams)
* Enable newlines on most diagram objects #89
* Add global settings for commands to execute after a template is called * Add global settings for commands to execute after a template is called
Semantik 1.2.0 Semantik 1.2.0
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <QFont> #include <QFont>
#define PAD 2
#define MIN_FORK_SIZE 30 #define MIN_FORK_SIZE 30
box_frame::box_frame(box_view* view, int id) : box_item(view, id) box_frame::box_frame(box_view* view, int id) : box_item(view, id)
...@@ -54,11 +55,31 @@ void box_frame::update_links() ...@@ -54,11 +55,31 @@ void box_frame::update_links()
m_oCaption->setPlainText(m_oBox->m_sText); m_oCaption->setPlainText(m_oBox->m_sText);
QRectF l_oR = boundingRect(); QRectF l_oR = boundingRect();
if (m_oBox->m_iLabelPosition == Qt::TopEdge) m_oCaption->setPos((l_oR.width() - m_oCaption->boundingRect().width()) / 2., 0); int l_iVpos;
if (m_oBox->m_iLabelPosition == Qt::TopEdge)
{
l_iVpos = 0;
}
else else
{ {
m_oCaption->setPos((l_oR.width() - m_oCaption->boundingRect().width()) / 2., l_oR.height() - m_oCaption->boundingRect().height()); l_iVpos = l_oR.height() - m_oCaption->boundingRect().height();
}
int l_iHpos;
if (m_oBox->m_iAlign == Qt::AlignLeft)
{
l_iHpos = l_oR.left() + PAD;
} }
else if (m_oBox->m_iAlign == Qt::AlignRight)
{
l_iHpos = l_oR.right() - m_oCaption->boundingRect().width() - PAD;
}
else
{
l_iHpos = (l_oR.width() - m_oCaption->boundingRect().width()) / 2.;
}
m_oCaption->setPos(l_iHpos, l_iVpos);
box_item::update_links(); box_item::update_links();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment