mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Make pictures respond to double clicks again
The Drag & Drop functionality swallowd the click events so double clicks never happend. So here, we detect this and call the handler explicitly. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3413dc30e5
commit
82d9709357
1 changed files with 19 additions and 12 deletions
|
@ -30,7 +30,13 @@ void DivePictureWidget::doubleClicked(const QModelIndex &index)
|
|||
|
||||
void DivePictureWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
|
||||
static ulong lasttime = 0L;
|
||||
|
||||
if (event->timestamp() - lasttime <= doubleClickInterval) {
|
||||
doubleClicked(indexAt(event->pos()));
|
||||
} else {
|
||||
lasttime = event->timestamp();
|
||||
QPixmap pixmap = model()->data(indexAt(event->pos()), Qt::DecorationRole).value<QPixmap>();
|
||||
|
||||
QString filename = model()->data(indexAt(event->pos()), Qt::DisplayPropertyRole).toString();
|
||||
|
@ -48,4 +54,5 @@ void DivePictureWidget::mousePressEvent(QMouseEvent *event)
|
|||
drag->setHotSpot(event->pos() - rectForIndex(indexAt(event->pos())).topLeft());
|
||||
|
||||
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue