Changeset View
Changeset View
Standalone View
Standalone View
examples/codeeditor.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 122 | connect(openAction, &QAction::triggered, this, [this]() { | |||
---|---|---|---|---|---|
124 | if (!fileName.isEmpty()) | 124 | if (!fileName.isEmpty()) | ||
125 | openFile(fileName); | 125 | openFile(fileName); | ||
126 | }); | 126 | }); | ||
127 | 127 | | |||
128 | // syntax selection | 128 | // syntax selection | ||
129 | auto hlActionGroup = new QActionGroup(menu); | 129 | auto hlActionGroup = new QActionGroup(menu); | ||
130 | hlActionGroup->setExclusive(true); | 130 | hlActionGroup->setExclusive(true); | ||
131 | auto hlGroupMenu = menu->addMenu(QStringLiteral("Syntax")); | 131 | auto hlGroupMenu = menu->addMenu(QStringLiteral("Syntax")); | ||
132 | auto noHlAction = hlGroupMenu->addAction(QStringLiteral("None")); | 132 | QMenu *hlSubMenu = hlGroupMenu; | ||
133 | noHlAction->setCheckable(true); | | |||
134 | hlActionGroup->addAction(noHlAction); | | |||
135 | noHlAction->setChecked(!m_highlighter->definition().isValid()); | | |||
136 | QMenu *hlSubMenu = nullptr; | | |||
137 | QString currentGroup; | 133 | QString currentGroup; | ||
138 | foreach (const auto &def, m_repository.definitions()) { | 134 | foreach (const auto &def, m_repository.definitions()) { | ||
139 | if (def.isHidden()) | 135 | if (def.isHidden()) | ||
140 | continue; | 136 | continue; | ||
141 | if (currentGroup != def.section()) { | 137 | if (currentGroup != def.section()) { | ||
142 | currentGroup = def.section(); | 138 | currentGroup = def.section(); | ||
143 | hlSubMenu = hlGroupMenu->addMenu(def.translatedSection()); | 139 | hlSubMenu = hlGroupMenu->addMenu(def.translatedSection()); | ||
144 | } | 140 | } | ||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |