mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fixes showing the Empty Profile when Add / Plan dive is cancelled.
for some reason the next selected dive is NULL after cancelling the plan. I'm investigating. This patch fixes the show of the empty profile and it also untangles some parts of the code, keeping the mainwindow where it should belong : the mainwindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2f8f632cf6
commit
1e4f744165
4 changed files with 25 additions and 19 deletions
|
@ -88,7 +88,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
|||
rulerItem(new RulerItem2()),
|
||||
isGrayscale(false),
|
||||
printMode(false),
|
||||
shouldCalculateMaxTime(true)
|
||||
shouldCalculateMaxTime(true),
|
||||
backgroundFile(":poster")
|
||||
{
|
||||
memset(&plotInfo, 0, sizeof(plotInfo));
|
||||
|
||||
|
@ -566,9 +567,9 @@ void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
|
|||
|
||||
void ProfileWidget2::fixBackgroundPos()
|
||||
{
|
||||
static QPixmap toBeScaled(backgroundFile);
|
||||
if (currentState != EMPTY)
|
||||
return;
|
||||
QPixmap toBeScaled = QPixmap(backgroundFile);
|
||||
QPixmap p = toBeScaled.scaledToHeight(viewport()->height() - 40, Qt::SmoothTransformation);
|
||||
int x = viewport()->width() / 2 - p.width() / 2;
|
||||
int y = viewport()->height() / 2 - p.height() / 2;
|
||||
|
@ -666,7 +667,6 @@ void ProfileWidget2::setEmptyState()
|
|||
currentState = EMPTY;
|
||||
MainWindow::instance()->setToolButtonsEnabled(false);
|
||||
|
||||
backgroundFile = QString(":poster");
|
||||
fixBackgroundPos();
|
||||
background->setVisible(true);
|
||||
|
||||
|
@ -684,12 +684,14 @@ void ProfileWidget2::setEmptyState()
|
|||
pn2GasItem->setVisible(false);
|
||||
po2GasItem->setVisible(false);
|
||||
pheGasItem->setVisible(false);
|
||||
Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
|
||||
tissue->setVisible(false);
|
||||
}
|
||||
Q_FOREACH (DiveEventItem *event, eventItems) {
|
||||
event->setVisible(false);
|
||||
}
|
||||
|
||||
#define HIDE_ALL(TYPE, CONTAINER) \
|
||||
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
|
||||
HIDE_ALL(DiveCalculatedTissue, allTissues);
|
||||
HIDE_ALL(DiveEventItem, eventItems);
|
||||
HIDE_ALL(DiveHandler, handles);
|
||||
HIDE_ALL(QGraphicsSimpleTextItem, gases);
|
||||
#undef HIDE_ALL
|
||||
}
|
||||
|
||||
void ProfileWidget2::setProfileState()
|
||||
|
@ -1030,10 +1032,8 @@ void ProfileWidget2::disconnectTemporaryConnections()
|
|||
disconnect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
||||
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
|
||||
|
||||
|
||||
Q_FOREACH (QAction *action, actionsForKeys.values()) {
|
||||
Q_FOREACH (QAction *action, actionsForKeys.values())
|
||||
action->setShortcut(QKeySequence());
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue