mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
Added option to pin menu to close pin (#2736)
This commit is contained in:
@@ -95,6 +95,11 @@ PinWidget::PinWidget(const QPixmap& pixmap,
|
||||
&PinWidget::showContextMenu);
|
||||
}
|
||||
|
||||
void PinWidget::closePin()
|
||||
{
|
||||
update();
|
||||
close();
|
||||
}
|
||||
bool PinWidget::scrollEvent(QWheelEvent* event)
|
||||
{
|
||||
const auto phase = event->phase();
|
||||
@@ -141,8 +146,7 @@ void PinWidget::leaveEvent(QEvent*)
|
||||
|
||||
void PinWidget::mouseDoubleClickEvent(QMouseEvent*)
|
||||
{
|
||||
update();
|
||||
close();
|
||||
closePin();
|
||||
}
|
||||
|
||||
void PinWidget::mousePressEvent(QMouseEvent* e)
|
||||
@@ -236,6 +240,11 @@ void PinWidget::showContextMenu(const QPoint& pos)
|
||||
&saveToFileAction, &QAction::triggered, this, &PinWidget::saveToFile);
|
||||
contextMenu.addAction(&saveToFileAction);
|
||||
|
||||
QAction closePinAction(tr("Close"), this);
|
||||
connect(&closePinAction, &QAction::triggered, this, &PinWidget::closePin);
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(&closePinAction);
|
||||
|
||||
contextMenu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ private:
|
||||
bool gestureEvent(QGestureEvent* event);
|
||||
bool scrollEvent(QWheelEvent* e);
|
||||
void pinchTriggered(QPinchGesture*);
|
||||
void closePin();
|
||||
|
||||
QPixmap m_pixmap;
|
||||
QVBoxLayout* m_layout;
|
||||
|
||||
Reference in New Issue
Block a user