本文整理汇总了C++中QContent::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ QContent::setType方法的具体用法?C++ QContent::setType怎么用?C++ QContent::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QContent
的用法示例。
在下文中一共展示了QContent::setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catman
QContent *WheelBrowserScreen::readLauncherMenuItem(const QString &entry)
{
QContent *applnk = 0;
if (entry.right(8)==".desktop") {
// There used to be a quick way to locate a .desktop file
// Now we have to create a QContentSet and iterate over the items
// The path to the apps folder (which only exists in the database)
QString apps = Qtopia::qtopiaDir()+"apps/";
// We need the full path to the entry to compare against the items we get from QContentSet
QString entryPath = apps+entry;
applnk = new QContent( entryPath, false );
if ( applnk->id() == QContent::InvalidId ) {
delete applnk;
applnk = 0;
}
} else {
QCategoryManager catman("Applications");
if(catman.contains(entry))
{
applnk = new QContent();
applnk->setName(catman.label(entry));
applnk->setIcon(catman.iconFile(entry));
applnk->setType("Folder/"+entry);
}
else
applnk = NULL;
}
return applnk;
}
示例2: takePhotoNow
void CameraMainWindow::takePhotoNow()
{
QImage img = camera->videocaptureview->image();
if ( snapRequest != 0 ) {
// Rescale the image and pop it into a QDSData object
QImage scaledimg = img.scaled( snap_max,
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
QByteArray savedImageData;
{
QDataStream stream( &savedImageData, QIODevice::WriteOnly );
stream << QPixmap::fromImage( scaledimg );
}
QDSData snappedImage( savedImageData, QMimeType( "image/x-qpixmap" ) );
// Send response with the data
snapRequest->respond( snappedImage );
// Reset snap mode
setSnapMode( false );
delete snapRequest;
snapRequest = 0;
// Finished serving QDS request so close the application
close();
hideWaitScreen();
} else {
showWaitScreen();
QContent f;
QList<QString> c;
f.setType("image/jpeg");
f.setName(tr("Photo, %1","date")
.arg(QTimeString::localYMDHMS(QDateTime::currentDateTime(),QTimeString::Short)));
f.setMedia( settings->location->documentPath() );
c.append(camcat);
f.setCategories(c);
QIODevice* contentDevice = f.open(QIODevice::WriteOnly);
if (contentDevice != 0)
{
QImage temp = img.convertToFormat(QImage::Format_RGB32);
temp.save(contentDevice, "JPEG", pquality);
contentDevice->close();
f.commit();
pushThumb(f, img);
hideWaitScreen();
}
else
{
QString errorText = f.errorString();
if (errorText.isEmpty())
errorText = tr("Unknown error");
QMessageBox::warning(0,
tr("Error saving photo"),
tr("Could not save photo: %1").arg(errorText));
}
}
preview();
}