NCL Composer  0.1.5
 All Classes Functions Variables Pages
qnstgraphicsarea.cpp
1 #include "qnstgraphicsarea.h"
2 
3 QnstGraphicsArea::QnstGraphicsArea(QnstGraphicsEntity* parent)
4  : QnstGraphicsInterface(parent)
5 {
6  setnstType(Qnst::Area);
7 
8  setnstId("");
9 }
10 
11 QnstGraphicsArea::~QnstGraphicsArea()
12 {
13 
14 }
15 
16 void QnstGraphicsArea::draw(QPainter* painter)
17 {
18  QColor bg;
19  QColor border;
20 
21  if (isRefer())
22  {
23  bg = QColor(244,164,96,75);
24 // border = QColor(238,238,238);
25  border = QColor(153,153,153, 75);
26  }
27  else
28  {
29  bg = QColor(244,164,96);
30  border = QColor(153,153,153);
31  }
32  painter->setBrush(QBrush(bg));
33  painter->setPen(QPen(QBrush(border), 0, Qt::SolidLine));
34 
35  painter->drawRect(4 + 8/2, 4 + 8/2, getWidth()-8, getHeight()-8);
36 
37  // Draw MouseOver rectangle
38  if (!isSelected() && hasMouseHover())
39  {
40  painter->setBrush(Qt::NoBrush);
41  painter->setPen(QPen(QBrush("#999999"), 0, Qt::DashLine)); // 0px = cosmetic border
42 
43  painter->drawRect(4, 4, getWidth(), getHeight());
44  }
45 
46  if (isMoving())
47  {
48  painter->setBrush(Qt::NoBrush);
49  painter->setPen(QPen(QBrush(Qt::black), 0)); // 0px = cosmetic border
50 
51  painter->drawRect(getMoveLeft()+4-getLeft(),
52  getMoveTop()+4-getTop(),
53  getWidth()-1,
54  getHeight()-1);
55  }
56 }
57 
58 void QnstGraphicsArea::delineate(QPainterPath* painter) const
59 {
60  painter->addRect(4, 4, getWidth(), getHeight());
61 }