summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-11-06 00:44:35 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-11-06 00:44:35 +0100
commit0fb267c19925a949a8b1f8c62d9fbe52ba821d3d (patch)
tree4a1d3e3c90223bca9569e1ab013523a0c6d453a7
parentae71a80a7b84899fd9d8c64265a7509e71f2c380 (diff)
qfc: always ensure at least one point exists
Previously, insertion of the lone point was postponed until opening the mapping window.
-rw-r--r--spline-widget/functionconfig.cpp6
-rw-r--r--spline-widget/functionconfig.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/spline-widget/functionconfig.cpp b/spline-widget/functionconfig.cpp
index dcc9ca65..33100e07 100644
--- a/spline-widget/functionconfig.cpp
+++ b/spline-widget/functionconfig.cpp
@@ -219,7 +219,11 @@ void Map::loadSettings(QSettings& settings, const QString& title) {
void Map::saveSettings(QSettings& settings, const QString& title) {
QMutexLocker foo(&_mutex);
settings.beginGroup(QString("Curves-%1").arg(title));
- int max = cur.input.size();
+
+ if (cur.input.size() == 0)
+ cur.input.push_back(QPointF(max_x, max_y));
+
+ const int max = cur.input.size();
settings.setValue("point-count", max);
for (int i = 0; i < max; i++) {
diff --git a/spline-widget/functionconfig.h b/spline-widget/functionconfig.h
index 97a80cac..145ee14e 100644
--- a/spline-widget/functionconfig.h
+++ b/spline-widget/functionconfig.h
@@ -30,7 +30,7 @@ private:
struct State {
QList<QPointF> input;
- std::vector<float> data;
+ std::vector<float> data;
};
int precision() const;
@@ -52,6 +52,8 @@ public:
{
setMaxInput(maxx);
setMaxOutput(maxy);
+ if (cur.input.size() == 0)
+ cur.input.push_back(QPointF(maxx, maxy));
reload();
}