55 #include <QMimeDatabase>
56 #include <QTextStream>
70 return t1.name() <
t2.name();
110 void MimetypeModel::populate()
119 Iterator
end = allTypes.
end();
120 const Iterator topLevelStart =
121 std::stable_partition(allTypes.
begin(),
end,
122 [](
const QMimeType &
t) { return !t.parentMimeTypes().isEmpty(); });
123 std::stable_sort(topLevelStart,
end);
124 for (Iterator
it = topLevelStart;
it !=
end; ++
it) {
134 auto nameIndexIt = m_nameIndexHash.
constEnd();
136 nameIndexIt = m_nameIndexHash.
constFind(
it->parentMimeTypes().constFirst());
137 if (nameIndexIt != m_nameIndexHash.
constEnd())
140 if (nameIndexIt == m_nameIndexHash.
constEnd()) {
141 qWarning() <<
"Orphaned mime types:" << allTypes;
147 const QString &parentName = nameIndexIt.key();
148 const Iterator
start =
150 { return !t.parentMimeTypes().contains(parentName); });
176 str <<
"<html><head/><body><h3><center>" <<
t.name() <<
"</center></h3><br><table>";
179 if (!aliases.isEmpty())
180 str <<
"<tr><td>Aliases:</td><td>" <<
" (" << aliases <<
')';
183 <<
"<tr><td>Comment:</td><td>" <<
t.comment() <<
"</td></tr>"
184 <<
"<tr><td>Icon name:</td><td>" <<
t.iconName() <<
"</td></tr>"
185 <<
"<tr><td>Generic icon name</td><td>" <<
t.genericIconName() <<
"</td></tr>";
189 str <<
"<tr><td>Filter:</td><td>" <<
t.filterString() <<
"</td></tr>";
192 if (!patterns.isEmpty())
193 str <<
"<tr><td>Glob patterns:</td><td>" << patterns <<
"</td></tr>";
195 const QStringList &parentMimeTypes =
t.parentMimeTypes();
196 if (!parentMimeTypes.isEmpty())
197 str <<
"<tr><td>Parent types:</td><td>" <<
t.parentMimeTypes() <<
"</td></tr>";
200 if (!suffixes.isEmpty()) {
201 str <<
"<tr><td>Suffixes:</td><td>";
202 const QString &preferredSuffix =
t.preferredSuffix();
203 if (!preferredSuffix.
isEmpty()) {
204 suffixes.removeOne(preferredSuffix);
205 str <<
"<b>" << preferredSuffix <<
"</b> ";
207 str << suffixes <<
"</td></tr>";
209 str <<
"</table></body></html>";
small capitals from c petite p scientific i
[1]
QVariant data(const QModelIndex &index, int role) const override
QMimeType mimeType(const QModelIndex &) const
static QString formatMimeTypeInfo(const QMimeType &)
MimetypeModel(QObject *parent=nullptr)
operator<<(QDataStream &ds, qfloat16 f)
bool operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
const_iterator constFind(const Key &key) const noexcept
const_iterator constEnd() const noexcept
iterator insert(const Key &key, const T &value)
static QIcon fromTheme(const QString &name)
bool isEmpty() const noexcept
iterator erase(const_iterator begin, const_iterator end)
The QMimeDatabase class maintains a database of MIME types.
QList< QMimeType > allMimeTypes() const
The QMimeType class describes types of file or data, represented by a MIME type string.
The QModelIndex class is used to locate data in a data model.
The QObject class is the base class of all Qt objects.
The QStandardItem class provides an item for use with the QStandardItemModel class.
virtual void setData(const QVariant &value, int role=Qt::UserRole+1)
void setToolTip(const QString &toolTip)
void setIcon(const QIcon &icon)
virtual QVariant data(int role=Qt::UserRole+1) const
void setFlags(Qt::ItemFlags flags)
void appendRow(const QList< QStandardItem * > &items)
The QStandardItemModel class provides a generic model for storing custom data.\inmodule QtGui.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void setHorizontalHeaderLabels(const QStringList &labels)
QStandardItem * item(int row, int column=0) const
void appendRow(const QList< QStandardItem * > &items)
QModelIndex indexFromItem(const QStandardItem *item) const
QStandardItem * itemFromIndex(const QModelIndex &index) const
The QString class provides a Unicode character string.
The QStringList class provides a list of strings.
The QTextStream class provides a convenient interface for reading and writing text.
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLenum GLenum GLsizei void * row
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent