From 7ea534dd1c8bf72200a999cae554d842d9035ba9 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 1 Jan 2018 18:44:35 +0100 Subject: New StatementDialog, rename diagram classes Other changes: - Use raw pointer instead of smart pointers to manage resources - Initial Painter implementation --- include/ui/painter.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'include/ui/painter.h') diff --git a/include/ui/painter.h b/include/ui/painter.h index df62776..0a2accc 100644 --- a/include/ui/painter.h +++ b/include/ui/painter.h @@ -1,11 +1,15 @@ #ifndef PAINTER_H #define PAINTER_H -#include +#include "diagram/statement.h" +#include "diagram/structogram.h" -namespace Ui { -class Painter; -} +#include +#include +#include +#include +#include +#include class Painter : public QWidget { @@ -15,8 +19,20 @@ public: explicit Painter(QWidget *parent = 0); ~Painter(); + void structogram(samb::Structogram **structogram) { _structogram = structogram; } + const samb::Structogram structogram() const { return **_structogram; } + +protected: + void paintEvent(QPaintEvent *event); + private: - Ui::Painter *_ui; + samb::Structogram **_structogram = nullptr; + QFont _font; + QFontMetrics _fontMetrics; + + int _margin = 10; + + void drawStatement(QPainter &qp, samb::Statement &statement, const QRect &rect); }; #endif // PAINTER_H -- cgit v1.2.1