Turn of replotting while the cylinder type combo box is active

Since replotting is expensive and it is triggered while scrolling
through the list of cylinders, better not do it for improved
user experience and replot only after the combo box loses
focus.

I hope this...

Fixes #768

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-12-13 22:06:52 +01:00 committed by Dirk Hohndel
parent 98085e25e5
commit b72c32da7d
4 changed files with 23 additions and 0 deletions

View file

@ -6,6 +6,8 @@
#include "diveplanner.h"
#include "simplewidgets.h"
#include "gettextfromc.h"
#include "profile/profilewidget2.h"
#include "mainwindow.h"
#include <QtDebug>
#include <QPainter>
@ -252,6 +254,14 @@ void TankInfoDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
TankInfoDelegate::TankInfoDelegate(QObject *parent) : ComboBoxDelegate(TankInfoModel::instance(), parent)
{
connect(this, SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)),
this, SLOT(reenableReplot(QWidget *, QAbstractItemDelegate::EndEditHint)));
}
void TankInfoDelegate::reenableReplot(QWidget *widget, QAbstractItemDelegate::EndEditHint hint)
{
MainWindow::instance()->graphics()->setReplot(true);
MainWindow::instance()->graphics()->replot();
}
void TankInfoDelegate::revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint)
@ -275,6 +285,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
currCylinderData.type = copy_string(cyl->type.description);
currCylinderData.pressure = cyl->type.workingpressure.mbar;
currCylinderData.size = cyl->type.size.mliter;
MainWindow::instance()->graphics()->setReplot(false);
return delegate;
}