QObject::connect: No such slot QLabel::mousePressEvent(QString) in ..\exportwindow.cpp:42
QObject::connect: (receiver name: 'bigImgLabel')
Here I'm trying to connect:
void ExportWindow::on_chooseFolderButton_clicked()
{
//QString fileName = QFileDialog::getExistingDirectory( this, tr("Open Image"), tr(""), 0);
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), "/home/jana", tr("Image Files (*.png *.jpg *.bmp)"));
QImage image(fileName);
ClickableImage* picLabel = new ClickableImage(ui->scrollArea);
picLabel->path = QString(fileName);
picLabel->setPixmap(QPixmap::fromImage(image));
ui->scrollArea->setWidget(picLabel);
connect(picLabel, SIGNAL(leftButtonPressed(QString&)),ui->bigImgLabel, SLOT(mousePressEvent(QString&)));
}
this is where i create bigPicLabel (constructor of ExportWindow)
ClickableImage* bigPicLabel = new ClickableImage(this);
vbl->addWidget(bigPicLabel);
and this is class declaration
class ClickableImage:public QLabel
{
Q_OBJECT
public:
ClickableImage(QWidget *parent = 0);
QString path;
public slots:
void mousePressEvent(QString& imgPath);
signals:
void leftButtonPressed(QString& imgPath);
};
I've seen many questions with this error, but solutions don't fit here. What did I miss here?
In the connect call, you are connecting to a slot of ui->bigImgLabel
? Probably you meant picLabel
; according to the error message, ui->bigImgLabel
is a simple QLabel
.