53 #include <QGraphicsLinearLayout>
54 #include <QGraphicsProxyWidget>
55 #include <QGraphicsGridLayout>
57 #include "baseWidget.hh"
59 #include "functionDisplay.hh"
60 #include "elementFunction.hh"
64 #include "../parser/function.hh"
65 #include "../parser/element.hh"
67 #define BACKGROUND_RED 0x0
68 #define BACKGROUND_GREEN 0x0
69 #define BACKGROUND_BLUE 0x0
70 #define BACKGROUND_ALPHA 0xff
86 QGraphicsGridLayout *tL =
new QGraphicsGridLayout;
97 f->setBrush (Qt::black);
99 fn->setBackground (
true,
false);
100 fn->setBrush (Qt::black);
101 fn->setBackgroundBrush (Qt::white);
102 goBack->setBrush (Qt::black);
103 goBack->setBackgroundBrush (Qt::lightGray);
104 goBack->setBackground (
true,
true);
108 QFont font = f->font ();
114 tL->addItem (f, 0, 0, Qt::AlignVCenter | Qt::AlignLeft);
115 tL->addItem (fn, 0, 1, Qt::AlignVCenter | Qt::AlignLeft);
116 tL->addItem (goBack, 0, 2, Qt::AlignVCenter | Qt::AlignLeft);
121 Text *f =
new Text (tr(
"Main"),
this);
123 f->setBrush (Qt::black);
126 tL->addItem (f, 0, 0);
128 QFont font = f->font ();
133 tL->setHorizontalSpacing (1);
134 tL->setContentsMargins (3, 3, 3, 3);
137 setMinimumWidth (tL->preferredWidth());
152 int w = geometry().width();
153 int h = geometry().height();
155 _painter->setRenderHint(QPainter::Antialiasing,
true);
157 _painter->setBrush(QBrush(QColor(BACKGROUND_RED,
162 _painter->setPen(QColor(BACKGROUND_RED,
170 path.lineTo (w - 10, h);
171 path.arcTo (w - 20, h - 20, 20, 20, -90, 90);
174 _painter->drawPath (path);
180 _painter->setPen (Qt::NoPen);
182 lG.setStart (w - 5, 0);
183 lG.setFinalStop(w, 0);
184 lG.setColorAt(0, Qt::transparent);
185 lG.setColorAt(1, QColor (255, 255, 255, 128));
186 _painter->setBrush (lG);
187 _painter->drawRect (w - 5, 0, 5, h - 10);
189 lG.setStart (0, h - 5);
190 lG.setFinalStop (0, h);
191 _painter->setBrush (lG);
192 _painter->drawRect (0, h - 5, w - 10, 5);
194 path = QPainterPath ();
195 path.moveTo (w - 10, h);
196 path.arcTo (w - 20, h - 20, 20, 20, -90, 90);
197 path.lineTo (w - 10, h - 10);
198 path.lineTo (w - 10, h);
199 rG.setCenter (w - 10, h - 10);
200 rG.setFocalPoint(w -10, h - 10);
202 rG.setColorAt (0, Qt::transparent);
203 rG.setColorAt (0.5, Qt::transparent);
204 rG.setColorAt (1, QColor (255, 255, 255, 128));
205 _painter->setBrush (rG);
206 _painter->drawPath(path);
208 QGraphicsWidget::paint (_painter, _option, _widget);
void setBackground(bool _leftOut, bool _rightOut)
Enables background painting.
ElementFunction * function()
Associated function.
const QString & shortDescription() const
Short description.
static BaseWidget * getBaseWidget()
Returns singleton.
Element * element() const
Element that this function belongs to.
virtual void setBackgroundBrush(QBrush _brush)
Sets the background brush.
Function * function()
Function class.
const QString & shortDescription() const
Short description.
FunctionDisplay(GraphicsScene *_scene)
Constructor.
void paint(QPainter *_painter, const QStyleOptionGraphicsItem *_option, QWidget *_widget=0)
Paints the background.
~FunctionDisplay()
Destructor.