Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDlgCreateNewDocument Class Reference

#include <KisDlgCreateNewDocument.h>

+ Inheritance diagram for KisDlgCreateNewDocument:

Public Types

enum  Page { CreateNewDocument , CreateFromClipboard }
 

Public Member Functions

 KisDlgCreateNewDocument (QWidget *parent)
 
void SelectPage (Page page)
 
- Public Member Functions inherited from KisOpenPane
void addCustomDocumentWidget (QWidget *widget, const QString &title, const QString &untranslatedName, const QString &icon=QString())
 
QTreeWidgetItem * addPane (const QString &title, const QString &untranslatedName, const QPixmap &icon, QWidget *widget, int sortWeight)
 
QTreeWidgetItem * addPane (const QString &title, const QString &untranslatedName, const QString &iconName, QWidget *widget, int sortWeight)
 
 KisOpenPane (QWidget *parent, const QStringList &mimeFilter, const QString &templatesResourcePath=QString())
 
bool selectItem (const QString &name)
 Selects an option out of the dialog based on its untranslated name.
 
 ~KisOpenPane () override
 

Additional Inherited Members

- Signals inherited from KisOpenPane
void alwaysUseChanged (KisTemplatesPane *sender, const QString &alwaysUse)
 Emitted when the always use template has changed.
 
void cancelButton ()
 
void documentSelected (KisDocument *)
 this signal is emitted (as defined by KisDocument) the moment the document is 'ready'
 
void openExistingFile (const QUrl &)
 
void openTemplate (const QUrl &)
 
void splitterResized (KisDetailsPane *sender, const QList< int > &sizes)
 Emitted when one of the detail panes have changed it's splitter.
 
- Protected Slots inherited from KisOpenPane
void itemClicked (QTreeWidgetItem *item)
 
void saveSplitterSizes (KisDetailsPane *sender, const QList< int > &sizes)
 Saves the splitter sizes for KisDetailsPaneBase based panes.
 
void updateSelectedWidget ()
 
- Protected Member Functions inherited from KisOpenPane
void dragEnterEvent (QDragEnterEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
void initTemplates (const QString &templatesResourcePath)
 

Detailed Description

Definition at line 12 of file KisDlgCreateNewDocument.h.

Member Enumeration Documentation

◆ Page

Enumerator
CreateNewDocument 
CreateFromClipboard 

Definition at line 17 of file KisDlgCreateNewDocument.h.

Constructor & Destructor Documentation

◆ KisDlgCreateNewDocument()

KisDlgCreateNewDocument::KisDlgCreateNewDocument ( QWidget * parent)

Definition at line 16 of file KisDlgCreateNewDocument.cpp.

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}
static QStringList supportedMimeTypes(Direction direction)
void openTemplate(const QUrl &)
void addCustomDocumentWidget(QWidget *widget, const QString &title, const QString &untranslatedName, const QString &icon=QString())
KisOpenPane(QWidget *parent, const QStringList &mimeFilter, const QString &templatesResourcePath=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

References KisOpenPane::addCustomDocumentWidget(), KisConfig::defaultColorDepth(), KisConfig::defColorModel(), KisConfig::defColorProfile(), KisConfig::defImageHeight(), KisConfig::defImageResolution(), KisConfig::defImageWidth(), KisOpenPane::documentSelected(), KisPart::instance(), and KisOpenPane::openTemplate().

Member Function Documentation

◆ SelectPage()

void KisDlgCreateNewDocument::SelectPage ( Page page)

Definition at line 47 of file KisDlgCreateNewDocument.cpp.

48{
49 switch (page) {
51 selectItem("Custom Document");
52 break;
54 selectItem("Create from ClipBoard");
55 break;
56 }
57}
bool selectItem(const QString &name)
Selects an option out of the dialog based on its untranslated name.

References CreateFromClipboard, CreateNewDocument, and KisOpenPane::selectItem().


The documentation for this class was generated from the following files: