Important: Please read the Qt Code of Conduct -

QWebpage createPlugin problem

  • I am embedding widgets in webpages and I have a problem. I hope anyone of you can give me an idea on how to solve it.

    The first page contains three <object> tags:
    <object type="application/x-qt-plugin" classid="TabWidget" name="TabWidget" id="TabWidget"></object>
    <object type="application/x-qt-plugin" classid="ColorPicker" name="colorPicker" id="ColorPicker"></object>
    <object type="application/x-qt-plugin" classid="BaseColorsCircles" name="baseColorsCircles" id="BaseColorsCircles"></object>

    Which causes the following function to be called three times:
    @QObject* customWebPage::createPlugin(
    const QString &classid,
    const QUrl &url,
    const QStringList &paramNames,
    const QStringList &paramValues)
    if (classid=="ColorPicker"){
    return colorPicker;
    } else if(classid=="BaseColorsCircles"){
    return baseColorsCircles;
    } else if(classid=="TabWidget") {
    return tabs;
    } else if(classid=="ColorBlender") {
    return blender;
    } else
    return 0;
    Everything works fine, I even have several slots and signals connected among them and it works. The problem is when I reload the page by any means (Refresh or going to another page and returning). The function is called again and when trying to return any of the elements that were already embedded, it crashes with an error 0xC0000005 and the debugger gives me a warning that says "The inferior stopped because it received a signal from the operating system. Signal name: SIGSEGV Signal meaning: Segmentation fault."

    Any ideas? I have even tried deleting the pointers and reinitializing them before returning them again, but then, the "delete" instructions cause the error.
    Thank you.

  • Nevermind. Every time the browser is redirected all the embedded objects are deleted so, new objects have to be created for each page.

Log in to reply