#include <fspathedit_p.h>
|
QValidator::State | validate (const QList< QStringView > &pathComponents, bool strict, int firstComponentToTest, int lastComponentToTest) const |
|
TestResult | testPath (QStringView path, bool pathIsComplete) const |
|
Definition at line 45 of file fspathedit_p.h.
◆ TestResult
Enumerator |
---|
OK | |
DoesNotExist | |
NotADir | |
NotAFile | |
CantRead | |
CantWrite | |
Definition at line 69 of file fspathedit_p.h.
◆ FileSystemPathValidator()
Private::FileSystemPathValidator::FileSystemPathValidator |
( |
QObject * |
parent = nullptr | ) |
|
Definition at line 41 of file fspathedit_p.cpp.
QValidator::State m_lastValidationState
TestResult m_lastTestResult
bool m_checkReadPermission
bool m_checkWritePermission
◆ checkReadPermission()
bool Private::FileSystemPathValidator::checkReadPermission |
( |
| ) |
const |
◆ checkWritePermission()
bool Private::FileSystemPathValidator::checkWritePermission |
( |
| ) |
const |
◆ directoriesOnly()
bool Private::FileSystemPathValidator::directoriesOnly |
( |
| ) |
const |
◆ existingOnly()
bool Private::FileSystemPathValidator::existingOnly |
( |
| ) |
const |
◆ lastTestedPath()
QString Private::FileSystemPathValidator::lastTestedPath |
( |
| ) |
const |
◆ lastTestResult()
◆ lastValidationState()
QValidator::State Private::FileSystemPathValidator::lastValidationState |
( |
| ) |
const |
◆ setCheckReadPermission()
void Private::FileSystemPathValidator::setCheckReadPermission |
( |
bool |
v | ) |
|
◆ setCheckWritePermission()
void Private::FileSystemPathValidator::setCheckWritePermission |
( |
bool |
v | ) |
|
◆ setDirectoriesOnly()
void Private::FileSystemPathValidator::setDirectoriesOnly |
( |
bool |
v | ) |
|
◆ setExistingOnly()
void Private::FileSystemPathValidator::setExistingOnly |
( |
bool |
v | ) |
|
◆ setStrictMode()
void Private::FileSystemPathValidator::setStrictMode |
( |
bool |
v | ) |
|
◆ strictMode()
bool Private::FileSystemPathValidator::strictMode |
( |
| ) |
const |
◆ testPath()
◆ validate() [1/2]
QValidator::State Private::FileSystemPathValidator::validate |
( |
const QList< QStringView > & |
pathComponents, |
|
|
bool |
strict, |
|
|
int |
firstComponentToTest, |
|
|
int |
lastComponentToTest |
|
) |
| const |
|
private |
Definition at line 135 of file fspathedit_p.cpp.
138 Q_ASSERT(firstComponentToTest >= 0);
139 Q_ASSERT(lastComponentToTest >= firstComponentToTest);
140 Q_ASSERT(lastComponentToTest < pathComponents.size());
143 if (pathComponents.empty())
144 return strict ? QValidator::Invalid : QValidator::Intermediate;
146 for (
int i = firstComponentToTest; i <= lastComponentToTest; ++i)
148 const bool isFinalPath = (i == (pathComponents.size() - 1));
149 const QStringView componentPath = pathComponents[i];
150 if (componentPath.isEmpty())
continue;
156 return strict ? QValidator::Invalid : QValidator::Intermediate;
160 return QValidator::Acceptable;
TestResult testPath(QStringView path, bool pathIsComplete) const
◆ validate() [2/2]
QValidator::State Private::FileSystemPathValidator::validate |
( |
QString & |
input, |
|
|
int & |
pos |
|
) |
| const |
|
override |
Definition at line 103 of file fspathedit_p.cpp.
106 return m_strictMode ? QValidator::Invalid : QValidator::Intermediate;
110 QList<QStringView> components = QStringView(input).split(QDir::separator(), Qt::KeepEmptyParts);
112 int componentWithCursorIndex = 0;
113 int componentWithCursorPosition = 0;
119 for (; (componentWithCursorIndex < (components.size() - 1)) && (pathLength < pos); ++componentWithCursorIndex)
121 pathLength = componentWithCursorPosition + components[componentWithCursorIndex].size();
122 componentWithCursorPosition += components[componentWithCursorIndex].size() + 1;
125 Q_ASSERT(componentWithCursorIndex < components.size());
128 if (componentWithCursorIndex > 0)
130 if ((
m_lastValidationState == QValidator::Acceptable) && (componentWithCursorIndex < components.size()))
QValidator::State validate(QString &input, int &pos) const override
◆ m_checkReadPermission
bool Private::FileSystemPathValidator::m_checkReadPermission |
|
private |
◆ m_checkWritePermission
bool Private::FileSystemPathValidator::m_checkWritePermission |
|
private |
◆ m_directoriesOnly
bool Private::FileSystemPathValidator::m_directoriesOnly |
|
private |
◆ m_existingOnly
bool Private::FileSystemPathValidator::m_existingOnly |
|
private |
◆ m_lastTestedPath
QString Private::FileSystemPathValidator::m_lastTestedPath |
|
mutableprivate |
◆ m_lastTestResult
TestResult Private::FileSystemPathValidator::m_lastTestResult |
|
mutableprivate |
◆ m_lastValidationState
QValidator::State Private::FileSystemPathValidator::m_lastValidationState |
|
mutableprivate |
◆ m_strictMode
bool Private::FileSystemPathValidator::m_strictMode |
|
private |
The documentation for this class was generated from the following files: