Changeset 8570:d29f7d40ee3d in orange


Ignore:
Timestamp:
08/02/11 12:19:29 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
30a68bda71e98a33341985bdc5b4d2095e0b0b4a
Message:

Curve subclasses can see what needs to be updated.

Location:
source/orangeplot
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/orangeplot/curve.cpp

    r8569 r8570  
    355355} 
    356356 
     357Curve::UpdateFlags Curve::needs_update() 
     358{ 
     359    return m_needsUpdate; 
     360} 
     361 
     362void Curve::set_updated(Curve::UpdateFlags flags) 
     363{ 
     364    m_needsUpdate &= ~flags; 
     365} 
     366 
     367 
     368 
  • source/orangeplot/curve.h

    r8569 r8570  
    188188protected: 
    189189  QTransform point_transform(); 
     190  Curve::UpdateFlags needs_update(); 
     191  void set_updated(Curve::UpdateFlags flags); 
    190192   
    191193private: 
     
    225227} 
    226228 
     229Q_DECLARE_OPERATORS_FOR_FLAGS(Curve::UpdateFlags) 
     230 
    227231 
    228232#endif // CURVE_H 
  • source/orangeplot/curve.sip

    r8569 r8570  
    123123protected: 
    124124  QTransform point_transform(); 
     125  void set_updated(Curve::UpdateFlags flags); 
     126  Curve::UpdateFlags needs_update(); 
    125127   
    126128}; 
  • source/orangeplot/unconnectedlinescurve.cpp

    r8525 r8570  
    3333    } 
    3434    Q_ASSERT(m_items.size() == n); 
    35     QLineF line; 
    36     QPen p = pen(); 
    37     p.setCosmetic(true); 
    38     for (int i = 0; i < n; ++i) 
     35    if (needs_update() & (UpdatePosition | UpdatePen) ) 
    3936    { 
    40         line.setLine( d[2*i].x, d[2*i].y, d[2*i+1].x, d[2*i+1].y ); 
    41         m_items[i]->setLine(graph_transform().map(line)); 
    42         m_items[i]->setPen(p); 
     37        QLineF line; 
     38        QPen p = pen(); 
     39        p.setCosmetic(true); 
     40        for (int i = 0; i < n; ++i) 
     41        { 
     42            line.setLine( d[2*i].x, d[2*i].y, d[2*i+1].x, d[2*i+1].y ); 
     43            m_items[i]->setLine(graph_transform().map(line)); 
     44            m_items[i]->setPen(p); 
     45        } 
     46        set_updated(UpdatePosition | UpdatePen); 
    4347    } 
    4448} 
Note: See TracChangeset for help on using the changeset viewer.