mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Untangle Profile from MainWindow: edit current profile
And action can't not just trigger a slot, it can also send a signal. With this there is no reference to the MainWindow left in the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2b9316e16a
commit
e7edaea4f8
3 changed files with 3 additions and 2 deletions
|
@ -30,7 +30,6 @@
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#endif
|
#endif
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "preferences/preferencesdialog.h"
|
#include "preferences/preferencesdialog.h"
|
||||||
|
|
||||||
// a couple of helpers we need
|
// a couple of helpers we need
|
||||||
|
@ -1272,7 +1271,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
||||||
action->setData(event->globalPos());
|
action->setData(event->globalPos());
|
||||||
|
|
||||||
if (same_string(current_dc->model, "manually added dive"))
|
if (same_string(current_dc->model, "manually added dive"))
|
||||||
QAction *editProfileAction = m.addAction(tr("Edit the profile"), MainWindow::instance(), SLOT(editCurrentDive()));
|
QAction *editProfileAction = m.addAction(tr("Edit the profile"), this, SIGNAL(editCurrentDive()));
|
||||||
|
|
||||||
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
|
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
|
||||||
action = new QAction(&m);
|
action = new QAction(&m);
|
||||||
|
|
|
@ -94,6 +94,7 @@ signals:
|
||||||
void disableShortcuts(bool paste);
|
void disableShortcuts(bool paste);
|
||||||
void refreshDisplay(bool recreateDivelist);
|
void refreshDisplay(bool recreateDivelist);
|
||||||
void updateDiveInfo(bool clear);
|
void updateDiveInfo(bool clear);
|
||||||
|
void editCurrentDive();
|
||||||
|
|
||||||
public
|
public
|
||||||
slots: // Necessary to call from QAction's signals.
|
slots: // Necessary to call from QAction's signals.
|
||||||
|
|
|
@ -93,6 +93,7 @@ int main(int argc, char **argv)
|
||||||
QObject::connect(m->graphics(), &ProfileWidget2::enableShortcuts, m, &MainWindow::enableShortcuts, Qt::AutoConnection);
|
QObject::connect(m->graphics(), &ProfileWidget2::enableShortcuts, m, &MainWindow::enableShortcuts, Qt::AutoConnection);
|
||||||
QObject::connect(m->graphics(), &ProfileWidget2::refreshDisplay, m, &MainWindow::refreshDisplay, Qt::AutoConnection);
|
QObject::connect(m->graphics(), &ProfileWidget2::refreshDisplay, m, &MainWindow::refreshDisplay, Qt::AutoConnection);
|
||||||
QObject::connect(m->graphics(), &ProfileWidget2::updateDiveInfo, m->information(), &MainTab::updateDiveInfo, Qt::AutoConnection);
|
QObject::connect(m->graphics(), &ProfileWidget2::updateDiveInfo, m->information(), &MainTab::updateDiveInfo, Qt::AutoConnection);
|
||||||
|
QObject::connect(m->graphics(), &ProfileWidget2::editCurrentDive, m, &MainWindow::editCurrentDive, Qt::AutoConnection);
|
||||||
if (verbose > 0)
|
if (verbose > 0)
|
||||||
print_files();
|
print_files();
|
||||||
if (!quit)
|
if (!quit)
|
||||||
|
|
Loading…
Add table
Reference in a new issue