diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-05 10:26:57 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-05 10:26:57 +0200 |
| commit | da305e17be24b9db1c2014c6125399147ec404d9 (patch) | |
| tree | 63f4c412992f8176d4521c03eeacc45b98c4aef8 /browsertab.cpp | |
| parent | 3508f8a2a0867a886ceca9139ce0dcae2405ff29 (diff) | |
| download | kristall-da305e17be24b9db1c2014c6125399147ec404d9.tar.gz | |
Makes graphics view zoom to fit first.
Diffstat (limited to 'browsertab.cpp')
| -rw-r--r-- | browsertab.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/browsertab.cpp b/browsertab.cpp index 856b3f5..d7c974b 100644 --- a/browsertab.cpp +++ b/browsertab.cpp @@ -10,6 +10,9 @@ #include <QImage> #include <QPixmap> +#include <QGraphicsPixmapItem> +#include <QGraphicsTextItem> + BrowserTab::BrowserTab(MainWindow * mainWindow) : QWidget(nullptr), ui(new Ui::BrowserTab), @@ -170,8 +173,16 @@ void BrowserTab::on_gemini_complete(const QByteArray &data, const QString &mime) QImage img; if(img.loadFromData(data, nullptr)) { - this->graphics_scene.addPixmap(QPixmap::fromImage(img)); + auto * item = this->graphics_scene.addPixmap(QPixmap::fromImage(img)); + } + else + { + auto * item = this->graphics_scene.addText("Failed to load picture!"); } + + + this->ui->graphics_browser->fitInView(graphics_scene.sceneRect(), Qt::KeepAspectRatio); + } else { this->ui->text_browser->setVisible(true); |
