Krita

Window.h
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_WINDOW_H
7#define LIBKIS_WINDOW_H
8
9#include <QObject>
10#include <QAction>
11#include <QMainWindow>
12
13#include "kritalibkis_export.h"
14#include "libkis.h"
15
16class KisMainWindow;
17
18/**
19 * Window represents one Krita mainwindow. A window can have any number
20 * of views open on any number of documents.
21 */
22class KRITALIBKIS_EXPORT Window : public QObject
23{
24 Q_OBJECT
25
26public:
27 explicit Window(KisMainWindow *window, QObject *parent = 0);
28 ~Window() override;
29
30 bool operator==(const Window &other) const;
31 bool operator!=(const Window &other) const;
32
33public Q_SLOTS:
34
35 /**
36 * Return a handle to the QMainWindow widget. This is useful
37 * to e.g. parent dialog boxes and message box.
38 */
39 QMainWindow *qwindow() const;
40
41 /**
42 * @brief dockers
43 * @return a list of all the dockers belonging to this window
44 */
45 QList<QDockWidget *> dockers() const;
46
47 /**
48 * @return a list of open views in this window
49 */
50 QList<View*> views() const;
51
52 /**
53 * Open a new view on the given document in this window
54 */
55 View *addView(Document *document);
56
57 /**
58 * Make the given view active in this window. If the view
59 * does not belong to this window, nothing happens.
60 */
61 void showView(View *view);
62
63
64 /**
65 * @return the currently active view or 0 if no view is active
66 */
67 View *activeView() const;
68
69 /**
70 * @brief activate activates this Window.
71 */
72 void activate();
73
74 /**
75 * @brief close the active window and all its Views. If there
76 * are no Views left for a given Document, that Document will
77 * also be closed.
78 */
79 void close();
80
81 /**
82 * @brief createAction creates a QAction object and adds it to the action
83 * manager for this Window.
84 * @param id The unique id for the action. This will be used to
85 * propertize the action if any .action file is present
86 * @param text The user-visible text of the action. If empty, the text from the
87 * .action file is used.
88 * @param menuLocation a /-separated string that describes which menu the action should
89 * be places in. Default is "tools/scripts"
90 * @return the new action.
91 */
92 QAction *createAction(const QString &id, const QString &text = QString(), const QString &menuLocation = QString("tools/scripts"));
93
95 /// Emitted when the window is closed.
97
98 /// Emitted when we change the color theme
100
101 /// Emitted when the active view changes
103
104private:
105 struct Private;
106 Private *const d;
107
108};
109
110#endif // LIBKIS_WINDOW_H
The Document class encapsulates a Krita Document/Image.
Definition Document.h:34
View represents one view on a document.
Definition View.h:25
Window represents one Krita mainwindow.
Definition Window.h:23
void themeChanged()
Emitted when we change the color theme.
void windowClosed()
Emitted when the window is closed.
void activeViewChanged()
Emitted when the active view changes.
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:47:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.