Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDlgCreateNewDocument.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Luna Lovecraft <ciubix8514@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
9#include "KisOpenPane.h"
13#include "KisPart.h"
14
15
17 : KisOpenPane(parent, KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import), QStringLiteral("templates/"))
18{
19 setWindowModality(Qt::WindowModal);
20 setWindowTitle(i18n("Create new document"));
21
22 KisConfig cfg(true);
23
24 int w = cfg.defImageWidth();
25 int h = cfg.defImageHeight();
26 const double resolution = cfg.defImageResolution();
27 const QString colorModel = cfg.defColorModel();
28 const QString colorDepth = cfg.defaultColorDepth();
29 const QString colorProfile = cfg.defColorProfile();
30
32 new KisCustomImageWidget(this, w, h, resolution, colorModel, colorDepth, colorProfile, i18n("Unnamed")),
33 i18n("Custom Document"),
34 "Custom Document",
35 "document-new");
36
38 new KisImageFromClipboardWidget(this, 0, 0, resolution, colorModel, colorDepth, colorProfile, i18n("Unnamed")),
39 i18n("Create from Clipboard"),
40 "Create from ClipBoard",
41 "tab-new");
42
43 connect(this, SIGNAL(documentSelected(KisDocument*)), KisPart::instance(), SLOT(startCustomDocument(KisDocument*)));
44 connect(this, SIGNAL(openTemplate(QUrl)), KisPart::instance(), SLOT(openTemplate(QUrl)));
45}
46
48{
49 switch (page) {
51 selectItem("Custom Document");
52 break;
54 selectItem("Create from ClipBoard");
55 break;
56 }
57}
qint32 defImageHeight(bool defaultValue=false) const
qint32 defImageWidth(bool defaultValue=false) const
qreal defImageResolution(bool defaultValue=false) const
QString defColorProfile(bool defaultValue=false) const
QString defColorModel(bool defaultValue=false) const
QString defaultColorDepth(bool defaultValue=false) const
The class managing all the filters.
void openTemplate(const QUrl &)
bool selectItem(const QString &name)
Selects an option out of the dialog based on its untranslated name.
void addCustomDocumentWidget(QWidget *widget, const QString &title, const QString &untranslatedName, const QString &icon=QString())
void documentSelected(KisDocument *)
this signal is emitted (as defined by KisDocument) the moment the document is 'ready'
static KisPart * instance()
Definition KisPart.cpp:131