QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
helpercell.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TITLEBLOCK_SLASH_HELPER_CELL_H
19#define TITLEBLOCK_SLASH_HELPER_CELL_H
20#include "../qet.h"
21
22#include <QtWidgets>
23
28class HelperCell : public QGraphicsObject, public QGraphicsLayoutItem {
29 Q_OBJECT
30 Q_INTERFACES(QGraphicsLayoutItem)
31
32 // constructor, destructor
33 public:
34 HelperCell(QGraphicsItem * = nullptr);
35 ~HelperCell() override;
36 private:
38
39 // attributes
40 public:
43 QString label;
44 Qt::Orientation orientation;
45 int index;
46
47 // methods
48 public:
49 void setGeometry(const QRectF &) override;
50 QSizeF sizeHint(Qt::SizeHint, const QSizeF & = QSizeF()) const override;
51 QRectF boundingRect() const override;
52 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = nullptr) override;
54 virtual void setActions(const QList<QAction *> &);
55 virtual QList<QAction *> actions() const;
56 virtual void setLabel(const QString &text, bool = true);
57
58 protected:
59 void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override;
60 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override;
61
62 signals:
65
66 private:
67 QList<QAction *> actions_;
68};
69#endif
Definition helpercell.h:28
HelperCell(const HelperCell &)
void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override
Definition helpercell.cpp:140
void contextMenuTriggered(HelperCell *)
int index
Index of this cell.
Definition helpercell.h:45
Qt::Orientation orientation
Orientation of this cell.
Definition helpercell.h:44
QRectF boundingRect() const override
Definition helpercell.cpp:69
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override
Definition helpercell.cpp:154
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
Definition helpercell.cpp:80
void setGeometry(const QRectF &) override
Definition helpercell.cpp:49
virtual QList< QAction * > actions() const
Definition helpercell.cpp:120
QList< QAction * > actions_
List of actions displayed by the context menu.
Definition helpercell.h:67
QSizeF sizeHint(Qt::SizeHint, const QSizeF &=QSizeF()) const override
Definition helpercell.cpp:60
virtual void setActions(const QList< QAction * > &)
Definition helpercell.cpp:113
void doubleClicked(HelperCell *)
~HelperCell() override
Definition helpercell.cpp:40
virtual void setType(QET::TitleBlockColumnLength)
Definition helpercell.cpp:97
QColor foreground_color
Text color when rendering this cell.
Definition helpercell.h:42
QString label
Label displayed in this cell.
Definition helpercell.h:43
QColor background_color
Background color when rendering this cell.
Definition helpercell.h:41
virtual void setLabel(const QString &text, bool=true)
Definition helpercell.cpp:129
TitleBlockColumnLength
enum used to specify the type of a length
Definition qet.h:141