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


C++ QContent::isValid方法代码示例

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


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

示例1: execute

/*!
    \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

示例2: launcherRightPressed

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

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

示例3: viewVideos

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

示例4: cleanup

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

示例5: 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

示例6: 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

示例7: delayedInit

void CameraMainWindow::delayedInit()
{
    settingsDialog = new QDialog( this );
    settingsDialog->setModal( true );
    settings = new Ui::CameraSettings();
    settings->setupUi( settingsDialog );
    settingsDialog->setObjectName( "settings" );    // To pick up correct help.
    connect( settings->photo_quality, SIGNAL(valueChanged(int)),
             settings->photo_quality_n, SLOT(setNum(int)) );
    QFileSystemFilter *fsf = new QFileSystemFilter;
    fsf->documents = QFileSystemFilter::Set;
    settings->location->setFilter(fsf);
    // load settings from config
    QSettings cfg("Trolltech","Camera");
    cfg.beginGroup("General");
    QString l = cfg.value("location").toString();
    if ( !l.isEmpty() )
        settings->location->setLocation(l);
    else
        settings->location->setLocation(QFileSystem::documentsFileSystem().documentsPath());
    storagepath = settings->location->documentPath();
    cfg.endGroup();
    cfg.beginGroup("Photo");
    int w;
    w = cfg.value("width",camera->videocaptureview->recommendedPhotoSize().width()).toInt();
    for (psize=0; psize<(int)photo_size.count()-1 && photo_size[psize].width() > w;)
        psize++;
    pquality = cfg.value("quality",settings->photo_quality->value()).toInt();
    cfg.endGroup();
    cfg.beginGroup("Video");
    w = cfg.value("width",camera->videocaptureview->recommendedVideoSize().width()).toInt();
    for (vsize=0; vsize<(int)video_size.count()-1 && video_size[vsize].width() > w;)
        vsize++;
    vquality = cfg.value("quality",settings->video_quality->value()).toInt();
    vframerate = cfg.value("framerate",settings->video_framerate->value()).toInt();

    for (int i=0; i<(int)photo_size.count(); i++) {
        settings->photo_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(photo_size[i].width()).arg(photo_size[i].height()));
    }
    for (int i=0; i<(int)video_size.count(); i++) {
        settings->video_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(video_size[i].width()).arg(video_size[i].height()));
    }

    QMimeType m( QLatin1String( "image/jpeg" ));
    QContent a = m.application();
    QIcon picViewIcon = a.icon();
    if ( picViewIcon.isNull() )
        picViewIcon = QIcon( QLatin1String( ":icon/view" ));

    if ( video_supported ) {
        // If video_supported is ever not a constant false then ensure
        // an application is available to handle it
        if ( a.isValid() )
        {
            a_vview = new QAction( QIcon(":image/"+a.iconName()), QString("%1...").arg(a.name()), this );
            connect( a_vview, SIGNAL(triggered()), this, SLOT(viewVideos()) );
        }
    } else {
        a_vview = 0;
    }

    a_pview = new QAction( QIcon(), tr( "View pictures" ), this );
    a_pview->setIcon(picViewIcon);
    connect( a_pview, SIGNAL(triggered()), this, SLOT(viewPictures()) );

    a_timer = new QAction( QIcon( ":icon/wait" ) , tr("Timer"), this );
    connect( a_timer, SIGNAL(triggered()), this, SLOT(takePhotoTimer()) );

    if(camera->videocaptureview->available())
    {
        a_settings = new QAction( QIcon( ":icon/settings" ) , tr("Settings..."), this );
        connect( a_settings, SIGNAL(triggered()), this, SLOT(doSettings()) );
    }

    a_th_edit = new QAction( QIcon(":icon/edit"), tr("Edit"), this );
    connect( a_th_edit, SIGNAL(triggered()), this, SLOT(editThumb()) );
    a_th_del = new QAction( QIcon(":icon/trash"), tr("Delete"), this );
    connect( a_th_del, SIGNAL(triggered()), this, SLOT(delThumb()) );
    a_th_add = new QAction( QIcon(":image/addressbook/AddressBook"), tr("Save to Contact..."), this );
    connect( a_th_add, SIGNAL(triggered()), this, SLOT(moveToContact()) );
    a_send = new QAction( QIcon( ":icon/beam" ), tr("Send to Contact..."), this );
    connect( a_send, SIGNAL(triggered()), this, SLOT(sendFile()) );

    a_zoom = new QAction( QIcon( ), tr("Zoom"), this);
    connect(a_zoom, SIGNAL(triggered()), this, SLOT(showZoom()));
    m_zoom = new QSlider(this);
    m_zoom->setSliderPosition(50);
    m_zoom->setOrientation(Qt::Horizontal);

    m_zoom->setRange(camera->videocaptureview->minZoom(),camera->videocaptureview->maxZoom());
    m_zoom->setValue(0);
    m_zoom->setGeometry(width()*1/5, height()*2/3, 60*width()/100, 40*height()/100);
    m_zoom->hide();

    connect(m_zoom, SIGNAL(valueChanged(int)), this, SLOT(zoomChanged(int)));

    QMenu *contextMenu = QSoftMenuBar::menuFor(this);
    if(camera->videocaptureview->available())
    {
        contextMenu->addAction( a_pview );
//.........这里部分代码省略.........
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:101,代码来源:mainwindow.cpp


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