https://bugs.kde.org/show_bug.cgi?id=404833

--- Comment #13 from RJVB <rjvber...@gmail.com> ---
Created attachment 118390
  --> https://bugs.kde.org/attachment.cgi?id=118390&action=edit
testing mod

So this works on Linux too, see the attached patch.

I've been testing this with an application that does

        auto fDialog = new QFileDialog(this, tr("Pick a font file"), startDir);
        auto variant = QVariant(QVariant::UserType);
        variant.setValue(fDialog);
        fDialog->setProperty("QFileDialogInstance", variant);
        fDialog->setProperty("QFileDialogParentClass",
metaObject()->className());
        qWarning() << "\t" << fDialog <<
fDialog->property("QFileDialogInstance")
            << fDialog->property("QFileDialogParentClass");
        if (fDialog->exec() && !fDialog->selectedFiles().isEmpty()) {
        }

This prints

         QFileDialog(0x1749cc0) QVariant(QFileDialog*, QFileDialog(0x1749cc0))
QVariant(QString, "Dialog")
virtual bool KDEPlatformFileDialogHelper::show(Qt::WindowFlags,
Qt::WindowModality, QWindow *) KDEPlatformFileDialogHelper(0x16e5530)
KDEPlatformFileDialog(0x170ba10) QWidgetWindow(0x16ba7f0,
name="DialogClassWindow") Dialog(0x7fff972af318)
         QVariant(Invalid) QVariant(Invalid)
         (QFileDialog(0x1749cc0))

Here the 1st line comes from the application, the other 3 lines from
KDEPlatformFileDialogHelper::show(). 
As you can see, the properties are set correctly but for some reason they
cannot be read from the integration plugin. Maybe after a dynamic_cast to
QFileDialog?
However, findChildren() is promising and could be the solution if we can assume
that there are never multiple QFileDialog instances that share the same parent
(or if we can distinguish them somehow).

FWIW, I've even seen "(ScFileWidget(0x2fa45b0))" when opening a native
filedialog in Scribus, so findChildren() also works on classes that inherit
QFileDialog.


Now, how do you think we could use this information to embed the
KDEPlatformFileDialog into the parent of the instance we just retrieved?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to