mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added a shortcut to 'esc', so it clears the selection or cancels the plan.
Added a shortcut to the esc key, so it clears the selection, if there's no selection, it acts just like clicking on the 'cancel' button. Next: delete selected handlers. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
f457415f7a
commit
c23dd354b9
2 changed files with 20 additions and 1 deletions
|
@ -123,9 +123,27 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
||||||
|
|
||||||
minMinutes = TIME_INITIAL_MAX;
|
minMinutes = TIME_INITIAL_MAX;
|
||||||
|
|
||||||
|
QAction *escAction = new QAction(this);
|
||||||
|
escAction->setShortcut(Qt::Key_Escape);
|
||||||
|
escAction->setShortcutContext(Qt::ApplicationShortcut);
|
||||||
|
addAction(escAction);
|
||||||
|
|
||||||
|
connect(escAction, SIGNAL(triggered(bool)), this, SLOT(keyEscAction()));
|
||||||
|
|
||||||
setRenderHint(QPainter::Antialiasing);
|
setRenderHint(QPainter::Antialiasing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivePlannerGraphics::keyEscAction()
|
||||||
|
{
|
||||||
|
if (scene()->selectedItems().count()){
|
||||||
|
scene()->clearSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelClicked();
|
||||||
|
}
|
||||||
|
|
||||||
qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation)
|
qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation)
|
||||||
{
|
{
|
||||||
qreal total = orientation == Qt::Horizontal ? sceneRect().width() : sceneRect().height();
|
qreal total = orientation == Qt::Horizontal ? sceneRect().width() : sceneRect().height();
|
||||||
|
|
|
@ -77,6 +77,7 @@ protected:
|
||||||
void deleteTemporaryDivePlan(struct divedatapoint* dp);
|
void deleteTemporaryDivePlan(struct divedatapoint* dp);
|
||||||
qreal fromPercent(qreal percent, Qt::Orientation orientation);
|
qreal fromPercent(qreal percent, Qt::Orientation orientation);
|
||||||
private slots:
|
private slots:
|
||||||
|
void keyEscAction();
|
||||||
void increaseTime();
|
void increaseTime();
|
||||||
void increaseDepth();
|
void increaseDepth();
|
||||||
void okClicked();
|
void okClicked();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue