Back to index

salome-gui  6.5.0
Functions
QtxRubberBand.cxx File Reference
#include "QtxRubberBand.h"
#include <QBitmap>
#include <QImage>
#include <QPaintEvent>
#include <QPainter>
#include <QPalette>
#include <QShowEvent>
#include <QVectorIterator>

Go to the source code of this file.

Functions

QRegion createRegion (const QPointF &p1, const QPointF &p2)

Function Documentation

QRegion createRegion ( const QPointF &  p1,
const QPointF &  p2 
)

Definition at line 171 of file QtxRubberBand.cxx.

{
  if ( p1 == p2 )
    return QRegion();

  QLineF n = QLineF( p1, p2 ).normalVector();//.unitVector();
  n.setLength( 1 );
  n.translate( p1 * -1 );
  QPointF nPoint = n.p2();

  QPolygonF p;
  p << p1 + nPoint << p2 + nPoint << p2 - nPoint << p1 - nPoint << p1 + nPoint;

  return QRegion( p.toPolygon() );
}