Solved QFileDialog in QStyledItemDelegate
-
Hi,
I have the following code to open a QFileDialog in a delegate (to replace an already existing image in QStandardItemModel):fileName = fileDialog->getOpenFileName(this, tr("Finding Friend's Image"),sPath, tr("Image Files (*.png *.jpg *.bmp)"));
This line already works in a QDialog, but in the delegate 'this' is underlined and gives me the following message: cannot initialize a parameter of type 'QWidget*' with an rvalue of type 'myDelegate*'.
How can I avoid this error?
Thank you. -
Hi
It means it do not want a Delegate * as QWidget * pointer for parent.QString QFileDialog::getOpenFileName(QWidget *parent = Q_NULLPTR
So to avoid it simply pass Q_NULLPTR for "this"
-
Hi
It means it do not want a Delegate * as QWidget * pointer for parent.QString QFileDialog::getOpenFileName(QWidget *parent = Q_NULLPTR
So to avoid it simply pass Q_NULLPTR for "this"
-
@mrjj
Thank you. It worked.