improve commit 2954

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2956 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-04-02 16:57:13 +00:00
parent da5e6a61fe
commit 07eed05123

View File

@@ -22,6 +22,8 @@
//define the height of the header.
#define header 5
//define the widht of the cross
#define crossWidth 50
/**
* @brief CrossRefItem::CrossRefItem
@@ -209,7 +211,7 @@ void CrossRefItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
*/
void CrossRefItem::setUpBoundingRect(QPainter &painter) {
//this is the default size of cross ref item
QRectF default_bounding(0, 0, 50, 40);
QRectF default_bounding(0, 0, crossWidth, 40);
//No need to calcul if nothing is linked
if (!element_->isFree()) {
@@ -281,7 +283,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
}
painter.setFont(QETApp::diagramTextsFont(5));
qreal half_cross = bounding_rect_.width()/2;
qreal middle_cross = bounding_rect_.width()/2;
//fill the NO
QString contact_str;
foreach (Element *elmt, NO_list) {
@@ -290,7 +292,10 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
contact_str += "\n";
}
QRectF rect_(half_cross-26, header, half_cross, (bounding_rect_.height()-header));
QRectF rect_(middle_cross - (crossWidth/2),
header,
middle_cross,
(bounding_rect_.height()-header));
painter.drawText(rect_, Qt::AlignTop | Qt::AlignLeft, contact_str);
//fill the NC
@@ -301,8 +306,11 @@ void CrossRefItem::fillCrossRef(QPainter &painter) {
contact_str += elmt->diagram()->convertPosition(elmt -> scenePos()).toString();
contact_str += "\n";
}
rect_.setRect(half_cross+3 , header, half_cross+22, (bounding_rect_.height()-header));
painter.drawText(rect_, Qt::AlignTop | Qt::AlignLeft, contact_str);
rect_.setRect(middle_cross,
header,
crossWidth/2,
(bounding_rect_.height()-header));
painter.drawText(rect_, Qt::AlignTop | Qt::AlignRight, contact_str);
fillExtraInfo(painter);
}