MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / data

Method data

src/plugins/core/session/sessionmodel.cpp:38–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38QVariant SessionModel::data(const QModelIndex &index, int role) const
39{
40 if (!index.isValid())
41 return {};
42
43 const auto &sessionName = sessionList.at(index.row());
44 switch (role) {
45 case Qt::ToolTipRole:
46 case Qt::DisplayRole:
47 switch (index.column()) {
48 case 0:
49 return sessionName;
50 case 1:
51 return SessionManager::instance()->sessionDateTime(sessionName);
52 }
53 break;
54 case Qt::FontRole: {
55 auto instance = SessionManager::instance();
56 QFont font;
57 font.setItalic(instance->isDefaultSession(sessionName));
58 if (instance->currentSession() == sessionName && !instance->isDefaultVirgin())
59 font.setBold(true);
60 else
61 font.setBold(false);
62 return font;
63 }
64 default:
65 break;
66 }
67 return {};
68}
69
70QVariant SessionModel::headerData(int section, Qt::Orientation orientation, int role) const
71{

Callers

nothing calls this directly

Calls 8

atMethod · 0.80
rowMethod · 0.80
columnMethod · 0.80
sessionDateTimeMethod · 0.80
isDefaultSessionMethod · 0.80
isDefaultVirginMethod · 0.80
isValidMethod · 0.45
currentSessionMethod · 0.45

Tested by

no test coverage detected