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


C++ setRoleNames函数代码示例

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


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

示例1: AbstractTwitterModel

AbstractStatusesModel::AbstractStatusesModel(QObject *parent)
    : AbstractTwitterModel(parent)
    , m_count(0)
    , m_trim_user(false)
    , m_include_entities(true)
    , m_contributor_details(false)
{
    QHash<int, QByteArray> roles;
    roles[ContributorsRole] = "contributors";
    roles[CoordinatesRole] = "coordinates";
    roles[created_at_role] = "created_at";
    roles[EntitiesRole] = "entities";
    roles[FavoritedRole] = "favorited";
    roles[GeoRole] = "geo";
    roles[id_role] = "id";
    roles[id_str_role] = "id_str";
    roles[in_reply_to_screen_nameRole] = "in_reply_to_screen_name";
    roles[in_reply_to_status_idRole] = "in_reply_to_status_id_str";
    roles[InReplyTouser_idRole] = "in_reply_to_user_id_str";
    roles[PlaceRole] = "place";
    roles[possibly_sensitiveRole] = "possibly_sensitive";
    roles[retweet_countRole] = "retweet_count";
    roles[RetweetedRole] = "retweeted";
    roles[retweeted_statusRole] = "retweeted_status";
    roles[SourceRole] = "source";
    roles[TextRole] = "text";
    roles[plain_textRole] = "plain_text";
    roles[rich_textRole] = "rich_text";
    roles[TruncatedRole] = "truncated";
    roles[UserRole] = "user";
    roles[MediaRole] = "media";
    setRoleNames(roles);
}
开发者ID:yuntan,项目名称:twitter4qml,代码行数:33,代码来源:abstractstatusesmodel.cpp

示例2: m_loading

CommandModel::CommandModel() :
    m_loading(false)
{
    QHash<int, QByteArray> names = roleNames();
    names.insert(Qt::UserRole, "trigger");
    setRoleNames(names);
}
开发者ID:KDE,项目名称:simon-tools,代码行数:7,代码来源:commandmodel.cpp

示例3: QAbstractListModel

LanguageListModel::LanguageListModel(QObject *parent)
    : QAbstractListModel(parent)
{
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
    setRoleNames(roleNames());
#endif
}
开发者ID:trajkopetko,项目名称:taot,代码行数:7,代码来源:languagelistmodel.cpp

示例4: QAbstractListModel

PowerModel::PowerModel(QObject *parent)
: QAbstractListModel(parent)
{
    QHash<int, QByteArray> roles;
    roles.insert(Qt::DisplayRole, "label");
    roles.insert(Qt::DecorationRole, "icon");
    setRoleNames(roles);

    PowerAction shutdown;
    shutdown.name = i18nc("an action", "Shutdown");
    shutdown.type = Shutdown;
    shutdown.iconName = "system-shutdown";
    m_powerList.append(shutdown);

    PowerAction restart;
    restart.name = i18nc("an action", "Restart");
    restart.type = Restart;
    restart.iconName = "system-reboot";
    m_powerList.append(restart);

    PowerAction suspend;
    suspend.name = i18nc("an action", "Suspend");
    suspend.type = Suspend;
    suspend.iconName = "system-suspend";
    m_powerList.append(suspend);

    PowerAction hibernate;
    hibernate.name = i18nc("an action", "Hibernate");
    hibernate.type = Hibernate;
    hibernate.iconName = "system-suspend-hibernate";
    m_powerList.append(hibernate);
    emit countChanged();
}
开发者ID:kursusHC,项目名称:homerun,代码行数:33,代码来源:powermodel.cpp

示例5: QAbstractListModel

