Changeset - 7c41467702e0
[Not reviewed]
snapshots
0 4 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-09-20 08:07:34
hy@ozderya.net
delete snapshot window when closed
4 files changed with 29 insertions and 0 deletions:
0 comments (0 inline, 0 general)
snapshot.cpp
Show inline comments
 
@@ -15,6 +15,14 @@ SnapShot::SnapShot(QMainWindow* parent, 
 
    connect(&_menuAction, &QAction::triggered, this, &SnapShot::show);
 
}
 

	
 
SnapShot::~SnapShot()
 
{
 
    if (view != NULL)
 
    {
 
        delete view;
 
    }
 
}
 

	
 
QAction* SnapShot::menuAction()
 
{
 
    return &_menuAction;
 
@@ -26,6 +34,7 @@ void SnapShot::show()
 
    {
 
        qDebug() << "view == NULL";
 
        view = new SnapShotView(mainWindow, this);
 
        connect(view, &SnapShotView::closed, this, &SnapShot::viewClosed);
 
    }
 
    view->show();
 
}
 
@@ -34,3 +43,9 @@ void SnapShot::hide()
 
{
 

	
 
}
 

	
 
void SnapShot::viewClosed()
 
{
 
    delete view;
 
    view = NULL;
 
}
snapshot.h
Show inline comments
 
@@ -14,6 +14,7 @@ class SnapShot : public QObject
 

	
 
public:
 
    SnapShot(QMainWindow* parent, QString name);
 
    ~SnapShot();
 

	
 
    // QString _name;
 
    QVector<QVector<QPointF>> data;
 
@@ -27,6 +28,9 @@ private:
 
    QAction _menuAction;
 
    QMainWindow* mainWindow;
 
    SnapShotView* view;
 

	
 
private slots:
 
    void viewClosed();
 
};
 

	
 
#endif /* SNAPSHOT_H */
snapshotview.cpp
Show inline comments
 
@@ -29,3 +29,8 @@ SnapShotView::~SnapShotView()
 
    }
 
    delete ui;
 
}
 

	
 
void SnapShotView::closeEvent(QCloseEvent *event)
 
{
 
    emit closed();
 
}
snapshotview.h
Show inline comments
 
@@ -5,6 +5,7 @@
 
#include <QVector>
 
#include <QPointF>
 
#include <QPen>
 
#include <QCloseEvent>
 
#include <qwt_plot_curve.h>
 
#include "plot.h"
 
#include "snapshot.h"
 
@@ -21,11 +22,15 @@ public:
 
    explicit SnapShotView(QWidget *parent, SnapShot* snapShot);
 
    ~SnapShotView();
 

	
 
signals:
 
    void closed();
 

	
 
private:
 
    Ui::SnapShotView *ui;
 
    QList<QwtPlotCurve*> curves;
 

	
 
    SnapShot* _snapShot;
 
    void closeEvent(QCloseEvent *event);
 
};
 

	
 
#endif // SNAPSHOTVIEW_H
0 comments (0 inline, 0 general)