Compare commits

...

3 Commits

3 changed files with 16 additions and 9 deletions

View File

@ -16,7 +16,7 @@ MainWindow::MainWindow(QWidget* parent)
, ui(new Ui::MainWindow) {
ui->setupUi(this);
m_core = new GenericCore();
m_core = std::make_unique<GenericCore>();
/// application icon
const QString iconString = "://feature.png";
@ -33,21 +33,21 @@ MainWindow::MainWindow(QWidget* parent)
createActions();
createHelpMenu();
/// TODO restore window geometry and state (& save it in closeEvent)
const QVariantMap settings = SettingsHandler::getSettings("GUI");
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
connect(m_core, &GenericCore::displayStatusMessage, this, &MainWindow::displayStatusMessage);
connect(m_core.get(), &GenericCore::displayStatusMessage, this,
&MainWindow::displayStatusMessage);
connect(this, &MainWindow::displayStatusMessage, this, &MainWindow::showStatusMessage);
connect(this, &MainWindow::checkForUpdates, this,
&MainWindow::on_actionCheck_for_update_triggered, Qt::QueuedConnection);
m_tableModel = m_core->getModel();
ui->tableView->setModel(m_tableModel.get());
}
MainWindow::~MainWindow() {
delete ui;
delete m_core;
}
MainWindow::~MainWindow() { delete ui; }
void MainWindow::closeEvent(QCloseEvent* event) {
if (isWindowModified()) {
@ -126,7 +126,8 @@ void MainWindow::on_pushButton_clicked() {
}
void MainWindow::createHelpMenu() {
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
QMenu* helpMenu = ui->menu_Help;
helpMenu->addSeparator();
QAction* aboutAct = helpMenu->addAction(tr("&About"), this, &MainWindow::onAboutClicked);
aboutAct->setStatusTip(tr("Show the application's About box"));

View File

@ -7,6 +7,7 @@ QT_BEGIN_NAMESPACE
class GenericCore;
class QAbstractItemModel;
namespace Ui {
class MainWindow;
}
@ -36,7 +37,9 @@ class MainWindow : public QMainWindow {
private:
Ui::MainWindow* ui;
GenericCore* m_core;
// GenericCore* m_core;
std::unique_ptr<GenericCore> m_core;
std::shared_ptr<QAbstractItemModel> m_tableModel;
/// Setup functions
void createActions();

View File

@ -15,6 +15,9 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="tableView"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">