Skip to content

Commit

Permalink
Allow for toggling fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtodzio committed Sep 1, 2016
1 parent 0a546e9 commit 33ada47
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Features:
- Undo / Redo edit actions
- Showing mouse cursor coordinates relative to image in status bar
- Hiding toolbar
- Toggling fullscreen mode

![ImageViewer preview 1](image_viewer_1.gif)
![ImageViewer preview 2](image_viewer_2.gif)
Expand Down
8 changes: 8 additions & 0 deletions imageviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ void ImageViewer::on_actionCrop_triggered()
changeCroppingState(true);
}

void ImageViewer::on_actionFullscreen_triggered()
{
if(isFullScreen())
this->setWindowState(Qt::WindowMaximized);
else
this->setWindowState(Qt::WindowFullScreen);
}

void ImageViewer::on_actionOpen_triggered()
{
QString lastFileName = fileName.isEmpty() ? QDir::currentPath() : fileName;
Expand Down
1 change: 1 addition & 0 deletions imageviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private slots:
bool eventFilter(QObject* watched, QEvent* event);

void on_actionCrop_triggered();
void on_actionFullscreen_triggered();
void on_actionPaintBlack_triggered();
void on_actionOpen_triggered();
void on_actionRotateLeft_triggered();
Expand Down
6 changes: 6 additions & 0 deletions imageviewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<addaction name="actionZoomOut"/>
<addaction name="separator"/>
<addaction name="actionShowToolbar"/>
<addaction name="actionFullscreen"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
Expand Down Expand Up @@ -217,6 +218,11 @@
<string>Redo</string>
</property>
</action>
<action name="actionFullscreen">
<property name="text">
<string>Toggle Fullscreen</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
Expand Down

0 comments on commit 33ada47

Please sign in to comment.