17#ifndef __gui_mrview_tool_connectome_matrix_list_h__
18#define __gui_mrview_tool_connectome_matrix_list_h__
22#include <QAbstractItemModel>
50 QVariant data (
const QModelIndex& index,
int role)
const override {
51 if (!
index.isValid())
return {};
52 if (role != Qt::DisplayRole)
return {};
56 Qt::ItemFlags flags (
const QModelIndex&
index)
const override {
57 if (!
index.isValid())
return {};
58 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
61 QModelIndex parent (
const QModelIndex&)
const override {
65 int rowCount (
const QModelIndex& parent = QModelIndex())
const override {
70 int columnCount (
const QModelIndex& parent = QModelIndex())
const override {
75 QModelIndex
index (
int row,
int column,
const QModelIndex& parent = QModelIndex())
const override {
77 return createIndex (row, column);
80 void remove_item (QModelIndex&
index) {
81 beginRemoveRows (QModelIndex(),
index.row(),
index.row());
87 beginRemoveRows (QModelIndex(), 0,
items.size());
QString qstr(const std::string &s)
std::string shorten(const std::string &text, size_t longest=40, size_t prefix=10)
convert a long string to 'beginningofstring...endofstring' for display