[Interest] Image on QLabel doesn't show at all

Tamás Nagy tamas.nagy.001 at gmail.com
Sat Dec 8 18:23:22 CET 2018


Hi,

pixmap = new QPixmap(imageUrl.toString());
ui->imageLabel->setGeometry(QRect(QPoint(0,0), QPoint(pixmap->width(),
pixmap->height()) ));
ui->imageLabel->setPixmap(*pixmap);
ui->imageLabel->setStyleSheet("background-image: url(" +
imageUrl.toString() + ")");
ui->imageLabel->update();
ui->imageLabel->show();

My image is C:\untitled.bmp

I also have a second error: my signal is not found. It always tells me:

18:18:07: Debugging starts
QMetaObject::connectSlotsByName: No matching signal for on_graphics_changed()
QObject::connect: No such signal
MainWindow::MainWindow::graphicsChanged() in
..\untitled\mainwindow.cpp:11
QObject::connect: (sender name: 'MainWindow')
QObject::connect: (receiver name: 'MainWindow')
onecoreuap\shell\ext\thumbnailcache\lib\thumbcacheobj.cpp(2076)\thumbcache.dll!6440C772:
(caller: 643F9E61) ReturnHr(1) tid(94) 80070057 The parameter is
incorrect.
minio\profapi\registry.cpp(48)\profapi.dll!76176875: (caller:
29374375) ReturnHr(1) tid(3aa8) 80070002 The system cannot find the
file specified.
minio\profapi\registry.cpp(48)\profapi.dll!76176875: (caller:
29374375) ReturnHr(2) tid(1e64) 80070002 The system cannot find the
file specified.
shell\comdlg32\fileopensave.cpp(14413)\comdlg32.dll!75B2FE77: (caller:
75B5D851) ReturnHr(1) tid(94) 80004005 Unspecified error
CallContext:[\PickerModalLoop]
18:18:43: Debugging has finished

#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#include <QMainWindow>
#include <qfiledialog.h>
#include <QImage>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QMessageBox>

namespace Ui {
class MainWindow;
}


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public slots:
    void on_pushButton_clicked();
    void on_graphics_changed();

private:
    Ui::MainWindow *ui;
    QString imageDir = "";
    QUrl imageUrl;
    QPixmap * pixmap;

signals:
    void graphicsChanged();
};

#endif // MAINWINDOW_H



Tamas



More information about the Interest mailing list