本文整理汇总了C++中QMimeDatabase::mimeTypeForFileNameAndData方法的典型用法代码示例。如果您正苦于以下问题:C++ QMimeDatabase::mimeTypeForFileNameAndData方法的具体用法?C++ QMimeDatabase::mimeTypeForFileNameAndData怎么用?C++ QMimeDatabase::mimeTypeForFileNameAndData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMimeDatabase
的用法示例。
在下文中一共展示了QMimeDatabase::mimeTypeForFileNameAndData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
KArchive *ArchiveReader::create(const QString &fileName, QIODevice *data)
{
QMimeDatabase dataBase;
const QMimeType mimeType = dataBase.mimeTypeForFileNameAndData(fileName, data);
return create(mimeType, data);
}
示例2: slotButtonClicked
void ContactInfoDialog::slotButtonClicked(QAbstractButton *button)
{
if (button == d->buttonBox->button(QDialogButtonBox::Save)) {
if (d->avatarChanged) {
Tp::Avatar avatar;
if (!d->newAvatarFile.isEmpty()) {
QFile file(d->newAvatarFile);
file.open(QIODevice::ReadOnly);
QFileInfo fi(file);
avatar.avatarData = file.readAll();
file.seek(0); // reset before passing to KMimeType
QMimeDatabase db;
avatar.MIMEType = db.mimeTypeForFileNameAndData(d->newAvatarFile, &file).name();
}
d->account->setAvatar(avatar);
}
if (d->infoDataChanged) {
Tp::ContactInfoFieldList fieldList;
for (InfoRowIndex index = (InfoRowIndex) 0; index < _InfoRowCount; index = (InfoRowIndex) (index + 1)) {
InfoRow *row = &InfoRows[index];
Tp::ContactInfoField field;
field.fieldName = row->fieldName;
if (index == Birthday) {
KDateComboBox *combo = qobject_cast<KDateComboBox*>(d->infoValueWidgets.value(index));
field.fieldValue << combo->date().toString();
} else {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(d->infoValueWidgets.value(index));
field.fieldValue << lineEdit->text();
}
fieldList << field;
}
#if 0 // This method does not exist in TpQt (yet)
d->account->connection()->setContactInfo(fieldList);
#endif
}
accept();
return;
}
}