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


C++ QStandardItem::type方法代码示例

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


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

示例1: OnTreeViewContextMenu

void MainWin::OnTreeViewContextMenu(const QPoint &point)
{
    if (point.isNull()) 
        return;

    QStandardItem *item = connections->itemFromIndex(
        ui.serversTreeView->indexAt(point)
        );    

    QPoint currentPoint = QCursor::pos(); 

    if (!item || currentPoint.isNull() || treeViewUILocked)
        return;

    int type = item->type();

    if (type == RedisServerItem::TYPE) {

        if (((RedisServerItem*)item)->isLocked()) {
            QMessageBox::warning(ui.serversTreeView, "Warning", "Performing operations. Please Keep patience.");
            return;
        }

        QAction * action = serverMenu->exec(currentPoint);

        if (action == nullptr)
            return;
            
        if (action->text() == "Reload")
            treeViewUILocked = true;
        
    } else if (type == RedisKeyItem::TYPE) {
        keyMenu->exec(currentPoint);
    }
}
开发者ID:felipeg48,项目名称:RedisDesktopManager,代码行数:35,代码来源:application.cpp

示例2: onItemDoubleClicked

void RepoTreeView::onItemDoubleClicked(const QModelIndex& index)
{
    QStandardItem *item = getRepoItem(index);
    if (!item) {
        return;
    }
    if (item->type() == REPO_ITEM_TYPE) {
        RepoItem *it = (RepoItem *)item;
        const LocalRepo& local_repo = it->localRepo();
        if (local_repo.isValid()) {
            // open local folder for downloaded repo
            QDesktopServices::openUrl(QUrl::fromLocalFile(local_repo.worktree));
        } else {
            // open seahub repo page for not downloaded repo
            // if (seafApplet->isPro()) {
            FileBrowserDialog* dialog = new FileBrowserDialog(it->repo(), this);
            const QRect screen = QApplication::desktop()->screenGeometry();
            dialog->setAttribute(Qt::WA_DeleteOnClose, true);
            dialog->show();
            dialog->move(screen.center() - dialog->rect().center());
            dialog->raise();
            // } else {
            //     const Account& account = seafApplet->accountManager()->accounts()[0];
            //     if (account.isValid()) {
            //         QUrl url = account.getAbsoluteUrl("repo/" + it->repo().id);
            //         QDesktopServices::openUrl(url);
            //     }
            // }
        }
    }
}
开发者ID:xudaiqing,项目名称:seafile-client,代码行数:31,代码来源:repo-tree-view.cpp

示例3: filterAcceptsRow

bool LibraryFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
	if (filterAcceptsRowItself(sourceRow, sourceParent)) {
		return true;
	}

	// Accept if any of the parents is accepted on it's own merits
	QModelIndex parent = sourceParent;
	while (parent.isValid()) {
		if (filterAcceptsRowItself(parent.row(), parent.parent())) {
			return true;
		}
		parent = parent.parent();
	}

	// Accept if any of the children is accepted on it's own merits
	if (hasAcceptedChildren(sourceRow, sourceParent)) {
		return true;
	}

	// Accept separators if any top level items and its children are accepted
	QStandardItemModel *model = qobject_cast<QStandardItemModel*>(sourceModel());
	QStandardItem *item = model->itemFromIndex(model->index(sourceRow, 0, sourceParent));
	if (item && item->type() == Miam::IT_Separator) {
		for (QModelIndex index : _topLevelItems.values(static_cast<SeparatorItem*>(item))) {
			if (filterAcceptsRow(index.row(), sourceParent)) {
				return true;
			}
		}
	}
	return (SettingsPrivate::instance()->librarySearchMode() == SettingsPrivate::LSM_HighlightOnly);
}
开发者ID:arnolddumas,项目名称:Miam-Player,代码行数:32,代码来源:libraryfilterproxymodel.cpp

示例4: OnConnectionTreeClick

void MainWin::OnConnectionTreeClick(const QModelIndex & index)
{
    if (treeViewUILocked || !index.isValid())
        return;

    QStandardItem * item = connections->itemFromIndex(index);

    int type = item->type();

    switch (type) {
    case RedisServerItem::TYPE:
    {
        RedisServerItem * server = (RedisServerItem *)item;
        server->runDatabaseLoading();
        ui.serversTreeView->setExpanded(index, true);
    }
    break;

    case RedisServerDbItem::TYPE:
    {
        performanceTimer.start();
        RedisServerDbItem * db = (RedisServerDbItem *)item;
        connections->blockSignals(true);
        statusBar()->showMessage(QString("Loading keys ..."));
        db->loadKeys();
        ui.serversTreeView->setExpanded(index, true);
    }
    break;

    case RedisKeyItem::TYPE:
        ui.tabWidget->openKeyTab((RedisKeyItem *)item);
        break;
    }
}
开发者ID:n2bh,项目名称:RedisDesktopManager,代码行数:34,代码来源:application.cpp

