A QLineEdit + browse-button widget that normalises display paths against a project anchor.
More...
#include <relativepathpicker.h>
A QLineEdit + browse-button widget that normalises display paths against a project anchor.
The widget exposes two views of the same value:
- absolutePath() — the resolved absolute path (or empty); this is the authoritative value, persisted by callers.
- displayPath() — what the line edit shows: relative to the anchor when reachable, otherwise absolute (with a warning tooltip).
Setting the path via setPath() accepts either form; the widget re-derives the absolute and display strings internally.
Acceptance mode (open / save) and file filter are configurable.
◆ RelativePathPicker()
| openswmmvis::ui::RelativePathPicker::RelativePathPicker |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
◆ absolutePath()
| QString openswmmvis::ui::RelativePathPicker::absolutePath |
( |
| ) |
const |
|
inline |
Current absolute path. Empty when no file is selected.
◆ acceptMode()
| QFileDialog::AcceptMode openswmmvis::ui::RelativePathPicker::acceptMode |
( |
| ) |
const |
|
inline |
Acceptance mode for the browse dialog. Defaults to AcceptOpen ("pick an existing file").
◆ dialogCaption()
| QString openswmmvis::ui::RelativePathPicker::dialogCaption |
( |
| ) |
const |
|
inline |
Browse-dialog window title.
◆ displayPath()
| QString openswmmvis::ui::RelativePathPicker::displayPath |
( |
| ) |
const |
Path string as currently displayed in the line edit — relative to the anchor when reachable, absolute otherwise.
◆ fileFilter()
| QString openswmmvis::ui::RelativePathPicker::fileFilter |
( |
| ) |
const |
|
inline |
Browse-dialog file filter, e.g. "Time-series files (*.dat *.csv)".
◆ isDisplayedRelatively()
| bool openswmmvis::ui::RelativePathPicker::isDisplayedRelatively |
( |
| ) |
const |
Whether the displayed path is currently expressed relatively (informational; the GUI status panel uses this).
◆ pathChanged
| void openswmmvis::ui::RelativePathPicker::pathChanged |
( |
const QString & |
absolutePath | ) |
|
|
signal |
Emitted whenever the absolute path changes via setPath() or browse.
◆ projectAnchor()
| QString openswmmvis::ui::RelativePathPicker::projectAnchor |
( |
| ) |
const |
|
inline |
Directory that displayed paths are made relative to. Typically the parent directory of the project's .inp file.
◆ setAcceptMode()
| void openswmmvis::ui::RelativePathPicker::setAcceptMode |
( |
QFileDialog::AcceptMode |
m | ) |
|
|
inline |
◆ setDialogCaption()
| void openswmmvis::ui::RelativePathPicker::setDialogCaption |
( |
const QString & |
caption | ) |
|
|
inline |
◆ setFileFilter()
| void openswmmvis::ui::RelativePathPicker::setFileFilter |
( |
const QString & |
filter | ) |
|
|
inline |
◆ setPath
| void openswmmvis::ui::RelativePathPicker::setPath |
( |
const QString & |
p | ) |
|
|
slot |
Accepts either an absolute or a relative path. Relative inputs are resolved against projectAnchor() when set; otherwise stored verbatim. Emits pathChanged() on a real change.
◆ setProjectAnchor()
| void openswmmvis::ui::RelativePathPicker::setProjectAnchor |
( |
const QString & |
dir | ) |
|
◆ absolutePath
| QString openswmmvis::ui::RelativePathPicker::absolutePath |
|
readwrite |
◆ fileFilter
| QString openswmmvis::ui::RelativePathPicker::fileFilter |
|
readwrite |
◆ projectAnchor
| QString openswmmvis::ui::RelativePathPicker::projectAnchor |
|
readwrite |
The documentation for this class was generated from the following files: