Motiv
Marvelous OTF2 Traces Interactive Visualizer
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | List of all members
TimeInputField Class Reference

A widget for entering a time point. More...

#include <TimeInputField.hpp>

Inheritance diagram for TimeInputField:
Inheritance graph
[legend]
Collaboration diagram for TimeInputField:
Collaboration graph
[legend]

Public Slots

void setTime (types::TraceTime newTime)
 Sets the time. More...
 

Public Member Functions

 TimeInputField (QString labelText, TimeUnit timeResolution, types::TraceTime initialTime, QWidget *parent=nullptr)
 
void setUpdateFunction (std::function< void(types::TraceTime)>)
 

Detailed Description

A widget for entering a time point.

TimeInputField provides a combination of a QLabel, QLineEdit and QComboBox.

The QLabel displays an informational text, QLineEdit is a field that allows a double value as input, and the QComboBox can be used to select a time unit. Selecting a different time unit will automatically adjust the value in the input field. The purpose of this widget is to control a TraceTime at different degrees of granularity.

By default, the widget does only keep its internal state and does not modify any other variable. In order to use the entered value you have to set an update function using setUpdateFunction(yourFunc).

types::TraceTime myTime(0);
auto field = new TimeInputField("Start", TimeUnit::Second, TraceTime(0));
field->setUpdateFunction([&myTime](auto newStartTime) { myTime = newStartTime); });
A widget for entering a time point.

Definition at line 50 of file TimeInputField.hpp.

Constructor & Destructor Documentation

◆ TimeInputField()

TimeInputField::TimeInputField ( QString  labelText,
TimeUnit  timeResolution,
types::TraceTime  initialTime,
QWidget *  parent = nullptr 
)

Creates new TimeInputField.

Parameters
labelTextInformational text to display left of the input field
timeResolutionInitial temporal resolution of the widget
initialTimeInitial value to display
parent

Definition at line 25 of file TimeInputField.cpp.

Member Function Documentation

◆ setTime

void TimeInputField::setTime ( types::TraceTime  newTime)
slot

Sets the time.

The UI is updated afterwars to reflect the new time

Parameters
newTimeThe new time

Definition at line 64 of file TimeInputField.cpp.

◆ setUpdateFunction()

void TimeInputField::setUpdateFunction ( std::function< void(types::TraceTime)>  newUpdateFunction)

Set an update function that is called when a new value is entered. See TimeInputField for an example.

Definition at line 60 of file TimeInputField.cpp.


The documentation for this class was generated from the following files: