Utils: Introduce a FilePathAspect

A shallow wrapper around a StringAspect with a suitable operator().

Change-Id: I0a5e121565d03573faa5c3f4085d72db2b9c3774
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-05-15 18:24:20 +02:00
parent 1e595c6afe
commit 671621d79b
2 changed files with 30 additions and 0 deletions

View File

@@ -1325,6 +1325,28 @@ void StringAspect::makeCheckable(CheckBoxPlacement checkBoxPlacement,
update(); update();
} }
/*!
\class Utils::FilePathAspect
\inmodule QtCreator
\brief A file path aspect is shallow wrapper around a Utils::StringAspect that
represents a file in the file system.
It is displayed by default using Utils::PathChooser.
The visual representation often contains a label in front of the display
of the actual value.
\sa Utils::StringAspect
*/
FilePathAspect::FilePathAspect()
{
setDisplayStyle(PathChooserDisplay);
}
/*! /*!
\class Utils::ColorAspect \class Utils::ColorAspect
\inmodule QtCreator \inmodule QtCreator

View File

@@ -439,6 +439,14 @@ protected:
std::unique_ptr<Internal::StringAspectPrivate> d; std::unique_ptr<Internal::StringAspectPrivate> d;
}; };
class QTCREATOR_UTILS_EXPORT FilePathAspect : public StringAspect
{
public:
FilePathAspect();
FilePath operator()() const { return filePath(); }
};
class QTCREATOR_UTILS_EXPORT IntegerAspect : public BaseAspect class QTCREATOR_UTILS_EXPORT IntegerAspect : public BaseAspect
{ {
Q_OBJECT Q_OBJECT