MCPcopy Create free account
hub / github.com/TeXworks/texworks / init

Method init

src/TeXDocumentWindow.cpp:108–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void TeXDocumentWindow::init()
109{
110 codec = TWApp::instance()->getDefaultCodec();
111 pdfDoc = nullptr;
112 process = nullptr;
113 utf8BOM = false;
114#if defined(Q_OS_WIN)
115 lineEndings = kLineEnd_CRLF;
116#else
117 lineEndings = kLineEnd_LF;
118#endif
119
120 setupUi(this);
121 editor()->setDocument(textDoc());
122
123 setAttribute(Qt::WA_DeleteOnClose, true);
124
125 setContextMenuPolicy(Qt::NoContextMenu);
126
127 makeUntitled();
128 hideConsole();
129 keepConsoleOpen = false;
130 connect(consoleTabs, &Tw::UI::ClosableTabWidget::requestClose, actionShow_Hide_Console, &QAction::trigger);
131
132 statusBar()->addPermanentWidget(lineEndingLabel = new Tw::UI::ClickableLabel());
133 lineEndingLabel->setFrameStyle(QFrame::StyledPanel);
134 lineEndingLabel->setFont(statusBar()->font());
135 connect(lineEndingLabel, &Tw::UI::ClickableLabel::mouseLeftClick, this, &TeXDocumentWindow::lineEndingLabelClick);
136 showLineEndingSetting();
137
138 statusBar()->addPermanentWidget(encodingLabel = new Tw::UI::ClickableLabel());
139 encodingLabel->setFrameStyle(QFrame::StyledPanel);
140 encodingLabel->setFont(statusBar()->font());
141 connect(encodingLabel, &Tw::UI::ClickableLabel::mouseLeftClick, this, &TeXDocumentWindow::encodingLabelClick);
142 showEncodingSetting();
143
144 statusBar()->addPermanentWidget(lineNumberLabel = new Tw::UI::ClickableLabel());
145 lineNumberLabel->setFrameStyle(QFrame::StyledPanel);
146 lineNumberLabel->setFont(statusBar()->font());
147 connect(lineNumberLabel, &Tw::UI::ClickableLabel::mouseLeftClick, this, &TeXDocumentWindow::doLineDialog);
148 showCursorPosition();
149
150 engineActions = new QActionGroup(this);
151 connect(engineActions, &QActionGroup::triggered, this, static_cast<void (TeXDocumentWindow::*)(QAction*)>(&TeXDocumentWindow::selectedEngine));
152
153 codec = TWApp::instance()->getDefaultCodec();
154 engineName = TWApp::instance()->getDefaultEngine().name();
155 engine = new QComboBox(this);
156 engine->setEditable(false);
157 engine->setFocusPolicy(Qt::NoFocus);
158 engine->setSizeAdjustPolicy(QComboBox::AdjustToContents);
159#if defined(Q_OS_DARWIN)
160 engine->setStyleSheet(QString::fromLatin1("padding:4px;"));
161 engine->setMinimumWidth(150);
162#endif
163 toolBar_run->addWidget(engine);
164 updateEngineList();
165 connect(engine, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (TeXDocumentWindow::*)(int)>(&TeXDocumentWindow::selectedEngine));

Callers

nothing calls this directly

Calls 10

getDefaultCodecMethod · 0.80
setFontMethod · 0.80
getDefaultEngineMethod · 0.80
containsMethod · 0.80
fromStringMethod · 0.80
hideMethod · 0.80
updateWindowMenusMethod · 0.80
setDocumentMethod · 0.45
nameMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected