MCPcopy Create free account
hub / github.com/KDE/kdevelop / setEditorData

Method setEditorData

plugins/cmake/settings/cmakecachedelegate.cpp:74–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void CMakeCacheDelegate::setEditorData(QWidget * editor, const QModelIndex & index) const
75{
76 if(index.column()==2)
77 {
78 QModelIndex typeIdx=index.sibling(index.row(), 1);
79 QString type=index.model()->data(typeIdx, Qt::DisplayRole).toString();
80 QString value=index.model()->data(index, Qt::DisplayRole).toString();
81 if(type==QLatin1String("BOOL"))
82 {
83 auto *boolean=qobject_cast<QCheckBox*>(editor);
84 boolean->setCheckState(value==QLatin1String("ON") ? Qt::Checked : Qt::Unchecked);
85 }
86 else if(type==QLatin1String("PATH") || type==QLatin1String("FILEPATH"))
87 {
88 auto *url=qobject_cast<KUrlRequester*>(editor);
89 url->setUrl(QUrl(value));
90 }
91 else
92 {
93 QItemDelegate::setEditorData(editor, index);
94 }
95 }
96 else
97 qCDebug(CMAKE) << "Error. trying to edit a read-only field";
98}
99
100void CMakeCacheDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const
101{

Callers

nothing calls this directly

Calls 8

siblingMethod · 0.80
QUrlClass · 0.50
columnMethod · 0.45
rowMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
modelMethod · 0.45
setUrlMethod · 0.45

Tested by

no test coverage detected