plotwindow can load csv files

This commit is contained in:
Robert 2020-11-18 16:24:12 +01:00
parent e5d1df9dbc
commit 81de09d563
8 changed files with 150 additions and 22 deletions

View file

@ -11,9 +11,12 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = nullptr);
explicit MainWindow(char** argv, QWidget* parent = nullptr);
~MainWindow();
int Failed() { return error_code; }
private:
Ui::MainWindow* ui;
int error_code;
};

28
include/PlotWidget.hpp Normal file
View file

@ -0,0 +1,28 @@
#pragma once
#include <QWidget>
#include <vector>
namespace Ui {
class PlotWidget;
}
typedef struct {
double x, y;
} DataPoint;
class PlotWidget : public QWidget
{
Q_OBJECT
public:
PlotWidget(QWidget* parent = nullptr);
~PlotWidget();
int SetDataSource(const std::string& filename);
private:
Ui::PlotWidget* ui;
std::vector<DataPoint>* data;
};

View file

@ -11,27 +11,20 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Regression</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<widget class="PlotWidget" name="plot" native="true">
<property name="geometry">
<rect>
<x>146</x>
<y>102</y>
<width>271</width>
<height>91</height>
<x>-1</x>
<y>-1</y>
<width>801</width>
<height>551</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>28</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
<property name="autoFillBackground">
<bool>false</bool>
</property>
</widget>
</widget>
@ -41,12 +34,20 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>PlotWidget</class>
<extends>QWidget</extends>
<header>PlotWidget.hpp</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

36
include/ui/PlotWidget.ui Normal file
View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlotWidget</class>
<widget class="QWidget" name="PlotWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>718</width>
<height>572</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QTextBrowser" name="tmp_CSVDisplay">
<property name="geometry">
<rect>
<x>35</x>
<y>31</y>
<width>651</width>
<height>511</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:6.6pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>