summaryrefslogtreecommitdiff
path: root/gui/dynamicwaysentry.h
blob: de001ee777bd5c227f30fba0b80e0f49f5190167 (plain)
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
#ifndef DYNAMICWAYSENTRY_H
#define DYNAMICWAYSENTRY_H


#include <QLineEdit>
#include <QStringList>
#include <QVBoxLayout>
#include <QVector>
#include <QWidget>

class DynamicWaysEntry : public QWidget
{
  public:
	DynamicWaysEntry(QWidget *parent = nullptr);
	QStringList get_entries() const;
	/**
	 * Parses a string from this entry field, if it is valid.
	 * @param a string
	 * @param -1 if the string is not suitable as a way, an integer compatible
	 * with the cache constructor otherwise.
	 */
	int parse_valid_way(QString t);
  private slots:
	void on_number_enter(const QString &t);

  private:
	QVBoxLayout *l;
	QVector<QLineEdit *> fields;
	QStringList entries;
	void add_field();
	void remove_last_field();
};

#endif // DYNAMICWAYSENTRY_H