mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: remove model parameter from TankItem::setData()
This one is extremely obscure: TankItem::setData(), which is called on every replot, was passed the DivePlotDataModel, even though it doesn't access that model at all. Instead, it connect()s to the model to stay informed of changes to the data. First of all, this should obviously be done once in the constructor, not on every replot. But also, the setData() function is called on every replot one lines before sending the model-changed signal. Thus, the tankitem was always repainted twice. Just remove the whole connect() thing and go for a more deterministic model. Should the tankbar not be repainted anywhere, add the appropriate calls there. Accordingly rename the "modelDataChanged" slot to "replot". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
72427adc1c
commit
27810f3217
3 changed files with 8 additions and 15 deletions
|
|
@ -3,7 +3,6 @@
|
|||
#define TANKITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QModelIndex>
|
||||
#include <QBrush>
|
||||
#include "profile-widget/divelineitem.h"
|
||||
#include "profile-widget/divecartesianaxis.h"
|
||||
|
|
@ -16,12 +15,10 @@ class TankItem : public QObject, public QGraphicsRectItem
|
|||
public:
|
||||
explicit TankItem(QObject *parent = 0);
|
||||
void setHorizontalAxis(DiveCartesianAxis *horizontal);
|
||||
void setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d);
|
||||
|
||||
signals:
|
||||
void setData(struct plot_info *plotInfo, struct dive *d);
|
||||
|
||||
public slots:
|
||||
void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
void replot();
|
||||
|
||||
private:
|
||||
void createBar(int startTime, int stopTime, struct gasmix gas);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue