Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qabstractfileiconengine_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QABSTRACTFILEICONENGINE_P_H
5#define QABSTRACTFILEICONENGINE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qfileinfo.h>
19#include <private/qicon_p.h>
20#include <qpa/qplatformtheme.h>
21
23
24class Q_GUI_EXPORT QAbstractFileIconEngine : public QPixmapIconEngine
25{
26public:
27 explicit QAbstractFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts)
28 : QPixmapIconEngine(), m_fileInfo(info), m_options(opts) {}
29
33
34 QFileInfo fileInfo() const { return m_fileInfo; }
35 QPlatformTheme::IconOptions options() const { return m_options; }
36
37 // Helper to convert a sequence of ints to a list of QSize
38 template <class It> static QList<QSize> toSizeList(It i1, It i2);
39
40protected:
42 virtual QString cacheKey() const;
43
44private:
45 const QFileInfo m_fileInfo;
46 const QPlatformTheme::IconOptions m_options;
47};
48
49template <class It>
51{
53 result.reserve(int(i2 - i1));
54 for ( ; i1 != i2; ++i1)
55 result.append(QSize(*i1, *i1));
56 return result;
57}
58
60
61#endif // QABSTRACTFILEICONENGINE_P_H
Helper base class for retrieving icons for files for usage by QFileIconProvider and related.
virtual QPixmap filePixmap(const QSize &size, QIcon::Mode mode, QIcon::State)=0
QAbstractFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts)
QPlatformTheme::IconOptions options() const
static QList< QSize > toSizeList(It i1, It i2)
\inmodule QtCore \reentrant
Definition qfileinfo.h:22
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition qicon.h:22
State
This enum describes the state for which a pixmap is intended to be used.
Definition qicon.h:23
Definition qlist.h:74
QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override
Definition qicon.cpp:268
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override
Returns the actual size of the icon the engine provides for the requested size, mode and state.
Definition qicon.cpp:328
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
else opt state
[0]
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
GLenum mode
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint64EXT * result
[6]
GLenum GLenum GLenum GLenum GLenum scale
double qreal
Definition qtypes.h:92
QFileInfo info(fileName)
[8]
widget render & pixmap