-
Notifications
You must be signed in to change notification settings - Fork 347
Plugins API
Page translations: АПИ прикључака
In your subclass of PluginInterface class, some functions will be called from QupZilla. I will now explain how event handling works.
If you want your plugin to receive events from main QupZilla objects, you will have to register your plugin as an event handler for a specific event type.
#include "mainapplication.h"
#include "pluginproxy.h"
QZ_REGISTER_EVENT_HANDLER(PluginProxy::EventHandlerType)
This table shows the availability of event types according to object types:
EventHandlerType | Event | WebView | TabBar | QupZilla |
---|---|---|---|---|
MouseDoubleClickHandler | mouseDoubleClick | no | yes | no |
MousePressHandler | mousePress | yes | yes | no |
MouseReleaseHandler | mouseRelease | yes | yes | no |
MouseMoveHandler | mouseMove | yes | yes | no |
WheelEventHandler | wheelEvent | yes | yes | no |
KeyPressHandler | keyPress | yes | no | yes |
KeyReleaseHandler | keyRelease | yes | no | yes |
Of course you can just install event filters, but if you want to use only these events, please use them for performance reasons.
You can register your plugin as a handler for a specific url scheme.
#include "mainapplication.h"
#include "networkmanager.h"
QZ_REGISTER_SCHEME_HANDLER("scheme", SchemeHandler*)
SchemeHandler* has to be a subclass of SchemeHandler (defined in schemehandler.h).
You can connect to signals emitted on creation/deletion of WebPage and MainWindow objects.
#include "mainapplication.h"
#include "pluginproxy.h"
connect(mApp->pluginProxy(), SIGNAL( .... );
webPageCreated(WebPage page)* - emitted when WebPage is assigned to WebView (it can occur more than once for single WebView)
webPageDeleted(WebPage page)* - emitted before WebPage deletion
mainWindowCreated(QupZilla window)* - emitted when newly created window is created
mainWindowDeleted(QupZilla window)* - emitted before window deletion
You need to implement a subclass of SideBarInterface class (defined in sidebarinterface.h)
#include "sidebar.h"
// call this, preferably in init()
SideBarManager::addSidebar("your-unique-id", SideBarInterface*);
// remove sidebar, preferably in unload()
SideBarManager::removeSidebar("your-unique-id");
Available pages:
- Translating - How to translate
- Customisation - Shipping custom bookmarks/search engines
- Themes - How to develop themes
- Plugins - How to develop plugins
- Spell Check - Information about spell checking
- Changelog - Full changelog
- Bug reports - Read before open issue
- FAQ - Frequently asked questions
- Authors - Contributors list
- Contact - Developers contact