本文整理汇总了C++中QContent::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QContent::type方法的具体用法?C++ QContent::type怎么用?C++ QContent::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QContent
的用法示例。
在下文中一共展示了QContent::type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thumbnail
/*!
Loads a thumbnail representation of \a content. The thumbnail will be scaled to \a size
according to the given aspect ratio mode.
*/
QImage QContentStore::thumbnail(const QContent &content, const QSize &size, Qt::AspectRatioMode mode)
{
QImage thumbnail;
QString thumbPath = thumbnailPath(content.fileName());
QFileInfo thumbInfo(thumbPath);
if (thumbInfo.exists()) {
if (thumbInfo.lastModified() > content.lastUpdated())
thumbnail = readThumbnail(thumbPath, size, mode);
} else {
thumbnail = QContentFactory::thumbnail(content, size, mode);
}
if (thumbnail.isNull()) {
if (QIODevice *device = content.open()) {
QImageReader reader(device);
if (reader.canRead()) {
QSize scaledSize = reader.size();
reader.setQuality(25);
if (scaledSize.width() > 128 || scaledSize.height() > 128) {
scaledSize.scale(QSize(128, 128), Qt::KeepAspectRatio);
reader.setQuality( 49 ); // Otherwise Qt smooth scales
reader.setScaledSize(scaledSize);
reader.read(&thumbnail);
if (!thumbnail.isNull()) {
QImageWriter writer(thumbPath, QByteArray::fromRawData("PNG", 3));
writer.setQuality(25);
writer.write(thumbnail);
if (size.isValid())
thumbnail = thumbnail.scaled(size, mode);
}
} else {
if (size.isValid()) {
scaledSize.scale(size, mode);
reader.setQuality( 49 ); // Otherwise Qt smooth scales
reader.setScaledSize(scaledSize);
}
reader.read(&thumbnail);
}
}
delete device;
}
}
if (thumbnail.isNull() && content.type().startsWith(m_audioPrefix)) {
QDir dir = QFileInfo(content.fileName()).absoluteDir();
foreach (const QString &fileName, m_folderThumbnails) {
if (dir.exists(fileName)) {
thumbnail = readThumbnail(dir.absoluteFilePath(fileName), size, mode);
break;
}
}
}
示例2: init
/*!
Constructs a QMimeType from the \l {QContent::}{type()} of \a lnk.
*/
QMimeType::QMimeType( const QContent& lnk )
{
init(lnk.type());
}
示例3: cfg
/*!
Constructs a new WheelBrowserScreen instance with the given \a parent and
widget \a flags.
*/
WheelBrowserScreen::WheelBrowserScreen(QWidget *parent, Qt::WFlags flags)
: QAbstractBrowserScreen(parent, flags),
m_fillAlpha(0), m_hiding(false), m_wheel(0), m_fillTimeline(0)
{
QPalette pal = palette();
pal.setColor(QPalette::Window, QColor(100, 100, 100, 0));
setPalette(pal);
QVBoxLayout * layout = new QVBoxLayout(this);
setLayout(layout);
m_wheel = new QPixmapWheel(this);
QFont f = font();
f.setBold(true);
m_wheel->setFont(f);
m_wheel->setMaximumVisibleIcons(7);
QObject::connect(m_wheel, SIGNAL(moveToCompleted()),
this, SLOT(moveToCompleted()));
QObject::connect(m_wheel, SIGNAL(itemSelected(QString)),
this, SLOT(clicked(QString)));
setFocusProxy(m_wheel);
layout->addStretch(1);
layout->addWidget(m_wheel, 5);
layout->addStretch(1);
m_data = new QPixmapWheelData;
// Load apps
QSettings cfg(Qtopia::defaultButtonsFile(), QSettings::IniFormat);
cfg.beginGroup("Menu"); // No tr
const int menur = cfg.value("Rows",3).toInt();
const int menuc = cfg.value("Columns",3).toInt();
QString menuKeyMap = cfg.value("Map","123456789").toString();
for (int i = 0; i < menur*menuc; i++) {
QChar key = menuKeyMap[i];
QStringList entries = cfg.value(QString(key)).toStringList();
if(!entries.isEmpty()) {
QContent *app = readLauncherMenuItem(entries.first());
if(app) {
QString file = app->fileName();
QString name = app->name();
if(app->type().startsWith("Folder/") )
file = app->type();
QPixmap pix = app->icon().pixmap(QSize(48, 48));
if(file.isEmpty())
file = app->type();
if(!file.isEmpty() && !name.isEmpty() && !pix.isNull()) {
m_data->appendItem(file, pix, name);
}
delete app;
}
}
}
m_fillTimeline = new QTimeLine(2000, this);
QObject::connect(m_fillTimeline, SIGNAL(valueChanged(qreal)),
this, SLOT(timelineStep(qreal)));
}