-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput_widget.hpp
More file actions
46 lines (34 loc) · 1.16 KB
/
Copy pathoutput_widget.hpp
File metadata and controls
46 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef OUTPUT_WIDGET_HPP
#define OUTPUT_WIDGET_HPP
#include <QWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QLayout>
#include "expression.hpp"
#include "semantic_error.hpp"
class OutputWidget: public QWidget {
Q_OBJECT
public:
OutputWidget(QWidget* parent = nullptr);
void processExpression(const Expression& exp);
void error(const QString& str);
// re-scale the output to make all items inside it visible
void scale();
void clear();
private:
QGraphicsScene* scene;
QGraphicsView* view;
// Helper functions to add text to the scene with default settings
QGraphicsTextItem* addText(const QString& str);
// helper function to determine the time of object and delegate the object to other functions
std::string getObjectName(const Expression& exp) const;
void handleObject(const Expression& exp, const std::string& objectName);
// helper functions to help with graphics
QRectF handlePointGraphic(const Expression& exp, bool addToScene = true);
void handleLineGraphic(const Expression& exp);
void handleTextGraphic(const Expression& exp);
protected:
void resizeEvent(QResizeEvent* event) override;
};
#endif