Add download button to ImageOverlay
When opening images in the full-screen overlay, there is now a download button next to the close button. This button utilizes the same functionality as the right-click->save image button.
This commit is contained in:
parent
f7255b7b49
commit
6d629f1c90
3 changed files with 13 additions and 0 deletions
|
|
@ -76,6 +76,8 @@ ImageOverlay::paintEvent(QPaintEvent *event)
|
|||
content_ = QRect(outer_margin + diff_x / 2, diff_y / 2, image_.width(), image_.height());
|
||||
close_button_ =
|
||||
QRect(screen_.width() - margin - buttonSize, margin, buttonSize, buttonSize);
|
||||
save_button_ =
|
||||
QRect(screen_.width() - (2 * margin) - (2 * buttonSize), margin, buttonSize, buttonSize);
|
||||
|
||||
// Draw main content_.
|
||||
painter.drawPixmap(content_, image_);
|
||||
|
|
@ -91,6 +93,12 @@ ImageOverlay::paintEvent(QPaintEvent *event)
|
|||
painter.setPen(pen);
|
||||
painter.drawLine(center - QPointF(15, 15), center + QPointF(15, 15));
|
||||
painter.drawLine(center + QPointF(15, -15), center - QPointF(15, -15));
|
||||
|
||||
// Draw download button
|
||||
center = save_button_.center();
|
||||
painter.drawLine(center - QPointF(0, 15), center + QPointF(0, 15));
|
||||
painter.drawLine(center - QPointF(15, 0), center + QPointF(0, 15));
|
||||
painter.drawLine(center + QPointF(0, 15), center + QPointF(15, 0));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -101,6 +109,8 @@ ImageOverlay::mousePressEvent(QMouseEvent *event)
|
|||
|
||||
if (close_button_.contains(event->pos()))
|
||||
emit closing();
|
||||
else if (save_button_.contains(event->pos()))
|
||||
emit saving();
|
||||
else if (!content_.contains(event->pos()))
|
||||
emit closing();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue