QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
terminalstriplayouteditor.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 TERMINALSTRIPLAYOUTEDITOR_H
19#define TERMINALSTRIPLAYOUTEDITOR_H
20
21#include <QGraphicsItem>
22#include <QWidget>
23
24#include "../GraphicsItem/demoterminalstrip.h"
25#include "../GraphicsItem/terminalstripdrawer.h"
26
28
29namespace Ui {
31}
32
33class PreviewStripItem : public QGraphicsItem
34{
36
37 public:
38 PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
39 m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
40 layout}
41 {}
42
43 QRectF boundingRect() const override {
44 return m_drawer.boundingRect();
45 }
46
47 protected:
48 void paint(QPainter *painter,
49 const QStyleOptionGraphicsItem *option,
50 QWidget *widget = nullptr) override
51 {
52 Q_UNUSED (option); Q_UNUSED (widget);
53 m_drawer.paint(painter);
54 }
55
56 private:
58 };
59
64class TerminalStripLayoutEditor : public QWidget
65{
66 Q_OBJECT
67
68 public:
69 explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
70 QWidget *parent = nullptr);
72
73 protected:
74 void resizeEvent(QResizeEvent *event) override;
75 void showEvent(QShowEvent *event) override;
76
77 private slots:
78 void valueEdited();
79
80 void on_m_display_preview_help_clicked(bool checked);
81
82 private:
83 void updateUi();
84 void updatePreview();
85
86 private:
87 Ui::TerminalStripLayoutEditor *ui;
88 QSharedPointer<TerminalStripLayoutPattern> m_layout;
89 bool m_ui_updating { false } ;
91};
92
93#endif // TERMINALSTRIPLAYOUTEDITOR_H
Definition terminalstriplayouteditor.h:34
TerminalStripDrawer::TerminalStripDrawer m_drawer
Definition terminalstriplayouteditor.h:57
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Definition terminalstriplayouteditor.h:48
PreviewStripItem(QSharedPointer< TerminalStripLayoutPattern > layout)
Definition terminalstriplayouteditor.h:38
QRectF boundingRect() const override
Definition terminalstriplayouteditor.h:43
Definition demoterminalstrip.h:26
Definition terminalstripdrawer.h:68
The TerminalStripLayoutEditor class Widget used to edit the layout of a terminal strip item.
Definition terminalstriplayouteditor.h:65
void updateUi()
Definition terminalstriplayouteditor.cpp:139
bool m_ui_updating
Definition terminalstriplayouteditor.h:89
void showEvent(QShowEvent *event) override
Definition terminalstriplayouteditor.cpp:45
PreviewStripItem m_preview_strip_item
Definition terminalstriplayouteditor.h:90
void valueEdited()
Definition terminalstriplayouteditor.cpp:51
void on_m_display_preview_help_clicked(bool checked)
Definition terminalstriplayouteditor.cpp:223
Ui::TerminalStripLayoutEditor * ui
Definition terminalstriplayouteditor.h:87
void updatePreview()
Definition terminalstriplayouteditor.cpp:217
void resizeEvent(QResizeEvent *event) override
Definition terminalstriplayouteditor.cpp:39
QSharedPointer< TerminalStripLayoutPattern > m_layout
Definition terminalstriplayouteditor.h:88
~TerminalStripLayoutEditor()
Definition terminalstriplayouteditor.cpp:34
The TerminalStripLayoutPattern class A class with all values used to define how a terminal strip must...
Definition terminalstriplayoutpattern.h:41
Definition demoterminalstrip.cpp:21
Definition autonumberingdockwidget.h:26