| 162 | } |
| 163 | |
| 164 | void MainWindow::setupWidgets() |
| 165 | { |
| 166 | setWindowTitle("QCodeEditor Demo"); |
| 167 | |
| 168 | // CodeEditor |
| 169 | m_codeEditor->setPlainText(m_codeSamples[0].second); |
| 170 | m_codeEditor->setSyntaxStyle(m_styles[0].second); |
| 171 | m_codeEditor->setCompleter(m_completers[0].second); |
| 172 | m_codeEditor->setHighlighter(m_highlighters[0].second); |
| 173 | |
| 174 | QStringList list; |
| 175 | // Code samples |
| 176 | for (auto &&el : m_codeSamples) |
| 177 | { |
| 178 | list << el.first; |
| 179 | } |
| 180 | |
| 181 | m_codeSampleCombobox->addItems(list); |
| 182 | list.clear(); |
| 183 | |
| 184 | // Highlighter |
| 185 | for (auto &&el : m_highlighters) |
| 186 | { |
| 187 | list << el.first; |
| 188 | } |
| 189 | |
| 190 | m_highlighterCombobox->addItems(list); |
| 191 | list.clear(); |
| 192 | |
| 193 | // Completer |
| 194 | for (auto &&el : m_completers) |
| 195 | { |
| 196 | list << el.first; |
| 197 | } |
| 198 | |
| 199 | m_completerCombobox->addItems(list); |
| 200 | list.clear(); |
| 201 | |
| 202 | // Styles |
| 203 | for (auto &&el : m_styles) |
| 204 | { |
| 205 | list << el.first; |
| 206 | } |
| 207 | |
| 208 | m_styleCombobox->addItems(list); |
| 209 | list.clear(); |
| 210 | |
| 211 | m_parenthesesEnabledCheckbox->setChecked(m_codeEditor->autoParentheses()); |
| 212 | m_tabReplaceEnabledCheckbox->setChecked(m_codeEditor->tabReplace()); |
| 213 | m_tabReplaceNumberSpinbox->setValue(m_codeEditor->tabReplaceSize()); |
| 214 | m_tabReplaceNumberSpinbox->setSuffix(tr(" spaces")); |
| 215 | m_autoIndentationCheckbox->setChecked(m_codeEditor->autoIndentation()); |
| 216 | |
| 217 | m_wordWrapCheckBox->setChecked(m_codeEditor->wordWrapMode() |
| 218 | != QTextOption::NoWrap); |
| 219 | } |
| 220 | |
| 221 | void MainWindow::performConnections() |
nothing calls this directly
no test coverage detected