Compare commits
3 Commits
8105fac8d3
...
5e54f52cd6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e54f52cd6 | |||
| 64a65b5916 | |||
| 9a30fb2aad |
@ -16,7 +16,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
, ui(new Ui::MainWindow) {
|
, ui(new Ui::MainWindow) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
m_core = new GenericCore();
|
m_core = std::make_unique<GenericCore>();
|
||||||
|
|
||||||
/// application icon
|
/// application icon
|
||||||
const QString iconString = "://feature.png";
|
const QString iconString = "://feature.png";
|
||||||
@ -33,21 +33,21 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
createActions();
|
createActions();
|
||||||
createHelpMenu();
|
createHelpMenu();
|
||||||
|
|
||||||
/// TODO restore window geometry and state (& save it in closeEvent)
|
|
||||||
const QVariantMap settings = SettingsHandler::getSettings("GUI");
|
const QVariantMap settings = SettingsHandler::getSettings("GUI");
|
||||||
restoreGeometry(settings.value("geometry").toByteArray());
|
restoreGeometry(settings.value("geometry").toByteArray());
|
||||||
restoreState(settings.value("windowState").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::displayStatusMessage, this, &MainWindow::showStatusMessage);
|
||||||
connect(this, &MainWindow::checkForUpdates, this,
|
connect(this, &MainWindow::checkForUpdates, this,
|
||||||
&MainWindow::on_actionCheck_for_update_triggered, Qt::QueuedConnection);
|
&MainWindow::on_actionCheck_for_update_triggered, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
m_tableModel = m_core->getModel();
|
||||||
|
ui->tableView->setModel(m_tableModel.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() { delete ui; }
|
||||||
delete ui;
|
|
||||||
delete m_core;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event) {
|
void MainWindow::closeEvent(QCloseEvent* event) {
|
||||||
if (isWindowModified()) {
|
if (isWindowModified()) {
|
||||||
@ -126,7 +126,8 @@ void MainWindow::on_pushButton_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createHelpMenu() {
|
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);
|
QAction* aboutAct = helpMenu->addAction(tr("&About"), this, &MainWindow::onAboutClicked);
|
||||||
aboutAct->setStatusTip(tr("Show the application's About box"));
|
aboutAct->setStatusTip(tr("Show the application's About box"));
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
class GenericCore;
|
class GenericCore;
|
||||||
|
|
||||||
|
class QAbstractItemModel;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
@ -36,7 +37,9 @@ class MainWindow : public QMainWindow {
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
|
|
||||||
GenericCore* m_core;
|
// GenericCore* m_core;
|
||||||
|
std::unique_ptr<GenericCore> m_core;
|
||||||
|
std::shared_ptr<QAbstractItemModel> m_tableModel;
|
||||||
|
|
||||||
/// Setup functions
|
/// Setup functions
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tableView"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
Reference in New Issue
Block a user