47 #include <QGraphicsLinearLayout> 48 #include <QGraphicsProxyWidget> 49 #include <QGraphicsGridLayout> 51 #include "baseWidget.hh" 53 #include "functionDisplay.hh" 54 #include "elementFunction.hh" 58 #include "../parser/function.hh" 59 #include "../parser/element.hh" 61 #define BACKGROUND_RED 0x0 62 #define BACKGROUND_GREEN 0x0 63 #define BACKGROUND_BLUE 0x0 64 #define BACKGROUND_ALPHA 0xff 80 QGraphicsGridLayout *tL =
new QGraphicsGridLayout;
91 f->setBrush (Qt::black);
93 fn->setBackground (
true,
false);
94 fn->setBrush (Qt::black);
95 fn->setBackgroundBrush (Qt::white);
96 goBack->setBrush (Qt::black);
97 goBack->setBackgroundBrush (Qt::lightGray);
98 goBack->setBackground (
true,
true);
102 QFont font = f->font ();
108 tL->addItem (f, 0, 0, Qt::AlignVCenter | Qt::AlignLeft);
109 tL->addItem (fn, 0, 1, Qt::AlignVCenter | Qt::AlignLeft);
110 tL->addItem (goBack, 0, 2, Qt::AlignVCenter | Qt::AlignLeft);
115 Text *f =
new Text (tr(
"Main"),
this);
117 f->setBrush (Qt::black);
120 tL->addItem (f, 0, 0);
122 QFont font = f->font ();
127 tL->setHorizontalSpacing (1);
128 tL->setContentsMargins (3, 3, 3, 3);
131 setMinimumWidth (tL->preferredWidth());
146 int w = geometry().width();
147 int h = geometry().height();
149 _painter->setRenderHint(QPainter::Antialiasing,
true);
151 _painter->setBrush(QBrush(QColor(BACKGROUND_RED,
156 _painter->setPen(QColor(BACKGROUND_RED,
164 path.lineTo (w - 10, h);
165 path.arcTo (w - 20, h - 20, 20, 20, -90, 90);
168 _painter->drawPath (path);
174 _painter->setPen (Qt::NoPen);
176 lG.setStart (w - 5, 0);
177 lG.setFinalStop(w, 0);
178 lG.setColorAt(0, Qt::transparent);
179 lG.setColorAt(1, QColor (255, 255, 255, 128));
180 _painter->setBrush (lG);
181 _painter->drawRect (w - 5, 0, 5, h - 10);
183 lG.setStart (0, h - 5);
184 lG.setFinalStop (0, h);
185 _painter->setBrush (lG);
186 _painter->drawRect (0, h - 5, w - 10, 5);
188 path = QPainterPath ();
189 path.moveTo (w - 10, h);
190 path.arcTo (w - 20, h - 20, 20, 20, -90, 90);
191 path.lineTo (w - 10, h - 10);
192 path.lineTo (w - 10, h);
193 rG.setCenter (w - 10, h - 10);
194 rG.setFocalPoint(w -10, h - 10);
196 rG.setColorAt (0, Qt::transparent);
197 rG.setColorAt (0.5, Qt::transparent);
198 rG.setColorAt (1, QColor (255, 255, 255, 128));
199 _painter->setBrush (rG);
200 _painter->drawPath(path);
202 QGraphicsWidget::paint (_painter, _option, _widget);
const QString & shortDescription() const
Short description.
virtual void setBackgroundBrush(QBrush _brush)
Sets the background brush.
ElementFunction * function()
Associated function.
void setBackground(bool _leftOut, bool _rightOut)
Enables background painting.
Element * element() const
Element that this function belongs to.
static BaseWidget * getBaseWidget()
Returns singleton.
Function * function()
Function class.
void paint(QPainter *_painter, const QStyleOptionGraphicsItem *_option, QWidget *_widget=0)
Paints the background.
FunctionDisplay(GraphicsScene *_scene)
Constructor.
const QString & shortDescription() const
Short description.
~FunctionDisplay()
Destructor.