Fix yet another mac shutdown bug and some override rubbish

This commit is contained in:
Mark Watkins 2018-05-05 19:13:39 +10:00
parent 6f8c56074e
commit 5d4a051f55
3 changed files with 28 additions and 23 deletions

View File

@ -321,7 +321,7 @@ class gGraphView
*/
explicit gGraphView(QWidget *parent = 0, gGraphView *shared = 0);
virtual ~gGraphView();
virtual void closeEvent(QCloseEvent * event);
void closeEvent(QCloseEvent * event) override;
//! \brief Add gGraph g to this gGraphView, in the requested graph-linkage group
void addGraph(gGraph *g, short group = 0);
@ -549,13 +549,13 @@ class gGraphView
bool pinchTriggered(QPinchGesture * gesture);
virtual void leaveEvent (QEvent * event);
void leaveEvent (QEvent * event) override;
//! \brief The heart of the drawing code
#ifdef BROKEN_OPENGL_BUILD
virtual void paintEvent(QPaintEvent *);
void paintEvent(QPaintEvent *) override;
#else
virtual void paintGL();
void paintGL() override;
#endif
//! \brief Calculates the sum of all graph heights
float totalHeight();
@ -564,7 +564,7 @@ class gGraphView
float scaleHeight();
//! \brief Update the OpenGL area when the screen is resized
virtual void resizeEvent(QResizeEvent *);
void resizeEvent(QResizeEvent *) override;
//! \brief Set the Vertical offset (used in scrolling)
void setOffsetY(int offsetY);
@ -573,19 +573,19 @@ class gGraphView
void setOffsetX(int offsetX);
//! \brief Mouse Moved somewhere in main gGraphArea, propagates to the individual graphs
virtual void mouseMoveEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event) override;
//! \brief Mouse Button Press Event somewhere in main gGraphArea, propagates to the individual graphs
virtual void mousePressEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event) override;
//! \brief Mouse Button Release Event somewhere in main gGraphArea, propagates to the individual graphs
virtual void mouseReleaseEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event) override;
//! \brief Mouse Button Double Click Event somewhere in main gGraphArea, propagates to the individual graphs
virtual void mouseDoubleClickEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event) override;
//! \brief Mouse Wheel Event somewhere in main gGraphArea, propagates to the individual graphs
virtual void wheelEvent(QWheelEvent *event);
void wheelEvent(QWheelEvent *event) override;
//! \brief Keyboard event while main gGraphArea has focus.
virtual void keyPressEvent(QKeyEvent *event);
void keyPressEvent(QKeyEvent *event) override;
//! \brief Keyboard event while main gGraphArea has focus.
virtual void keyReleaseEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event) override;
//! \brief Add Graph to drawing queue, mainly for the benefit of multithreaded drawing code
void queGraph(gGraph *, int originX, int originY, int width, int height);

View File

@ -249,12 +249,23 @@ void MainWindow::logMessage(QString msg)
void MainWindow::closeEvent(QCloseEvent * event)
{
static bool runonce = false;
if (!runonce) {
if (AppSetting->removeCardReminder()) {
Notify(QObject::tr("Don't forget to place your datacard back in your CPAP machine"), QObject::tr("SleepyHead Reminder"));
QApplication::processEvents();
QThread::msleep(1000);
QApplication::processEvents();
}
runonce = true;
} else {
qDebug() << "Qt is still calling closevent multiple times";
QApplication::processEvents();
}
}
extern MainWindow *mainwin;
MainWindow::~MainWindow()
{
schema::channel.Save();
if (p_profile) {
CloseProfile();
@ -267,12 +278,6 @@ void MainWindow::closeEvent(QCloseEvent * event)
QSettings settings(getDeveloperName(), getAppName());
settings.setValue("MainWindow/geometry", saveGeometry());
QMainWindow::closeEvent(event);
}
extern MainWindow *mainwin;
MainWindow::~MainWindow()
{
// Trash anything allocated by the Graph objects
DestroyGraphGlobals();

View File

@ -156,8 +156,8 @@ class MainWindow : public QMainWindow
protected:
virtual void closeEvent(QCloseEvent *);
virtual void keyPressEvent(QKeyEvent *event);
void closeEvent(QCloseEvent *) override;
void keyPressEvent(QKeyEvent *event) override;
private slots:
/*! \fn void on_action_Import_Data_triggered();