Add console dock widget to main window
MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
@@ -25,11 +25,20 @@ MainWindow::MainWindow(Runner *runnerPtr, Parser *parserPtr, QWidget *parent)
// setup example projects
setupExamples();
- // connect widgets
+ // setup and connect widgets
connect(m_ui->programfiletab, &ProgramfileTab::loadBinaryFile, this,
&MainWindow::on_actionLoadBinaryFile_triggered);
connect(m_ui->programfiletab, &ProgramfileTab::loadAssemblyFile, this,
&MainWindow::on_actionLoadAssemblyFile_triggered);
+ connect(m_ui->actionShow_consoles, &QAction::triggered, [=](bool state) {
+ if (state) {
+ m_ui->consoles->show();
+ } else {
+ m_ui->consoles->hide();
+ };
+ });
+ connect(m_ui->consoles, &QDockWidget::visibilityChanged,
+ m_ui->actionShow_consoles, &QAction::setChecked);
}
MainWindow::~MainWindow() { delete m_ui; }

MODIFY
src/mainwindow.ui
src/mainwindow.ui
<x>0</x>
<y>0</y>
<width>689</width>
- <height>483</height>
+ <height>753</height>
</rect>
</property>
<property name="windowTitle">
<addaction name="separator"/>
<addaction name="actionexit"/>
</widget>
+ <widget class="QMenu" name="menuSettings">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ <addaction name="actionShow_consoles"/>
+ </widget>
<addaction name="menuFile"/>
+ <addaction name="menuSettings"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<addaction name="actionReset"/>
<addaction name="actionDump"/>
</widget>
+ <widget class="QDockWidget" name="consoles">
+ <attribute name="dockWidgetArea">
+ <number>8</number>
+ </attribute>
+ <widget class="QWidget" name="dockWidgetContents">
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0">
+ <widget class="QTabWidget" name="tabWidget_2">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_5">
+ <attribute name="title">
+ <string>Application output</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="0">
+ <widget class="QPlainTextEdit" name="applicationConsole">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_6">
+ <attribute name="title">
+ <string>Log</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_7">
+ <item row="0" column="0">
+ <widget class="QPlainTextEdit" name="logConsole">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
<action name="actionLoadBinaryFile">
<property name="text">
<string>Load binary file</string>
<string>Ctrl+Shift+O</string>
</property>
</action>
+ <action name="actionShow_consoles">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Show consoles</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>

Add console dock widget to main window