improved simple image viewer
This commit is contained in:
parent
4da12a2796
commit
035448172c
4 changed files with 9 additions and 13 deletions
|
@ -30,6 +30,7 @@ PictureDialog::PictureDialog(QWidget *parent) :
|
||||||
ui(new Ui::PictureDialog)
|
ui(new Ui::PictureDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
windowTitleStr = this->windowTitle();
|
||||||
jsonDrawString = ui->labJSON->text();
|
jsonDrawString = ui->labJSON->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +39,7 @@ PictureDialog::~PictureDialog()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::setSnapmaticPicture(QPixmap pixmap)
|
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
{
|
|
||||||
ui->labPicture->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureDialog::setJsonString(SnapmaticPicture *picture)
|
|
||||||
{
|
{
|
||||||
QString locX = QString::number(picture->getLocationX());
|
QString locX = QString::number(picture->getLocationX());
|
||||||
QString locY = QString::number(picture->getLocationY());
|
QString locY = QString::number(picture->getLocationY());
|
||||||
|
@ -59,7 +55,9 @@ void PictureDialog::setJsonString(SnapmaticPicture *picture)
|
||||||
}
|
}
|
||||||
if (plyrsStr.length() >= 1) { plyrsStr.remove(0,2); }
|
if (plyrsStr.length() >= 1) { plyrsStr.remove(0,2); }
|
||||||
|
|
||||||
|
this->setWindowTitle(windowTitleStr.arg(picture->getPictureStr()));
|
||||||
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
|
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
|
||||||
|
ui->labPicture->setPixmap(picture->getPixmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::on_cmdClose_clicked()
|
void PictureDialog::on_cmdClose_clicked()
|
||||||
|
|
|
@ -31,8 +31,7 @@ class PictureDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PictureDialog(QWidget *parent = 0);
|
explicit PictureDialog(QWidget *parent = 0);
|
||||||
void setSnapmaticPicture(QPixmap pixmap);
|
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||||
void setJsonString(SnapmaticPicture *picture);
|
|
||||||
~PictureDialog();
|
~PictureDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -41,6 +40,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Ui::PictureDialog *ui;
|
Ui::PictureDialog *ui;
|
||||||
QString jsonDrawString;
|
QString jsonDrawString;
|
||||||
|
QString windowTitleStr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PICTUREDIALOG_H
|
#endif // PICTUREDIALOG_H
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>%1 - Simple Image Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlPictureLayout">
|
<layout class="QVBoxLayout" name="vlPictureLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labJSON">
|
<widget class="QLabel" name="labJSON">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><span style=" font-weight:600;">Location:</span> X: %1, Y: %2, Z: %3 <br><span style=" font-weight:600;">Players:</span> %4<br><span style=" font-weight:600;">Crew ID:</span> %5</string>
|
<string><span style=" font-weight:600;">Location: </span>%1, %2, %3 <br><span style=" font-weight:600;">Players: </span>%4<br><span style=" font-weight:600;">Crew ID: </span>%5</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
4
main.cpp
4
main.cpp
|
@ -48,9 +48,7 @@ int main(int argc, char *argv[])
|
||||||
SnapmaticPicture picture;
|
SnapmaticPicture picture;
|
||||||
picture.readingPictureFromFile(arg1);
|
picture.readingPictureFromFile(arg1);
|
||||||
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
picDialog.setWindowTitle(picture.getPictureStr());
|
picDialog.setSnapmaticPicture(&picture);
|
||||||
picDialog.setSnapmaticPicture(picture.getPixmap());
|
|
||||||
picDialog.setJsonString(&picture);
|
|
||||||
picDialog.show();
|
picDialog.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
Loading…
Reference in a new issue