Application that install browser plugin

  • Hi All,
    Some of you was able to use trivial example to create a browser plugin?
    I'm trying to compile it but I'm not able to do.

    These are the steps done untill now:

    #1 Create a new project (Qt GUI Application);
    #2 Create a file trivial.cpp:

    #include <QtGui>

    class Trivial : public QWidget
    Q_PROPERTY(QString text READ text WRITE setText)

     Q_CLASSINFO("ClassID", "{5a22176d-118f-4185-9653-9f98958a6df8}")
     Q_CLASSINFO("InterfaceID", "{2df735ba-da4f-4fb7-8f35-b8dfbf8cfd9a}")
     Q_CLASSINFO("EventsID", "{449de213-f8bd-4d2e-a2cf-eab407c03245}")
     Q_CLASSINFO("MIME", "trivial/very:xxx:Trivial and useless")
     Q_CLASSINFO("ToSuperClass", "Trivial")
     Q_CLASSINFO("DefaultProperty", "text")

    Trivial(QWidget *parent = 0)
    : QWidget(parent)
    m_text = QString::fromLatin1("Empty");

     void mousePressEvent(QMouseEvent *)
     void mouseMoveEvent(QMouseEvent *e)
         mouseMove(e->x(), e->y());
     void mouseReleaseEvent(QMouseEvent*)
     QString text() const
         return m_text;

    public slots:
    void about()
    void setText(const QString &text)
    m_text = text;

    void mouseDown();
    void mouseMove(int x, int y);
    void mouseUp();

    void paintEvent(QPaintEvent*)
    QPainter p(this);
    QRect r(rect());
    r.adjust(0, 0, -1, -1);

         p.drawText(r, Qt::AlignCenter, m_text);

    QString m_text;

    #include "trivial.moc"

    QTNPFACTORY_BEGIN("Trivial Qt-based Plugin", "A Qt-based LiveConnected plug-in that does nothing")

    #ifdef QAXSERVER
    #include <ActiveQt/QAxFactory>
    QAXFACTORY_BEGIN("{aa3216bf-7e20-482c-84c6-06167bacb616}", "{08538ca5-eb7a-4f24-a3c4-a120c6e04dc4}")

    #3 create a .pri file called trivial.pri:

    SOURCES += trivial.cpp

    #4 Add trivial.pri to my Main project:


    When i compile main application it returns an error:
    trivial.cpp: error: 73: expected constructor, destructor, or type conversion before '(' token

    Can you help me?


  • Moderators

    For which browser is this? Looks like IE to me, but I am not sure.

  • I'd like to create for all browser but for now I'll be very happy if it runs with firefox.
    But for now my project doesn't compile.

  • From "here":
    Did you

    1. "Download": the necessary files?

    Include the qtbrowserplugin.pri in your .pro file, and regenerate the makefile with qmake. The resulting makefile will generate a shared library that the browsers will be able to load as a plugin.

  • I compiled trivial example, it generates a .dll
    Now how can i install into firefox.

  • I've solved my Problem, we must simply put the dll created into a specific folder.
    Thanks to all

  • Hi, About my last post: it's true that plugin is installed putting .dll file into specific folder but this doesn't run on windows.
    What should i do to install my trivial plugin on internet explorer?
    I've added line:
    @CONFIG += qaxserver@
    Necessary for Internet Explorer

  • thanks all its helpful information for me

  • On Internet Exploerer it should be automatic:
    Windows, Internet Explorer: The Makefile generated by qmake by default runs the necessary commands to register the plugin as an ActiveX server (if CONFIG includes qaxserver).
    Otherwise you can register it manually using 'regsvr32 "C:\PATH\TO\PLUGIN.dll" '.

  • I apologize for my experience lack, but what does it mean: " you can register it manually using ‘regsvr32 “C:\PATH\TO\PLUGIN.dll” ‘. "


  • you should run this command in console with path to your plugin.

  • Ok thanks for you quick feedback, but i should do it from Qt application or from Installer.

  • Hi all, I'm working with the Bouncer example from the "C++ GUI Programming with Qt 4, Second Edition
    by Jasmin Blanchette; Mark Summerfield" book.
    I can't receive the signal in javascript, which was sent from plugin (function AxBouncer::bouncing(), demo.html)
    I used qtbrowserplugin, but did't work too.
    Everything works Firefox.

  • Sorry, does not work in Internet explorer

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.