MCPcopy Create free account
hub / github.com/Artikash/Textractor / Window

Class Window

extensions/styler.cpp:9–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7constexpr auto STYLE_SAVE_FILE = u8"Textractor.css";
8
9class Window : public QDialog, Localizer
10{
11public:
12 Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
13 {
14 connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript);
15
16 if (scriptEditor.toPlainText().isEmpty()) scriptEditor.setPlainText("/*https://doc.qt.io/qt-5/stylesheet-syntax.html*/");
17 layout.addWidget(&scriptEditor);
18 layout.addWidget(&loadButton);
19
20 resize(800, 600);
21 setWindowTitle("Styler");
22 QMetaObject::invokeMethod(this, &QWidget::show, Qt::QueuedConnection);
23
24 LoadScript();
25 }
26
27 ~Window()
28 {
29 qApp->setStyleSheet("");
30 Save();
31 }
32
33private:
34 void LoadScript()
35 {
36 qApp->setStyleSheet(scriptEditor.toPlainText());
37 Save();
38 }
39
40 void Save()
41 {
42 QTextFile(STYLE_SAVE_FILE, QIODevice::WriteOnly | QIODevice::Truncate).write(scriptEditor.toPlainText().toUtf8());
43 }
44
45 QHBoxLayout layout{ this };
46 QPlainTextEdit scriptEditor{ QTextFile(STYLE_SAVE_FILE, QIODevice::ReadOnly).readAll(), this };
47 QPushButton loadButton{ LOAD_SCRIPT, this };
48} window;
49
50bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
51{

Callers

nothing calls this directly

Calls 1

QTextFileClass · 0.85

Tested by

no test coverage detected