QFileDialog in QStyledItemDelegate
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?
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"
Thank you. It worked.