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->setupUi(this);
|
||||
windowTitleStr = this->windowTitle();
|
||||
jsonDrawString = ui->labJSON->text();
|
||||
}
|
||||
|
||||
|
@ -38,12 +39,7 @@ PictureDialog::~PictureDialog()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void PictureDialog::setSnapmaticPicture(QPixmap pixmap)
|
||||
{
|
||||
ui->labPicture->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void PictureDialog::setJsonString(SnapmaticPicture *picture)
|
||||
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||
{
|
||||
QString locX = QString::number(picture->getLocationX());
|
||||
QString locY = QString::number(picture->getLocationY());
|
||||
|
@ -59,7 +55,9 @@ void PictureDialog::setJsonString(SnapmaticPicture *picture)
|
|||
}
|
||||
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->labPicture->setPixmap(picture->getPixmap());
|
||||
}
|
||||
|
||||
void PictureDialog::on_cmdClose_clicked()
|
||||
|
|
|
@ -31,8 +31,7 @@ class PictureDialog : public QDialog
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit PictureDialog(QWidget *parent = 0);
|
||||
void setSnapmaticPicture(QPixmap pixmap);
|
||||
void setJsonString(SnapmaticPicture *picture);
|
||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||
~PictureDialog();
|
||||
|
||||
private slots:
|
||||
|
@ -41,6 +40,7 @@ private slots:
|
|||
private:
|
||||
Ui::PictureDialog *ui;
|
||||
QString jsonDrawString;
|
||||
QString windowTitleStr;
|
||||
};
|
||||
|
||||
#endif // PICTUREDIALOG_H
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>%1 - Simple Image Viewer</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vlPictureLayout">
|
||||
<property name="leftMargin">
|
||||
|
@ -50,7 +50,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="labJSON">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
4
main.cpp
4
main.cpp
|
@ -48,9 +48,7 @@ int main(int argc, char *argv[])
|
|||
SnapmaticPicture picture;
|
||||
picture.readingPictureFromFile(arg1);
|
||||
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
picDialog.setWindowTitle(picture.getPictureStr());
|
||||
picDialog.setSnapmaticPicture(picture.getPixmap());
|
||||
picDialog.setJsonString(&picture);
|
||||
picDialog.setSnapmaticPicture(&picture);
|
||||
picDialog.show();
|
||||
|
||||
return a.exec();
|
||||
|
|
Loading…
Reference in a new issue