mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:36:16 +00:00
Add a slot to mainwindow but amend to use Q_SLOTS
For some reason, 'private slots:' causes a build error but private Q_SLOTS: works. The error was that 'slots' did not name a type and it appeared to be insensitive to whether the Makefile rule for .moc was in its current place or preceeded the rule for .cpp. Add a slot using the connectByName idiom e.g. actionNew connects to slot on_actionNew_triggered(). Use qDebug to show this fires if the menu option is selected. Above to demonstrate how to begin to link menu to code paths. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e865aed478
commit
a94e09ad5c
2 changed files with 16 additions and 3 deletions
|
@ -2,10 +2,16 @@
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
MainWindow::MainWindow() : ui(new Ui::MainWindow())
|
MainWindow::MainWindow() : ui(new Ui::MainWindow())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionNew_triggered()
|
||||||
|
{
|
||||||
|
qDebug() << "actionNew";
|
||||||
|
}
|
||||||
|
|
||||||
#include "mainwindow.moc"
|
#include "mainwindow.moc"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
@ -13,10 +14,16 @@ class DiveNotes;
|
||||||
class Stats;
|
class Stats;
|
||||||
class Equipment;
|
class Equipment;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow{
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
|
||||||
|
void on_actionNew_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue