QNPlugin(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QNPlugin β€” the 3qt manual, but make it make sense πŸŽ€

okay bestie, we're reading the QNPlugin(3qt) page together and honestly? it's giving "factory core." let's get into it πŸ’…


✨ NAME ✨

QNPlugin β€” literally the main factory for plugin objects. that's the whole vibe. πŸ‘‘


🌸 SYNOPSIS 🌸

so this class is part of the Qt Netscape Extension, okay? and you get to it like this:

#include <qnp.h>

🫢 Public Members

virtual ~QNPlugin ()
void getVersionInfo ( int & plugin_major, int & plugin_minor, int &
    browser_major, int & browser_minor )
virtual QNPInstance * newInstance () = 0
virtual const char * getMIMEDescription () const = 0
virtual const char * getPluginNameString () const = 0
virtual const char * getPluginDescriptionString () const = 0
virtual void * getJavaClass ()
virtual void unuseJavaClass ()
void * getJavaEnv () const

⭐ Static Public Members

QNPlugin * create ()
QNPlugin * actual ()

πŸ™ˆ Protected Members

QNPlugin ()

πŸ¦‹ DESCRIPTION πŸ¦‹

so, real talk: this class is defined in the Qt Netscape Extension, which lives in the qt/extensions directory. it is not included in the main Qt API, bestie. it's the cool side quest, not the main storyline. ✨

the QNPlugin class provides the main factory for plugin objects. yes, factory. it makes the things. 🏭

this class is literally the heart of the plugin πŸ’œ. one instance of this object gets created when the plugin is first needed, and it happens by calling QNPlugin::create() β€” which you must implement in your plugin code to return some derived class of QNPlugin. so like, you're on the hook for that one. and that one single QNPlugin object creates all the QNPInstance instances for a web browser running in a single process. one object to rule them all, no cap.

also important, and I need you to hear me on this one 🚨: if Qt is linked to the plugin as a dynamic library, only one instance of QApplication will exist across all plugins that have been made with Qt. so your plugin should tread lightly on global settings. do not, for example, use QApplication::setFont() β€” that will change the font in every widget of every Qt-based plugin currently loaded! 😭 like bestie please do not do that to everyone else in the group chat.


πŸ’… MEMBER FUNCTION DOCUMENTATION πŸ’…

QNPlugin::QNPlugin () [protected]

creates a QNPlugin. this may only be used by the constructor of the class, derived from QNPlugin, that is returned by your plugin's implementation of the QNPlugin::create() function. so it's protected for a reason, don't be out here calling it directly. πŸ™ˆ

QNPlugin::~QNPlugin () [virtual]

destroys the QNPlugin. this is called by the plugin binding code just before the plugin is about to be unloaded from memory. and listen β€” if newWindow() has been called, a QApplication will still exist at this time, but will be deleted shortly after, just before the plugin is deleted. so it's a whole farewell tour. 🫢

QNPlugin * QNPlugin::actual () [static]

returns the plugin most recently returned by QNPlugin::create(). that's it, that's the function. iconic behaviour, honestly. ⭐

QNPlugin * QNPlugin::create () [static]

this function must be implemented by your plugin code. it should return a derived class of QNPlugin. no implementation, no plugin, that's the deal. 🀝

void * QNPlugin::getJavaClass () [virtual]

override this function to return a reference to the Java class that represents the plugin. the default returns 0, indicating no class.

if you override this class, you must also override QNPlugin::unuseJavaClass(). like they're a matched set, you can't have one without the other. πŸ‘―

the return value is actually a jref; we use void* so as to avoid burdening plugins which do not require Java. thoughtful, right? πŸ’–

see also getJavaEnv() and QNPInstance::getJavaPeer().

void * QNPlugin::getJavaEnv () const

returns a pointer to the Java execution environment, or 0 if either Java is disabled or an error occurred.

the return value is actually a JRIEnv*; we use void* so as to avoid burdening plugins which do not require Java. same energy as above, slay. ✨

see also getJavaClass() and QNPInstance::getJavaPeer().

const char * QNPlugin::getMIMEDescription () const [pure virtual]

override this function to return the MIME description of the data formats supported by your plugin. the format of this string is shown by the following example:

const char* getMIMEDescription() const
{
    return "image/x-png:png:PNG Image;"
           "image/png:png:PNG Image;"
           "image/x-portable-bitmap:pbm:PBM Image;"
           "image/x-portable-graymap:pgm:PGM Image;"
           "image/x-portable-pixmap:ppm:PPM Image;"
           "image/bmp:bmp:BMP Image;"
           "image/x-ms-bmp:bmp:BMP Image;"
           "image/x-xpixmap:xpm:XPM Image;"
           "image/xpm:xpm:XPM Image";
}

like look at all those image formats, they ate πŸ’…

const char * QNPlugin::getPluginDescriptionString () const [pure virtual]

returns a pointer to the plain-text description of the plugin. short, sweet, plain text. πŸŽ€

const char * QNPlugin::getPluginNameString () const [pure virtual]

returns a pointer to the plain-text name of the plugin. that's your plugin's name, out loud, in text form. πŸ‘‘

void QNPlugin::getVersionInfo ( int & plugin_major, int & plugin_minor, int & browser_major, int & browser_minor )

populates *plugin_major and *plugin_minor with the version of the plugin API, and populates *browser_major and *browser_minor with the version of the web browser. so it's a two-for-one version vibe check. 🌈

QNPInstance * QNPlugin::newInstance () [pure virtual]

override this function to return an appropriate derived class of QNPInstance. that's your whole job here bestie, return the right one. πŸ¦‹

void QNPlugin::unuseJavaClass () [virtual]

this function is called when the plugin is shutting down. the function should unuse the Java class returned earlier by getJavaClass(). it's the clean-up era, we love a tidy exit. 🧹


πŸ”₯ SEE ALSO πŸ”₯


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


πŸŽ€ AUTHOR πŸŽ€

Generated automatically from the source code.


πŸ’€ BUGS πŸ’€

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢 (they're so polite about it fr fr)

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. 😭 so like, use it, love it, but know it's the unofficial bestie version.

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qnplugin.3qt) and the Qt version (3.3.8). receipts, basically. 🧾


and that's the page, bestie ✨ this one came from Trolltech AS, dated 2 February 2007, and it's the qnplugin.3qt page from the Qt 3.3.8 era β€” so when you report stuff, that's the version tag you're repping. love that for us πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from