6#include <QtCore/qdir.h>
7#include <QtCore/qfileinfo.h>
8#include <QtCore/qcache.h>
9#include <QtCore/qloggingcategory.h>
10#include <QtCore/qfileselector.h>
11#include <QtQml/qqmlfile.h>
12#include <QtQml/private/qqmlproperty_p.h>
23 static bool ok =
false;
36 for (
int i = 0;
i <
input.size(); ++
i) {
43 std::sort(
sub.begin(),
sub.end());
47 }
while (std::next_permutation(
sub.begin(),
sub.end()));
133 if (m_allStates ==
states)
198 return m_path + m_name + m_activeStates.join(m_separator);
212 bestFilePath = *cachedPath;
216 if (bestFilePath.
isNull()) {
224 const QString filePath =
findFile(
dir, m_name + m_separator + perm.join(m_separator), extensions);
227 if (score > bestScore) {
229 bestFilePath = filePath;
241 qCDebug(lcQtQuickControlsImageSelector) << m_name << m_activeStates <<
"->" << bestFilePath;
259 for (
const QVariant &
v : std::as_const(m_allStates)) {
264 if (
it.value().toBool())
268 if (m_activeStates == active)
271 m_activeStates = active;
279 score += (m_activeStates.size() - m_activeStates.indexOf(
states.at(
i))) << 1;
307#include "moc_qquickimageselector_p.cpp"
\inmodule QtCore \reentrant
QString fileName() const
Returns the name of the file, excluding the path.
QString path() const
Returns the file's path.
QString select(const QString &filePath) const
This function returns the selected version of the path, based on the conditions at runtime.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype size() const noexcept
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
static bool write(QObject *, const QQmlPropertyData &, const QVariant &, const QQmlRefPointer< QQmlContextData > &, QQmlPropertyData::WriteFlags flags={})
The QQmlProperty class abstracts accessing properties on objects created from QML.
bool isValid() const
Returns true if the QQmlProperty refers to a valid property, otherwise false.
QVariant read() const
Returns the property value.
QQuickAnimatedImageSelector(QObject *parent=nullptr)
QStringList fileExtensions() const override
QQuickImageSelector(QObject *parent=nullptr)
void setCache(bool cache)
void setSource(const QUrl &source)
void setPath(const QString &path)
int calculateScore(const QStringList &states) const
void write(const QVariant &value) override
This method will be called when a new value is assigned to the property being intercepted.
bool updateActiveStates()
void setName(const QString &name)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void classBegin() override
Invoked after class creation, but before any properties have been set.
virtual QStringList fileExtensions() const
void setStates(const QVariantList &states)
void setSeparator(const QString &separator)
void setTarget(const QQmlProperty &property) override
Set the target property for the value interceptor.
void setUrl(const QUrl &url)
QQuickNinePatchImageSelector(QObject *parent=nullptr)
QStringList fileExtensions() const override
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
bool isNull() const
Returns true if this string is null; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter * sub
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLsizei GLsizei GLchar * source
GLsizei const GLchar *const * path
GLenum GLenum GLenum input
static quint64 cacheSize()
static QList< QStringList > permutations(const QStringList &input, int count=-1)
static QT_BEGIN_NAMESPACE const int DEFAULT_CACHE
static QString findFile(const QDir &dir, const QString &baseName, const QStringList &extensions)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
QT_BEGIN_NAMESPACE typedef uchar * output
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent