MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / QGLSLCompleter

Method QGLSLCompleter

lib/QCodeEditor/src/internal/QGLSLCompleter.cpp:9–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <QFile>
8
9QGLSLCompleter::QGLSLCompleter(QObject *parent)
10 : QCompleter(parent)
11{
12 // Setting up GLSL types
13 QStringList list;
14
15 Q_INIT_RESOURCE(qcodeeditor_resources);
16 QFile fl(":/languages/glsl.xml");
17
18 if (!fl.open(QIODevice::ReadOnly))
19 {
20 return;
21 }
22
23 QLanguage language(&fl);
24
25 if (!language.isLoaded())
26 {
27 return;
28 }
29
30 auto keys = language.keys();
31 for (auto &&key : keys)
32 {
33 auto names = language.names(key);
34 list.append(names);
35 }
36
37 setModel(new QStringListModel(list, this));
38 setCompletionColumn(0);
39 setModelSorting(QCompleter::CaseInsensitivelySortedModel);
40 setCaseSensitivity(Qt::CaseSensitive);
41 setWrapAround(true);
42}

Callers

nothing calls this directly

Calls 5

keysMethod · 0.80
namesMethod · 0.80
openMethod · 0.45
isLoadedMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected