当前位置: 首页>>代码示例>>C++>>正文


C++ QContent类代码示例

本文整理汇总了C++中QContent的典型用法代码示例。如果您正苦于以下问题:C++ QContent类的具体用法?C++ QContent怎么用?C++ QContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m

void CameraMainWindow::viewVideos()
{
    QMimeType m( QLatin1String( "video/mpeg" ));
    QContent a = m.application();
    if ( a.isValid() )
        a.execute();
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:7,代码来源:mainwindow.cpp

示例2: qLog

/*!
    \reimp
*/
bool QFSContentEngine::execute( const QStringList &arguments ) const
{
#ifndef QTOPIA_CONTENT_INSTALLER
    if( role() == QContent::Application )
    {
        qLog(DocAPI) << "QFSContentEngine::execute" << Qtopia::dehyphenate(name()) << fileName() << arguments;

        Qtopia::execute( fileName(), arguments.count() ? arguments[0] : QString() );

        return true;
    }
    else
    {
        QContent app = mimeType().application();

        if ( app.isValid() )
        {
            app.execute( QStringList() << arguments << fileName() );

            return true;
        }
}
#else
    Q_UNUSED(arguments)
#endif

    return false;
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:31,代码来源:qfscontentengine.cpp

示例3: updateFinished

void DocumentListSelectionPage::updateFinished()
{
    largeDocuments->clear();

    selectedSize = 0;
    selectedDocuments = 0;
    for (int i = 0; i < documents->count(); i++) {
        const QContent content = documents->content(i);
        if (content.size() >= field("documentsTypeSelectionPage_minimumSize").toInt() * 1024) {
            largeDocuments->add(content);

            selectedSize += content.size();
            selectedDocuments++;
        }
    }

    list->resizeColumnsToContents();
    list->setColumnWidth(0, list->viewport()->size().width() - list->columnWidth(1) - 10);
    list->setCurrentIndex(largeModel->index(0, 0));

    updateHeader();

    if (waitWidget) {
        delete waitWidget;
        waitWidget = 0;
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:27,代码来源:cleanupwizard.cpp

示例4: QContent

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;
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:32,代码来源:wheelbrowser.cpp

示例5: execToContent

/*!
  Given an application binary name \a bin return the QContentId of the QContent record
  for that application.  If \a bin is the fully qualified path of an ordinary file the
  QContentId of that file will be returned.

  If \a bin does not refer to any application or file in the backing store then an
  InvalidId will be returned.

  Note that binary names are unique across Qtopia.
 */
QContentId QContent::execToContent( const QString& bin )
{
    QContent content = QContentStore::instance()->contentFromFileName( bin, QContentStore::Lookup );

    if( !content.isNull() )
        return content.id();
    else
        return QContent::InvalidId;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:19,代码来源:qcontent.cpp

示例6: Q_ASSERT

void ThumbnailDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
    Q_ASSERT(index.isValid());
    const QContentSetModel *model = qobject_cast< const QContentSetModel * >( index.model() );
    Q_ASSERT(model);

    QStyleOptionViewItem opt = option;

    // set text alignment
    opt.displayAlignment = Qt::AlignCenter;

    // do layout
    QContent content = model->content( index );
    QPixmap pixmap;

    if( content.fileKnown() ) {
        pixmap = repository_->thumbnail( ThumbnailRequest( index, content.file(), option.decorationSize, content.lastUpdated() ) );
    }
    if( pixmap.isNull() ) {
        QIcon icon = qvariant_cast<QIcon>(model->data(index, Qt::DecorationRole));
        pixmap = icon.pixmap( option.decorationSize );
    }
    QRect pixmapRect = QRect(0, 0, option.decorationSize.width(),
                           option.decorationSize.height());

    QFontMetrics fontMetrics(opt.font);
    QString text = model->data(index, Qt::DisplayRole).toString();
    QRect textRect(0, 0, option.decorationSize.width(), fontMetrics.lineSpacing());

    QVariant value = model->data(index, Qt::CheckStateRole);
    QRect checkRect = check(opt, opt.rect, value);
    Qt::CheckState checkState = static_cast<Qt::CheckState>(value.toInt());

    doLayout(opt, &checkRect, &pixmapRect, &textRect, false);

    // draw the background color
    if (option.showDecorationSelected && (option.state & QStyle::State_Selected)) {
        QPalette::ColorGroup cg = option.state & QStyle::State_Enabled
                                  ? QPalette::Normal : QPalette::Disabled;
        painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
    } else {
        value = model->data(index, Qt::BackgroundColorRole);
        if (value.isValid() && qvariant_cast<QColor>(value).isValid())
            painter->fillRect(option.rect, qvariant_cast<QColor>(value));
    }

    // draw the item
    drawCheck(painter, opt, checkRect, checkState);
    drawDecoration(painter, opt, pixmapRect, pixmap);
    drawDisplay(painter, opt, textRect, text);
    drawFocus(painter, opt, textRect);
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:52,代码来源:thumbnailview_p.cpp

示例7: connect

void DocumentListSelectionPage::cleanup()
{
    connect(documentsCleanupDialog->pushButton, SIGNAL(clicked()), this, SLOT(stopCleanup()));

    documentsCleanupDialog->progressBar->setRange(0, selectedSize);

    if (largeModel->rowCount() == 0)
        return;

    qLog(CleanupWizard) << "Deleting Documents...";
    for (int i = 0; i < largeModel->rowCount(); i++) {
        if (cleanupStopped)
            break;

        QModelIndex index = largeModel->index(i, 0);

        if (largeModel->data(index, Qt::CheckStateRole) == Qt::Checked) {
            QContent content = largeModel->content(index);

            documentsCleanupDialog->label->setText(tr("Deleting %1").arg(content.name()));

            qApp->processEvents();

            int contentSize = content.size();

            content.removeFiles();

            if (!content.isValid()) {
                documentsCleanupDialog->progressBar->setValue(
                    documentsCleanupDialog->progressBar->value() + contentSize);

                docDeleted++;
            }
        }
    }

    documentsCleanupDialog->pushButton->hide();
    if (cleanupStopped) {
        documentsCleanupDialog->label->setText(tr("Aborted"));
    } else {
        documentsCleanupDialog->progressBar->setValue(
            documentsCleanupDialog->progressBar->maximum());
        documentsCleanupDialog->label->setText(tr("Done"));
        documents->clear();
    }

    QTimer::singleShot(1000, documentsCleanupDialog, SLOT(close()));
    emit documentsDeleted(docDeleted, cleanupStopped);
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:49,代码来源:cleanupwizard.cpp

示例8: execute

/*!
  Returns the name of the name of the application that will be launched if the QContent is executed.

  If the QContent is an application this is the name of the binary, if it is a document it is the
  executable name of the application associated with the document MIME type.

  If the content is not an application and there is no associated application associated with its
  MIME type then a null string will be returned.

  \sa execute()
 */
QString QContent::executableName() const
{
    if( role() == Application )
    {
        return d->fileName();
    }
    else
    {
        QContent app = d->mimeType().application();
        if ( app.id() != InvalidId )
            return app.executableName();
        else
            return QString();
    }
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:26,代码来源:qcontent.cpp

示例9: documentSelected

/*
 * Respond to the documentSelected signal from the appSelector, by displaying
 * information about the selected application.
 */
void AppViewer::documentSelected( const QContent &appContent )
{
    appSelector->hide();
    if ( appContent.isValid() )
    {
        textArea->setHtml( getInformation( appContent ));
    }
    else
    {
        textArea->setHtml(
                tr( "<font color=\"#CC0000\">Could not find information about %1</font>" )
                .arg( appContent.name() ));
        qWarning() << "Application " << appContent.file() << " not found";
    }
}
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:19,代码来源:appviewer.cpp

示例10: launcherRightPressed

void ApplicationLauncherView::launcherRightPressed(QContent lnk)
{
    if(!lnk.isValid())
        return;

    rightMenu->popup(QCursor::pos());
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:7,代码来源:launcherview.cpp

示例11: getInformation

/*
 * Find information about an Application, including what other installed applications
 * there are which have binaries bigger or smaller than this one.
 * Pre-requisite - the appContent is valid, ie has a backing file.
 */
QString AppViewer::getInformation( const QContent &appContent )
{
    QFileInfo fi( appContent.file() );
    QString info = tr( "Binary is: <b>%1</b><br>" ).arg( fi.fileName() );

    qint64 chosenAppSize = fi.size();
    info += tr( "Size is: <b>%1 bytes</b><br>" ).arg( chosenAppSize );

    enum Count { SMALL, LARGE };
    int qtopiaCounts[2] = { 0, 0 };
    int packageCounts[2] = { 0, 0 };
    int *currentCount;
    QStringList paths = Qtopia::installPaths();
    foreach ( QString p, paths )
    {
        QDir qDir( p + "bin" );
        qDebug( "Checking %s\n", qPrintable( qDir.path() ));
        if ( qDir.exists() )
        {
            QFileInfoList binaries = qDir.entryInfoList( QDir::Executable );
            currentCount = ( p == Qtopia::packagePath() ) ? packageCounts : qtopiaCounts;
            foreach ( QFileInfo f, binaries )
                if ( f.size() > chosenAppSize )
                    ++currentCount[LARGE];
                else
                    ++currentCount[SMALL];
        }
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:32,代码来源:appviewer.cpp

示例12: documentSelected

void TextViewer::documentSelected(const QContent & docContent)
{
    // make use of the document selected by the QDocumentSelector widget
    docSelector->hide();
    if (docContent.isValid()){
        QFile f(docContent.file());
        if (f.open(QIODevice::ReadOnly)){
            QTextStream fstream(&f);
            textArea->setHtml(fstream.readAll());
        }else{
            qWarning() << "Unable to read content from file" << docContent.file();
        }

    }else{
        qWarning()<< "Document " << docContent.file() << " is invalid";
    }
}
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:17,代码来源:textviewer.cpp

示例13: copyContent

/*!
    Copies the contents of \a from to this QContent.

    Returns true is successful, otherwise false.
 */
bool QContent::copyContent(const QContent &from)
{
    QFile source( from.fileName() );

    if( source.copy( fileName() ) )
        return true;

    return false;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:14,代码来源:qcontent.cpp

示例14: saveImage

bool ScribbleArea::saveImage(const QString &fileName, const char *fileFormat)
{
    QImage visibleImage = image;
    if (visibleImage.save(fileName, fileFormat)) {
            // Create new doc link
        QContent lnk;
          // Perserve name and category
        lnk.setName(QFileInfo(fileName).baseName() );
          //   lnk.setCategories( _lnk.categories() );
        lnk.setFile( fileName );
        lnk.commit();

        modified = false;
        return true;
    } else {
        return false;
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:18,代码来源:scribblearea.cpp

示例15: notifyUseEmbeddedPreview

/*!
    Displays a prompt informing the user that the \a content cannot be rendered due to invalid rights and that
    a preview will be rendered instead.
*/
void BSciPrompts::notifyUseEmbeddedPreview( const QContent &content ) const
{
    QString title   = tr( "Preview" );
    QString message = tr( "'%1' is inaccessible, a preview version will be opened instead.", "%1 = name of content" )
            .arg( content.name() );

    message = QString( "<qt>%1</qt>" ).arg( message );

    information( title, message );
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:14,代码来源:bsciprompts.cpp


注:本文中的QContent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。