TechnologyModel::TechnologyModel(QAbstractListModel* parent)
  : QAbstractListModel(parent),
    m_manager(NULL),
    m_tech(NULL),
    m_scanning(false),
    m_changesInhibited(false),
    m_uneffectedChanges(false),
    m_scanResultsReady(false)
{
    m_manager = NetworkManagerFactory::createInstance();

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(roleNames());
#endif
    connect(m_manager, SIGNAL(availabilityChanged(bool)),
            this, SLOT(managerAvailabilityChanged(bool)));

    connect(m_manager,
            SIGNAL(technologiesChanged()),
            this,
            SLOT(updateTechnologies()));

    connect(m_manager,
            SIGNAL(servicesChanged()),
            this,
            SLOT(updateServiceList()));
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:27,代码来源:technologymodel.cpp

示例6: QAbstractListModel

ReverseTranslationsModel::ReverseTranslationsModel(QObject *parent)
    : QAbstractListModel(parent)
{
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
    setRoleNames(roleNames());
#endif
}
开发者ID:leppa,项目名称:taot,代码行数:7,代码来源:reversetranslationsmodel.cpp

示例7: QAbstractListModel

AttachmentListModel::AttachmentListModel(QObject *parent) :
    QAbstractListModel(parent)
  , m_messageId(QMailMessageId())
{
    roles.insert(ContentLocation, "contentLocation");
    roles.insert(DisplayName, "displayName");
    roles.insert(Downloaded, "downloaded");
    roles.insert(MimeType, "mimeType");
    roles.insert(Size, "size");
    roles.insert(StatusInfo, "statusInfo");
    roles.insert(Url, "url");
    roles.insert(ProgressInfo, "progressInfo");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(roles);
#endif

    connect(EmailAgent::instance(), SIGNAL(attachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus)),
            this, SLOT(onAttachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus)));

    connect(EmailAgent::instance(), SIGNAL(attachmentDownloadProgressChanged(QString,int)),
            this, SLOT(onAttachmentDownloadProgressChanged(QString,int)));

    connect(EmailAgent::instance(), SIGNAL(attachmentUrlChanged(QString,QString)),
            this, SLOT(onAttachmentUrlChanged(QString,QString)));
}
开发者ID:kananoja,项目名称:nemo-qml-plugin-email,代码行数:25,代码来源:attachmentlistmodel.cpp

示例8: QStringListModel

TranslationServicesModel::TranslationServicesModel(const QStringList &strings, QObject *parent)
    : QStringListModel(strings, parent)
{
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
    setRoleNames(roleNames());
#endif
}
开发者ID:trajkopetko,项目名称:taot,代码行数:7,代码来源:translationservicesmodel.cpp

示例9: QAbstractListModel

BrowseModelPrivate::BrowseModelPrivate(ServiceProxyCall *call,
                                       const QString  &protocolInfo,
                                       BrowseModel *parent)
    : QAbstractListModel(parent)
    , m_currentOffset(0)
    , m_busy(true)
    , m_done(false)
    , m_protocolInfo(protocolInfo)
    , m_lastIndex(-1)
    , m_call(call)
    , m_settings()
    , q_ptr(parent)
{
    QHash<int, QByteArray> roles;

    roles[BrowseRoleTitle] = "title";
    roles[BrowseRoleId] = "upnpId";
    roles[BrowseRoleUPnPClass] = "upnpClass";
    roles[BrowseRoleIcon] = "icon";
    roles[BrowseRoleType] = "type";
    roles[BrowseRoleDetail] = "detail";
    roles[BrowseRoleURI] = "uri";
    roles[BrowseRoleMetaData] = "metadata";
    roles[BrowseRoleFilter] = "filter";
    setRoleNames(roles);

    qDebug() << "Created browse model";
    if (m_call != 0) {
        connect(m_call, SIGNAL(ready()), SLOT(onCallReady()));
        m_call->setParent(this);
    }

    connect(&m_settings, SIGNAL(filterInDetailsChanged()), SLOT(onFilterInDetailsChanged()));
}
开发者ID:phako,项目名称:Helium,代码行数:34,代码来源:browsemodel_p.cpp

示例10: QAbstractListModel

