201    const QPointF& from, 
const QPointF& to )
 const 
  213    switch ( m_data->style )
 
  218            if ( m_data->width > pw )
 
  220                if ( ( orientation == Qt::Horizontal )
 
  221                    && ( p1.y() == p2.y() ) )
 
  223                    const double sw = m_data->width;
 
  225                    const double y = p1.y() - sw / 2;
 
  227                        p1.x(), y, p1.x(), y + sw );
 
  229                        p2.x(), y, p2.x(), y + sw );
 
  231                else if ( ( orientation == Qt::Vertical )
 
  232                    && ( p1.x() == p2.x() ) )
 
  234                    const double sw = m_data->width;
 
  236                    const double x = p1.x() - sw / 2;
 
  238                        x, p1.y(), x + sw, p1.y() );
 
  240                        x, p2.y(), x + sw, p2.y() );
 
  244                    const double sw = m_data->width;
 
  246                    const double dx = p2.x() - p1.x();
 
  247                    const double dy = p2.y() - p1.y();
 
  248                    const double angle = std::atan2( dy, dx ) + M_PI_2;
 
  249                    double dw2 = sw / 2.0;
 
  251                    const double cx = qFastCos( angle ) * dw2;
 
  252                    const double sy = qFastSin( angle ) * dw2;
 
  255                        p1.x() - cx, p1.y() - sy,
 
  256                        p1.x() + cx, p1.y() + sy );
 
  258                        p2.x() - cx, p2.y() - sy,
 
  259                        p2.x() + cx, p2.y() + sy );
 
  266            if ( m_data->width <= pw )
 
  272                if ( ( orientation == Qt::Horizontal )
 
  273                    && ( p1.y() == p2.y() ) )
 
  275                    const double sw = m_data->width;
 
  277                    const double y = p1.y() - m_data->width / 2;
 
  279                        p1.x(), y, p2.x() - p1.x(),  sw );
 
  281                else if ( ( orientation == Qt::Vertical )
 
  282                    && ( p1.x() == p2.x() ) )
 
  284                    const double sw = m_data->width;
 
  286                    const double x = p1.x() - m_data->width / 2;
 
  288                        x, p1.y(), sw, p2.y() - p1.y() );
 
  292                    const double sw = m_data->width;
 
  294                    const double dx = p2.x() - p1.x();
 
  295                    const double dy = p2.y() - p1.y();
 
  296                    const double angle = std::atan2( dy, dx ) + M_PI_2;
 
  297                    double dw2 = sw / 2.0;
 
  299                    const double cx = qFastCos( angle ) * dw2;
 
  300                    const double sy = qFastSin( angle ) * dw2;
 
  303                    polygon += QPointF( p1.x() - cx, p1.y() - sy );
 
  304                    polygon += QPointF( p1.x() + cx, p1.y() + sy );
 
  305                    polygon += QPointF( p2.x() + cx, p2.y() + sy );
 
  306                    polygon += QPointF( p2.x() - cx, p2.y() - sy );
 
 
static void drawRect(QPainter *, qreal x, qreal y, qreal w, qreal h)
Wrapper for QPainter::drawRect()
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()