double click show picture in fullscreen

This commit is contained in:
Rafael 2016-04-01 21:06:09 +02:00
parent ea2b9046e7
commit 7b0b67c6ad
4 changed files with 102 additions and 68 deletions

View file

@ -21,7 +21,9 @@
#include "ui_PictureDialog.h" #include "ui_PictureDialog.h"
#include "SidebarGenerator.h" #include "SidebarGenerator.h"
#include "StandardPaths.h" #include "StandardPaths.h"
#include "UiModLabel.h"
#include <QDesktopWidget>
#include <QJsonDocument> #include <QJsonDocument>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
@ -347,3 +349,25 @@ fileDialogPreSave:
settings.setValue("CopyPicture", fileDialog.saveState()); settings.setValue("CopyPicture", fileDialog.saveState());
settings.endGroup(); settings.endGroup();
} }
void PictureDialog::on_labPicture_mouseDoubleClicked()
{
QDialog *pictureWidget = new QDialog(this);
QRect rec = QApplication::desktop()->screenGeometry();
UiModLabel *pictureLabel = new UiModLabel(pictureWidget);
pictureLabel->setPixmap(ui->labPicture->pixmap()->scaled(rec.width(), rec.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
QObject::connect(pictureLabel, SIGNAL(mouseDoubleClicked()), pictureWidget, SLOT(close()));
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::WindowContextHelpButtonHint);
pictureWidget->setWindowTitle(tr("Show picture"));
pictureWidget->setStyleSheet("background-color: black;");
pictureWidget->showFullScreen();
pictureWidget->setModal(true);
pictureWidget->exec();
pictureLabel->deleteLater();
delete pictureLabel;
pictureWidget->deleteLater();
delete pictureWidget;
}

View file

@ -42,6 +42,7 @@ private slots:
void on_cmdClose_clicked(); void on_cmdClose_clicked();
void on_cmdExport_clicked(); void on_cmdExport_clicked();
void on_cmdCopy_clicked(); void on_cmdCopy_clicked();
void on_labPicture_mouseDoubleClicked();
private: private:
ProfileDatabase *profileDB; ProfileDatabase *profileDB;

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>960</width> <width>960</width>
<height>536</height> <height>572</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -28,26 +28,32 @@
</property> </property>
<item> <item>
<widget class="UiModLabel" name="labPicture"> <widget class="UiModLabel" name="labPicture">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="vsDialog"> <widget class="QFrame" name="jsonFrame">
<property name="orientation"> <property name="frameShape">
<enum>Qt::Vertical</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="frameShadow">
<size> <enum>QFrame::Plain</enum>
<width>0</width>
<height>0</height>
</size>
</property> </property>
</spacer> <property name="lineWidth">
</item> <number>0</number>
<item> </property>
<layout class="QHBoxLayout" name="hlJSON"> <layout class="QHBoxLayout" name="hlJson">
<property name="leftMargin"> <property name="leftMargin">
<number>4</number> <number>4</number>
</property> </property>
@ -107,6 +113,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View file

@ -88,6 +88,8 @@ DISTFILES += res/app.rc \
lang/gta5sync_ru.ts \ lang/gta5sync_ru.ts \
lang/qt_ru.qm lang/qt_ru.qm
INCLUDEPATH += ./uimod
win32: RC_FILE += res/app.rc win32: RC_FILE += res/app.rc
# QT4 ONLY STUFF # QT4 ONLY STUFF