DocumentListModel::DocumentListModel(QObject *parent)
    : QAbstractListModel(parent), m_searchThread(0), m_groupBy(GroupByName), m_filter(UnknownType)
{
    QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames();
    roleNames[FileNameRole] = "fileName";
    roleNames[FilePathRole] = "filePath";
    roleNames[DocTypeRole] = "docType";
    roleNames[SectionCategoryRole] = "sectionCategory";
    roleNames[FileSizeRole] = "fileSize";
    roleNames[AuthorNameRole] = "authorName";
    roleNames[AccessedTimeRole] = "accessedTime";
    roleNames[ModifiedTimeRole] = "modifiedTime";
    roleNames[UUIDRole] = "uuid";
    setRoleNames(roleNames);

    m_docTypes["odt"] = TextDocumentType;
    m_docTypes["doc"] = TextDocumentType;
    m_docTypes["docx"] = TextDocumentType;
    m_docTypes["odp"] = PresentationType;
    m_docTypes["ppt"] = PresentationType;
    m_docTypes["pptx"] = PresentationType;
    m_docTypes["ods"] = SpreadsheetType;
    m_docTypes["xls"] = SpreadsheetType;
    m_docTypes["xlsx"] = SpreadsheetType;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:25,代码来源:documentlistmodel.cpp

示例11: QAbstractItemModel

DirModel::DirModel(QObject *parent)
    : QAbstractItemModel(parent)
    , d(new DirModelPrivate(this))

{
//    QThread* workerThread = new QThread(this);
//    d->moveToThread(workerThread);
//    workerThread->start();

    QHash<int, QByteArray>roleNames;
    roleNames[Qt::DecorationRole]      = "decoration";
    roleNames[DirModel::Name]          = "Name";
//    roleNames[DirModel::Size]          = "Size";
    roleNames[DirModel::ModifiedTime]  = "ModifiedTime";
    roleNames[DirModel::Permissions]   = "Permissions";
    roleNames[DirModel::Owner]         = "Owner";
    roleNames[DirModel::Group]         = "Group";
    roleNames[DirModel::Type]          = "Type"; // Type == item.mimeComment() ... yeah, go figure that one out.
    roleNames[DirModel::ColumnCount]   = "ColumnCount";
    roleNames[DirModel::UrlRole]       = "Url";
    roleNames[DirModel::MimeTypeRole]  = "MimeType";
    roleNames[DirModel::IconName]      = "IconName";
    roleNames[DirModel::BaseName]      = "BaseName";
    roleNames[DirModel::Extension]     = "Extension";
    roleNames[DirModel::TimeString]    = "TimeString";
    roleNames[DirModel::MimeOrThumb]   = "MimeOrThumb";
    setRoleNames(roleNames);
}
开发者ID:markg85,项目名称:Porpoise,代码行数:28,代码来源:dirmodel.cpp

示例12: QAbstractListModel

HistoryModel::HistoryModel(QObject *parent)
    : QAbstractListModel(parent)
{
    // Set role names to access data from QML
    QHash<int, QByteArray> roles;
    roles[TimeRole] = "time";
    roles[HeartRateRole] = "heartRate";
    setRoleNames(roles);

    // Read info file if is exists
    QFile historyFile("/home/user/MyDocs/heartrate.csv");
    if (historyFile.exists() && historyFile.open(QIODevice::ReadOnly)) {
        QTextStream in(&historyFile);
        while (!in.atEnd()) {
            QString line = in.readLine();
            QStringList values = line.split(" ");
            if (values.length() > 1) {
                QDateTime time = QDateTime::fromString(values[0], Qt::ISODate);
                int value = values[1].toInt();
                HeartRateMeasurement measurement(time, value);
                m_data.append(measurement);
            }
        }
        historyFile.close();
    }
}
开发者ID:mikkomeh,项目名称:N9-heart-rate-monitor,代码行数:26,代码来源:historymodel.cpp

示例13: QAbstractListModel

KnotsDirectory::KnotsDirectory( QObject *parent )
    : QAbstractListModel( parent )
    , _xmlReader(0)
    , _xmlSource(0)
    , _currentDownload(0)
    , _parser(0)
{
    _roles[IdRole] = "id";
    _roles[NameRole] = "name";
    _roles[ImageRole] = "thumbnail";
    _roles[WidthRole] = "width";
    _roles[HeightRole] = "height";
    _roles[ViewsRole] = "views";
    _roles[AddedRole] = "addedOn";
    _roles[DurationRole] = "duration";
    _roles[LastViewedPositionRole] = "lastposition";
    _roles[MediaIdRole] = "mediaId";



    setRoleNames(_roles);

    _parser = new SaxKnotsItemHandler();
    _parser->setItemHandler(this);

    connect(&Knots::instance().serverConnection(), SIGNAL(finished(QNetworkReply*)),SLOT(onDirectoryFetchFinished(QNetworkReply*)));

}
开发者ID:andyleadbetter,项目名称:qtknots,代码行数:28,代码来源:knotsdirectory.cpp

示例14: QAbstractListModel

ResultModel::ResultModel(QObject *parent)
    : QAbstractListModel(parent), m_historyIndex(-1)
{    
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(roleNames());
#endif
}
开发者ID:KDE,项目名称:abakus,代码行数:7,代码来源:resultmodel.cpp

示例15: QAbstractListModel

PlaceModel::PlaceModel(QObject *parent)
    : QAbstractListModel(parent)
{
    QList<QDesktopServices::StandardLocation> locations;
    locations << QDesktopServices::DocumentsLocation;
    locations << QDesktopServices::MusicLocation;
    locations << QDesktopServices::MoviesLocation;
    locations << QDesktopServices::PicturesLocation;

    foreach (QDesktopServices::StandardLocation location, locations) {
        const QString path = QDesktopServices::storageLocation(location);
        QDir dir(path);
        if (path.isEmpty() || dir == QDir::home())
            continue;

        // do not use "path" directly, on Windows it uses back slashes
        // where the rest of Qt uses forward slashes
        m_paths << dir.path();
    }

    // set role names
    QHash<int, QByteArray> roleNames;
    roleNames.insert(ChatModel::AvatarRole, "avatar");
    roleNames.insert(ChatModel::NameRole, "name");
    roleNames.insert(ChatModel::JidRole, "url");
    setRoleNames(roleNames);
}
开发者ID:tshipa,项目名称:wilink,代码行数:27,代码来源:places.cpp


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