Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
31 QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State, qreal scale) override;
32 QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
33 bool isNull() override { return false; }
34
35 QFileInfo fileInfo() const { return m_fileInfo; }
36 QPlatformTheme::IconOptions options() const { return m_options; }
37
38 // Helper to convert a sequence of ints to a list of QSize
39 template <class It> static QList<QSize> toSizeList(It i1, It i2);
40
41protected:
43 virtual QString cacheKey() const;
44
45private:
46 const QFileInfo m_fileInfo;
47 const QPlatformTheme::IconOptions m_options;
48};
49
50template <class It>
51inline QList<QSize> QAbstractFileIconEngine::toSizeList(It i1, It i2)
52{
53 QList<QSize> result;
54 result.reserve(int(i2 - i1));
55 for ( ; i1 != i2; ++i1)
56 result.append(QSize(*i1, *i1));
57 return result;
58}
59
61
62#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)
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
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:129
else opt state
[0]
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
static QByteArray cacheKey(Args &&...args)
GLenum mode
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint64EXT * result
[6]
GLenum GLenum GLenum GLenum GLenum scale
double qreal
Definition qtypes.h:187
widget render & pixmap
QHostInfo info
[0]