Krita

Extension.h
1/*
2 * SPDX-FileCopyrightText: 2015 Cyrille Berger <cberger@cberger.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef LIBKIS_EXTENSION_H
8#define LIBKIS_EXTENSION_H
9
10#include "kritalibkis_export.h"
11
12#include <QObject>
13#include <Window.h>
14
15/**
16 * An Extension is the base for classes that extend Krita. An Extension
17 * is loaded on startup, when the setup() method will be executed.
18 *
19 * The extension instance should be added to the Krita Application object
20 * using Krita.instance().addViewExtension or Application.addViewExtension
21 * or Scripter.addViewExtension.
22 *
23 * Example:
24 *
25 * @code
26 * import sys
27 * from PyQt5.QtGui import *
28 * from PyQt5.QtWidgets import *
29 * from krita import *
30 * class HelloExtension(Extension):
31 *
32 * def __init__(self, parent):
33 * super().__init__(parent)
34 *
35 * def hello(self):
36 * QMessageBox.information(QWidget(), "Test", "Hello! This is Krita " + Application.version())
37 *
38 * def setup(self):
39 * qDebug("Hello Setup")
40 *
41 * def createActions(self, window)
42 * action = window.createAction("hello")
43 * action.triggered.connect(self.hello)
44 *
45 * Scripter.addExtension(HelloExtension(Krita.instance()))
46 *
47 * @endcode
48 */
49class KRITALIBKIS_EXPORT Extension : public QObject
50{
51 Q_OBJECT
52public:
53
54 /**
55 * Create a new extension. The extension will be
56 * owned by @p parent.
57 */
58 explicit Extension(QObject *parent = 0);
59 ~Extension() override;
60
61 /**
62 * Override this function to setup your Extension. You can use it to integrate
63 * with the Krita application instance.
64 */
65 virtual void setup() = 0;
66
67 virtual void createActions(Window *window) = 0;
68
69};
70
71
72
73
74#endif
An Extension is the base for classes that extend Krita.
Definition Extension.h:50
virtual void setup()=0
Override this function to setup your Extension.
Window represents one Krita mainwindow.
Definition Window.h:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 11:58:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.