On this page

Utils::FilePathAspect Class

class Utils::FilePathAspect

A file path aspect is shallow wrapper around a Utils::StringAspect that represents a file in the file system. More...

Header: #include <aspects.h>
Inherits: Utils::TypedAspect

Public Functions

void addButton(const QString &text, QObject *context, const std::function<void ()> &callback)
Utils::FancyLineEdit::AsyncValidationFunction defaultValidationFunction() const
Utils::FilePath effectiveBinary() const
Utils::FilePath expandedVolatilePath() const
bool isValid() const
void makeCheckable(Utils::CheckBoxPlacement checkBoxPlacement, const QString &checkerLabel, const Utils::Key &checkerKey)
void setExpectedKind(const Utils::PathChooserKind &expectedKind)
void setValue(const Utils::FilePath &filePath, Utils::BaseAspect::Announcement howToAnnounce = DoEmit)
Utils::FilePath operator()() const

Reimplemented Public Functions

virtual void fromMap(const Utils::Store &map) override
virtual void toMap(Utils::Store &map) const override

Signals

void allowPathFromDeviceChanged()
void baseDirectoryChanged()
void commandVersionArgumentsChanged()
void environmentChanged()
void expectedKindChanged()
void focusRequested()
void historyCompleterChanged()
void initialBrowsePathBackupChanged()
void openTerminalHandlerChanged()
void placeHolderTextChanged()
void promptDialogFilterChanged()
void promptDialogTitleChanged()
void validChanged(bool validState)
void validatePlaceHolderChanged()
void validationFunctionChanged()
void validationRequested()
void valueAlternativesChanged()

Detailed Description

It is displayed by default using Utils::PathChooser.

The visual representation often contains a label in front of the display of the actual value.

See also Utils::StringAspect.

Member Function Documentation

void FilePathAspect::addButton(const QString &text, QObject *context, const std::function<void ()> &callback)

Adds a button with text to the path choosers of this aspect that are created from now on. Clicking it calls callback. The button is not added anymore once context is destroyed.

[private signal] void FilePathAspect::allowPathFromDeviceChanged()

[private signal] void FilePathAspect::baseDirectoryChanged()

[private signal] void FilePathAspect::commandVersionArgumentsChanged()

Utils::FancyLineEdit::AsyncValidationFunction FilePathAspect::defaultValidationFunction() const

Returns the validation a path chooser of this aspect performs when no validation function was set, for use in a custom validation function.

See also setValidationFunction().

Utils::FilePath FilePathAspect::effectiveBinary() const

Returns the full path of the set command. Only makes a difference if expected kind is Command or ExistingCommand and the current file path is an executable provided without its path. Performs a lookup in PATH if necessary.

[private signal] void FilePathAspect::environmentChanged()

Utils::FilePath FilePathAspect::expandedVolatilePath() const

Returns the volatile value expanded the way the path choosers of this aspect expand their input: environment variables and macros are expanded, and a relative path is resolved according to the expected kind and the base directory.

See also expandedVolatileValue().

[private signal] void FilePathAspect::expectedKindChanged()

[private signal] void FilePathAspect::focusRequested()

[override virtual] void FilePathAspect::fromMap(const Utils::Store &map)

Reimplements: BaseAspect::fromMap(const Utils::Store &map).

[private signal] void FilePathAspect::historyCompleterChanged()

[private signal] void FilePathAspect::initialBrowsePathBackupChanged()

bool FilePathAspect::isValid() const

Returns whether the input in the path choosers of this aspect passed validation.

See also validChanged().

void FilePathAspect::makeCheckable(Utils::CheckBoxPlacement checkBoxPlacement, const QString &checkerLabel, const Utils::Key &checkerKey)

Adds a check box with a checkerLabel according to checkBoxPlacement to the line edit.

The state of the check box is made persistent when using a non-emtpy checkerKey.

[private signal] void FilePathAspect::openTerminalHandlerChanged()

[private signal] void FilePathAspect::placeHolderTextChanged()

[private signal] void FilePathAspect::promptDialogFilterChanged()

[private signal] void FilePathAspect::promptDialogTitleChanged()

void FilePathAspect::setExpectedKind(const Utils::PathChooserKind &expectedKind)

Sets expectedKind as expected kind for path chooser displays.

See also Utils::PathChooser::setExpectedKind().

void FilePathAspect::setValue(const Utils::FilePath &filePath, Utils::BaseAspect::Announcement howToAnnounce = DoEmit)

Sets the value of this file path aspect to filePath.

If howToAnnounce is set to DoEmit, emits the valueChanged signal.

Note: This does not use any check that the value is actually a file path.

[override virtual] void FilePathAspect::toMap(Utils::Store &map) const

Reimplements: BaseAspect::toMap(Utils::Store &map) const.

[signal] void FilePathAspect::validChanged(bool validState)

[private signal] void FilePathAspect::validatePlaceHolderChanged()

[private signal] void FilePathAspect::validationFunctionChanged()

[private signal] void FilePathAspect::validationRequested()

[private signal] void FilePathAspect::valueAlternativesChanged()

Utils::FilePath FilePathAspect::operator()() const

Returns the value of this aspect as Utils::FilePath.

Note: This simply uses FilePath::fromUserInput() for the conversion. It does not use any check that the value is actually a valid file path.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.