本文整理汇总了C++中BookmarkItem::isUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarkItem::isUrl方法的具体用法?C++ BookmarkItem::isUrl怎么用?C++ BookmarkItem::isUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BookmarkItem
的用法示例。
在下文中一共展示了BookmarkItem::isUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readBookmarks
void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* parent)
{
Q_ASSERT(parent);
foreach (const QVariant &entry, list) {
const QVariantMap map = entry.toMap();
const QString typeString = map.value("type").toString();
BookmarkItem::Type type;
if (typeString == QLatin1String("url")) {
type = BookmarkItem::Url;
}
else if (typeString == QLatin1String("folder")) {
type = BookmarkItem::Folder;
}
else {
continue;
}
BookmarkItem* item = new BookmarkItem(type, parent);
item->setTitle(map.value("name").toString());
if (item->isUrl()) {
item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray()));
}
if (map.contains("children")) {
readBookmarks(map.value("children").toList(), item);
}
}
}
示例2: data
QVariant BookmarksModel::data(const QModelIndex &index, int role) const
{
BookmarkItem* itm = item(index);
if (!itm) {
return QVariant();
}
switch (role) {
case TypeRole:
return itm->type();
case UrlRole:
return itm->url();
case UrlStringRole:
return itm->urlString();
case TitleRole:
return itm->title();
case DescriptionRole:
return itm->description();
case KeywordRole:
return itm->keyword();
case VisitCountRole:
return -1;
case ExpandedRole:
return itm->isExpanded();
case SidebarExpandedRole:
return itm->isSidebarExpanded();
case Qt::ToolTipRole:
if (index.column() == 0 && itm->isUrl()) {
return QString("%1\n%2").arg(itm->title(), QString::fromUtf8(itm->url().toEncoded()));
}
case Qt::DisplayRole:
switch (index.column()) {
case 0:
return itm->title();
case 1:
return itm->url().toEncoded();
default:
return QVariant();
}
case Qt::DecorationRole:
if (index.column() == 0) {
return itm->icon();
}
return QVariant();
default:
return QVariant();
}
}