Changeset 8514:352a9d661f4e in orange


Ignore:
Timestamp:
07/28/11 15:31:24 (3 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
6cb68f52ed03b9debd1ff406e8e256b54d1f2991
Message:
 
Location:
source/orangeplot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/orangeplot/networkcurve.cpp

    r8512 r8514  
    2828 
    2929} 
    30 /* 
     30 
    3131void NodeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) 
    3232{ 
    33     Q_UNUSED(option) 
    34     Q_UNUSED(widget) 
    35  
    36     //painter->setClipRect(option->exposedRect); 
    37  
    38     if (is_selected()) { 
    39         painter->setPen(QPen(Qt::yellow, 3)); 
    40         painter->setBrush(color()); 
    41         QRectF rect(-(size() + 4) / 2, -(size() + 4) / 2, size() + 4, size() + 4); 
    42         painter->drawEllipse(rect); 
    43     } else if (is_marked()) { 
    44         painter->setPen(color()); 
    45         painter->setBrush(color()); 
    46         QRectF rect(-size() / 2, -size() / 2, size(), size()); 
    47         painter->drawEllipse(rect); 
    48     } else { 
    49         painter->setPen(color()); 
    50         painter->setBrush(Qt::white); 
    51         QRectF rect(-size() / 2, -size() / 2, size(), size()); 
    52         painter->drawEllipse(rect); 
    53     } 
    54 } 
    55 */ 
     33    Point::paint(painter, option, widget); 
     34 
     35    if (m_label.compare("") != 0) 
     36    { 
     37        QFontMetrics metrics = painter->fontMetrics(); 
     38        int th = metrics.height(); 
     39        int tw = metrics.width(m_label); 
     40        QRect r(-tw/2, 0, tw, th); 
     41        //painter->fillRect(r, QBrush(Qt::white)); 
     42        painter->drawText(r, Qt::AlignHCenter, m_label); 
     43    } 
     44} 
     45 
    5646void NodeItem::set_coordinates(double x, double y) 
    5747{ 
  • source/orangeplot/networkcurve.h

    r8512 r8514  
    1414    virtual ~NodeItem(); 
    1515 
    16     //virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); 
     16    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); 
    1717 
    1818    void set_coordinates(double x, double y); 
     
    145145    NetworkCurve(QGraphicsItem* parent = 0, QGraphicsScene* scene = 0); 
    146146    virtual ~NetworkCurve(); 
    147      
     147 
    148148    virtual void update_properties(); 
    149149    virtual QRectF data_rect() const; 
  • source/orangeplot/networkcurve.sip

    r8512 r8514  
    99    virtual ~NodeItem(); 
    1010     
    11     //virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); 
     11    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); 
    1212     
    1313    void set_coordinates(double x, double y); 
Note: See TracChangeset for help on using the changeset viewer.