Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
TimeInputField.hpp
1/*
2 * Marvelous OTF2 Traces Interactive Visualizer (MOTIV)
3 * Copyright (C) 2023 Florian Gallrein, Björn Gehrke
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#ifndef MOTIV_TIMEINPUTFIELD_HPP
19#define MOTIV_TIMEINPUTFIELD_HPP
20
21#include <QComboBox>
22#include <QLabel>
23#include <QLineEdit>
24#include <QWidget>
25
26#include "src/types.hpp"
27#include "src/ui/TimeUnit.hpp"
28#include "src/ui/TraceDataProxy.hpp"
29
50class TimeInputField : public QWidget {
51 Q_OBJECT
52
53public Q_SLOTS:
61 void setTime(types::TraceTime newTime);
62
63public: // constructors
71 TimeInputField(QString labelText, TimeUnit timeResolution, types::TraceTime initialTime, QWidget *parent = nullptr);
72
73public: // methods
78 void setUpdateFunction(std::function<void (types::TraceTime)>);
79
80private: // methods
81
82private: // widgets
83 QLabel *textLabel = nullptr;
84 QLineEdit *lineEdit = nullptr;
85 QComboBox *comboBox = nullptr;
86
87private: // data
88 QString text;
89 TimeUnit resolution;
90
94 types::TraceTime time;
95
96 std::function<void (types::TraceTime)> updateFunction;
97};
98
99
100#endif //MOTIV_TIMEINPUTFIELD_HPP
A widget for entering a time point.
void setTime(types::TraceTime newTime)
Sets the time.
void setUpdateFunction(std::function< void(types::TraceTime)>)
Represents possible units on the time scale.
Definition: TimeUnit.hpp:29