restore macOS menubar after viewing fullscreen image

This commit is contained in:
Matthew Hodgson 2017-04-30 02:27:07 +01:00
parent e0ec403754
commit 28b8cd5ad1
2 changed files with 19 additions and 0 deletions

View File

@ -28,6 +28,8 @@ class ImageOverlayDialog : public QDialog
public:
ImageOverlayDialog(QPixmap image, QWidget *parent = nullptr);
void reject() override;
protected:
void mousePressEvent(QMouseEvent *event) override;
void paintEvent(QPaintEvent *event) override;

View File

@ -38,6 +38,23 @@ ImageOverlayDialog::ImageOverlayDialog(QPixmap image, QWidget *parent)
raise();
}
void ImageOverlayDialog::reject()
{
// needed on macOS to recover the main menu after the dialog is closed(!)
setWindowState(Qt::WindowNoState);
// It might be slightly cleaner to do:
//
// #ifdef Q_WS_MACX
// #include <Carbon/Carbon.h>
// ShowMenuBar();
// #endif
//
// ...but there's a chance other platforms might be affected by this too.
QDialog::reject();
}
// TODO: Move this into Utils
void ImageOverlayDialog::scaleImage(int max_width, int max_height)
{