示例5: viewportEvent

bool RepoTreeView::viewportEvent(QEvent *event)
{
    if (event->type() != QEvent::ToolTip && event->type() != QEvent::WhatsThis) {
        return QTreeView::viewportEvent(event);
    }

    QPoint global_pos = QCursor::pos();
    QPoint viewport_pos = viewport()->mapFromGlobal(global_pos);
    QModelIndex index = indexAt(viewport_pos);
    if (!index.isValid()) {
        return true;
    }

    QStandardItem *item = getRepoItem(index);
    if (!item) {
        return true;
    }

    QRect item_rect = visualRect(index);
    if (item->type() == REPO_ITEM_TYPE) {
        showRepoItemToolTip((RepoItem *)item, global_pos, item_rect);
    } else {
        showRepoCategoryItemToolTip((RepoCategoryItem *)item, global_pos, item_rect);
    }

    return true;
}
开发者ID:xudaiqing,项目名称:seafile-client,代码行数:27,代码来源:repo-tree-view.cpp

示例6: OnKeyOpenInNewTab

void MainWin::OnKeyOpenInNewTab()
{
    QStandardItem * item = ui.serversTreeView->getSelectedItem();    

    if (item == nullptr || item->type() != RedisKeyItem::TYPE) 
        return;    

    ui.tabWidget->openKeyTab((RedisKeyItem *)item, true);
}
开发者ID:felipeg48,项目名称:RedisDesktopManager,代码行数:9,代码来源:application.cpp

示例7:

bool RedisServerDbItem::operator<(const QStandardItem & other) const
{
     if (other.type() == TYPE) {
        const RedisServerDbItem * another = dynamic_cast<const RedisServerDbItem *>(&other); 

        return this->dbIndex < another->getDbIndex();
     }    

     return this->text() < other.text();
}
开发者ID:KingLee2015,项目名称:RedisDesktopManager,代码行数:10,代码来源:RedisServerDbItem.cpp

示例8: collapse

void RepoTreeView::collapse(const QModelIndex& index, bool remember)
{
    QTreeView::collapse(index);
    if (remember) {
        QStandardItem *item = getRepoItem(index);
        if (item->type() == REPO_CATEGORY_TYPE) {
            expanded_categroies_.remove(item->data(Qt::DisplayRole).toString());
        }
    }
}
开发者ID:xudaiqing,项目名称:seafile-client,代码行数:10,代码来源:repo-tree-view.cpp

示例9: OnConnectionTreeWheelClick

void MainWin::OnConnectionTreeWheelClick(const QModelIndex & index)
{
    if (!index.isValid())
        return;

    QStandardItem * item = connections->itemFromIndex(index);    

    if (item->type() == RedisKeyItem::TYPE) {
        ui.tabWidget->openKeyTab((RedisKeyItem *)item, true);
    }
}
开发者ID:felipeg48,项目名称:RedisDesktopManager,代码行数:11,代码来源:application.cpp

示例10: filterAcceptsRow

bool RepoFilterProxyModel::filterAcceptsRow(int source_row,
                        const QModelIndex & source_parent) const
{
    RepoTreeModel *tree_model = (RepoTreeModel *)(sourceModel());
    QModelIndex index = tree_model->index(source_row, 0, source_parent);
    QStandardItem *item = tree_model->itemFromIndex(index);
    if (item->type() == REPO_CATEGORY_TYPE) {
        // RepoCategoryItem *category = (RepoCategoryItem *)item;
        // We don't filter repo categories, only filter repos by name.
        return true;
    } else if (item->type() == REPO_ITEM_TYPE) {
        // Use default filtering (filter by item DisplayRole, i.e. repo name)
        bool match = QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
        // if (match) {
        //     RepoCategoryItem *category = (RepoCategoryItem *)(item->parent());
        // }
        return match;
    }

    return false;
}
开发者ID:DevCybran,项目名称:seafile-client,代码行数:21,代码来源:repo-tree-model.cpp

示例11: fetchMore

	void LazyStandardItemModel::fetchMore(QModelIndex const &parent)
	{
		QStandardItemModel *m = &visualizer_->model_;
		QStandardItem *item = m->itemFromIndex(parent);
		if(item && item->type() == S_Leaf)
		{
			LeafTreeItem *tnd = static_cast<LeafTreeItem *>(item);
			if(tnd->object_)
				tnd->cloneChildrenFrom(tnd->object_->node_list_.front());
			tnd->setExpanded(true);
		}
	}
开发者ID:dudochkin-victor,项目名称:libqttracker,代码行数:12,代码来源:visualizer.cpp

示例12: filterAcceptsRow

/** Redefined from MiamSortFilterProxyModel. */
bool UniqueLibraryFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
	QStandardItem *item = _model->itemFromIndex(_model->index(sourceRow, 1, sourceParent));
	if (!item) {
		return false;
	}
	bool result = false;
	switch (item->type()) {
	case Miam::IT_Artist:
		if (MiamSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent)) {
			result = true;
		} else {
			QSqlQuery getArtist(*SqlDatabase::instance());
			getArtist.prepare("SELECT * FROM tracks WHERE title LIKE ? AND artistId = ?");
			getArtist.addBindValue("%" + filterRegExp().pattern() + "%");
			getArtist.addBindValue(item->data(Miam::DF_ID).toUInt());
			result = getArtist.exec() && getArtist.next();
		}
		break;
	case Miam::IT_Album:
		if (MiamSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent)) {
			result = true;
		} else if (filterRegExp().indexIn(item->data(Miam::DF_Artist).toString()) != -1) {
			result = true;
		} else {
			QSqlQuery getAlbum(*SqlDatabase::instance());
			getAlbum.prepare("SELECT * FROM tracks WHERE title LIKE ? AND albumId = ?");
			getAlbum.addBindValue("%" + filterRegExp().pattern() + "%");
			getAlbum.addBindValue(item->data(Miam::DF_ID).toUInt());
			result = getAlbum.exec() && getAlbum.next();
		}
		break;
	case Miam::IT_Track:
		if (MiamSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent)) {
			result = true;
		} else {
			result = filterRegExp().indexIn(item->data(Miam::DF_Artist).toString()) != -1 ||
					filterRegExp().indexIn(item->data(Miam::DF_Album).toString()) != -1;
		}
		break;
	case Miam::IT_Separator:
		for (QModelIndex index : _topLevelItems.values(static_cast<SeparatorItem*>(item))) {
			if (filterAcceptsRow(index.row(), sourceParent)) {
				result = true;
			}
		}
		break;
	default:
		break;
	}
	return result;
}
开发者ID:sun-friderick,项目名称:Miam-Player,代码行数:53,代码来源:uniquelibraryfilterproxymodel.cpp

示例13: getItem

QStandardItem* RepoItemDelegate::getItem(const QModelIndex &index) const
{
    if (!index.isValid()) {
        return NULL;
    }
    const RepoTreeModel *model = (const RepoTreeModel*)index.model();
    QStandardItem *item = model->itemFromIndex(index);
    if (item->type() != REPO_ITEM_TYPE &&
        item->type() != REPO_CATEGORY_TYPE) {
        return NULL;
    }
    return item;
}
开发者ID:gndy,项目名称:seafile-client-3.0.4,代码行数:13,代码来源:repo-item-delegate.cpp

示例14: return

EventItem*
EventsListView::getItem(const QModelIndex &index) const
{
    if (!index.isValid()) {
        return NULL;
    }
    const EventsListModel *model = (const EventsListModel*)index.model();
    QStandardItem *qitem = model->itemFromIndex(index);
    if (qitem->type() == EVENT_ITEM_TYPE) {
        return (EventItem *)qitem;
    }
    return NULL;
}
开发者ID:haiwen,项目名称:seafile-client,代码行数:13,代码来源:events-list-view.cpp

示例15: currentRowIndex

SymbolLayerItem* QgsSymbolV2PropertiesDialog::currentLayerItem()
{
  int index = currentRowIndex();
  if ( index < 0 )
    return NULL;

  QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listLayers->model() );
  if ( model == NULL )
    return NULL;
  QStandardItem* item = model->item( index );
  if ( item->type() != SymbolLayerItemType )
    return NULL;
  return static_cast<SymbolLayerItem*>( item );
}
开发者ID:mmubangizi,项目名称:qgis,代码行数:14,代码来源:qgssymbolv2propertiesdialog.cpp


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