25 QGraphicsObject(parent),
26 QGraphicsLayoutItem(),
27 background_color(Qt::white),
28 foreground_color(Qt::black),
33 setGraphicsItem(
this);
34 setFlag(QGraphicsItem::ItemIsSelectable,
false);
49 prepareGeometryChange();
50 QGraphicsLayoutItem::setGeometry(g);
68 return QRectF(QPointF(0,0), geometry().size());
77 void HelperCell::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget) {
81 QRectF drawing_rectangle(QPointF(0, 0), geometry().size());
83 painter -> setPen(Qt::black);
85 painter -> drawRect(drawing_rectangle);
88 painter -> drawText(drawing_rectangle, Qt::AlignHCenter | Qt::AlignVCenter,
label);
127 if (set_as_tooltip) {
140 foreach (QAction *action,
actions_) {
141 context_menu.addAction(action);
144 context_menu.exec(event -> screenPos());
the length is just a fraction of the length that is still available when other types of lengths have ...
QSizeF sizeHint(Qt::SizeHint, const QSizeF &=QSizeF()) const override
the length is absolute and should be applied as is
TitleBlockColumnLength
enum used to specify the type of a length
void contextMenuTriggered(HelperCell *)
QColor background_color
Background color when rendering this cell.
virtual QList< QAction * > actions() const
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override
QRectF boundingRect() const override
virtual void setActions(const QList< QAction *> &)
virtual void setType(QET::TitleBlockColumnLength)
the length is just a fraction of the total available length
QColor foreground_color
Text color when rendering this cell.
virtual void setLabel(const QString &text, bool=true)
HelperCell(QGraphicsItem *=nullptr)
void doubleClicked(HelperCell *)
void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override
void setGeometry(const QRectF &) override
QString label
Label displayed in this cell.
QList< QAction * > actions_
List of actions displayed by the context menu.