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 "SidebarGenerator.h"
#include "StandardPaths.h"
#include "UiModLabel.h"
#include <QDesktopWidget>
#include <QJsonDocument>
#include <QFileDialog>
#include <QMessageBox>
@ -347,3 +349,25 @@ fileDialogPreSave:
settings.setValue("CopyPicture", fileDialog.saveState());
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_cmdExport_clicked();
void on_cmdCopy_clicked();
void on_labPicture_mouseDoubleClicked();
private:
ProfileDatabase *profileDB;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>960</width>
<height>536</height>
<height>572</height>
</rect>
</property>
<property name="windowTitle">
@ -28,85 +28,92 @@
</property>
<item>
<widget class="UiModLabel" name="labPicture">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="vsDialog">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QFrame" name="jsonFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="hlJSON">
<property name="leftMargin">
<number>4</number>
<property name="lineWidth">
<number>0</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="labJSON">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;span style=&quot; font-weight:600;&quot;&gt;Title: &lt;/span&gt;%6&lt;br&gt;
<layout class="QHBoxLayout" name="hlJson">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="labJSON">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;span style=&quot; font-weight:600;&quot;&gt;Title: &lt;/span&gt;%6&lt;br&gt;
&lt;span style=&quot; font-weight:600;&quot;&gt;Location: &lt;/span&gt;%1, %2, %3 &lt;br&gt;
&lt;span style=&quot; font-weight:600;&quot;&gt;Players: &lt;/span&gt;%4&lt;br&gt;
&lt;span style=&quot; font-weight:600;&quot;&gt;Crew ID: &lt;/span&gt;%5</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdExport">
<property name="toolTip">
<string>Export picture</string>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="toolTip">
<string>Close</string>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdExport">
<property name="toolTip">
<string>Export picture</string>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="toolTip">
<string>Close</string>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>

View file

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