QElectroTech  0.8-dev
helpercell.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 <QtWidgets>
21 #include "qet.h"
22 
27 class HelperCell : public QGraphicsObject, public QGraphicsLayoutItem {
28  Q_OBJECT
29  Q_INTERFACES(QGraphicsLayoutItem)
30 
31  // constructor, destructor
32  public:
33  HelperCell(QGraphicsItem * = nullptr);
34  ~HelperCell() override;
35  private:
37 
38  // attributes
39  public:
42  QString label;
43  Qt::Orientation orientation;
44  int index;
45 
46  // methods
47  public:
48  void setGeometry(const QRectF &) override;
49  QSizeF sizeHint(Qt::SizeHint, const QSizeF & = QSizeF()) const override;
50  QRectF boundingRect() const override;
51  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = nullptr) override;
53  virtual void setActions(const QList<QAction *> &);
54  virtual QList<QAction *> actions() const;
55  virtual void setLabel(const QString &text, bool = true);
56 
57  protected:
58  void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override;
59  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override;
60 
61  signals:
64 
65  private:
66  QList<QAction *> actions_;
67 };
68 #endif
QET::RelativeToTotalLength
@ RelativeToTotalLength
the length is just a fraction of the total available length
Definition: qet.h:147
HelperCell::actions
virtual QList< QAction * > actions() const
Definition: helpercell.cpp:117
HelperCell::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override
Definition: helpercell.cpp:150
HelperCell
Definition: helpercell.h:27
HelperCell::background_color
QColor background_color
Background color when rendering this cell.
Definition: helpercell.h:40
QET::TitleBlockColumnLength
TitleBlockColumnLength
enum used to specify the type of a length
Definition: qet.h:145
HelperCell::paint
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *=nullptr) override
Definition: helpercell.cpp:77
HelperCell::doubleClicked
void doubleClicked(HelperCell *)
HelperCell::HelperCell
HelperCell(QGraphicsItem *=nullptr)
Definition: helpercell.cpp:24
HelperCell::HelperCell
HelperCell(const HelperCell &)
HelperCell::~HelperCell
~HelperCell() override
Definition: helpercell.cpp:40
qet.h
QET::Absolute
@ Absolute
the length is absolute and should be applied as is
Definition: qet.h:146
HelperCell::contextMenuEvent
void contextMenuEvent(QGraphicsSceneContextMenuEvent *) override
Definition: helpercell.cpp:136
HelperCell::actions_
QList< QAction * > actions_
List of actions displayed by the context menu.
Definition: helpercell.h:66
HelperCell::setGeometry
void setGeometry(const QRectF &) override
Definition: helpercell.cpp:48
HelperCell::boundingRect
QRectF boundingRect() const override
Definition: helpercell.cpp:67
HelperCell::label
QString label
Label displayed in this cell.
Definition: helpercell.h:42
helpercell.h
HelperCell::setActions
virtual void setActions(const QList< QAction * > &)
Definition: helpercell.cpp:110
HelperCell::foreground_color
QColor foreground_color
Text color when rendering this cell.
Definition: helpercell.h:41
HelperCell::setLabel
virtual void setLabel(const QString &text, bool=true)
Definition: helpercell.cpp:125
HelperCell::setType
virtual void setType(QET::TitleBlockColumnLength)
Definition: helpercell.cpp:94
HelperCell::index
int index
Index of this cell.
Definition: helpercell.h:44
QET::Horizontal
@ Horizontal
Horizontal segment.
Definition: qet.h:89
HelperCell::sizeHint
QSizeF sizeHint(Qt::SizeHint, const QSizeF &=QSizeF()) const override
Definition: helpercell.cpp:59
HelperCell::contextMenuTriggered
void contextMenuTriggered(HelperCell *)
QET::RelativeToRemainingLength
@ RelativeToRemainingLength
the length is just a fraction of the length that is still available when other types of lengths have ...
Definition: qet.h:148
HelperCell::orientation
Qt::Orientation orientation
Orientation of this cell.
Definition: helpercell.h:43