MCPcopy Create free account
hub / github.com/YACReader/yacreader / createRoot

Function createRoot

YACReaderLibrary/db/folder_model.cpp:108–130  ·  view source on GitHub ↗

TODO: load from DB, type is pretty much needed

Source from the content-addressed store, hash-verified

106
107// TODO: load from DB, type is pretty much needed
108FolderItem *createRoot(QSqlDatabase &db)
109{
110 QList<QVariant> data;
111
112 QSqlQuery selectQuery(db);
113 selectQuery.prepare("SELECT * FROM folder WHERE id = 1");
114 selectQuery.exec();
115
116 auto columns = FolderColumns(selectQuery);
117
118 if (!selectQuery.next()) {
119 return nullptr;
120 }
121
122 data = folderDataFromQuery(selectQuery, columns);
123 data[0] = "root";
124
125 auto root = new FolderItem(data);
126 root->id = ROOT;
127 root->parentItem = nullptr;
128
129 return root;
130}
131
132FolderModel::FolderModel(QObject *parent)
133 : QAbstractItemModel(parent), isSubfolder(false), rootItem(nullptr), showRecent(false), recentDays(1)

Callers 1

createModelDataMethod · 0.85

Calls 4

FolderColumnsClass · 0.85
folderDataFromQueryFunction · 0.85
execMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected