MCPcopy Create free account
hub / github.com/LeFroid/Viper-Browser / data

Method data

src/core/user_scripts/UserScriptModel.cpp:106–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106QVariant UserScriptModel::data(const QModelIndex &index, int role) const
107{
108 if (index.row() >= rowCount())
109 return QVariant();
110
111 // Column is 0 for checkbox state
112 if(index.column() == 0 && role == Qt::CheckStateRole)
113 {
114 return (m_scripts.at(index.row()).isEnabled() ? Qt::Checked : Qt::Unchecked);
115 }
116
117 if(role != Qt::DisplayRole && role != Qt::EditRole)
118 return QVariant();
119
120 if (!index.isValid())
121 return QVariant();
122
123 const UserScript &script = m_scripts.at(index.row());
124 switch (index.column())
125 {
126 case 1: return script.getName();
127 case 2: return script.getDescription();
128 case 3: return script.getVersion();
129 default: return QVariant();
130 }
131}
132
133Qt::ItemFlags UserScriptModel::flags(const QModelIndex& index) const
134{

Callers

nothing calls this directly

Calls 1

isEnabledMethod · 0.45

Tested by

no test coverage detected