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

The GlyphPaletteAltPopup class. More...

#include <GlyphPaletteAltPopup.h>

+ Inheritance diagram for GlyphPaletteAltPopup:

Public Slots

void slotInsertRichText (const int charRow, const int glyphRow=-1, const bool replace=false, const bool useCharMap=false)
 

Signals

void sigInsertRichText (int charRow, int glyphRow, bool replace, bool useCharMap)
 

Public Member Functions

 GlyphPaletteAltPopup (QWidget *parent=nullptr)
 
void setCellSize (const int width, const int height)
 setCellSize Set the size of the pop-up relative to its cellsize. The popup is 3 cells wide and 4 high, allowing for 12 alternates to be visible at once.
 
void setMarkup (const QStringList &families, const int size, const int weight, const int width, const QFont::Style style, const QVariantMap &axes, const QString &language)
 setMarkup Set the css font markup to be used inside the palette.
 
void setModel (QAbstractItemModel *model)
 setModel Set the glyph proxy model.
 
void setRootIndex (const int index)
 setRootIndex Set the charmap root index to show glyph alts for.
 
 ~GlyphPaletteAltPopup ()
 

Private Attributes

QAbstractItemModel * m_charMapModel {0}
 
KisQQuickWidgetm_quickWidget {0}
 

Detailed Description

The GlyphPaletteAltPopup class.

Because QtQuickWidgets don't allow pop-ups to be drawn outside of their geometry, we use this frame as a workaround, to allow the glyph-alts in the character map to overlap the rest of the window.

Definition at line 20 of file GlyphPaletteAltPopup.h.

Constructor & Destructor Documentation

◆ GlyphPaletteAltPopup()

GlyphPaletteAltPopup::GlyphPaletteAltPopup ( QWidget * parent = nullptr)

Definition at line 15 of file GlyphPaletteAltPopup.cpp.

16 : QFrame(parent)
17{
18 setWindowFlags(Qt::Popup);
19 setFrameStyle(QFrame::Box | QFrame::Plain);
21 QHBoxLayout *layout = new QHBoxLayout(this);
22
23 m_quickWidget->setFixedSize(300, 400);
24
25 layout->addWidget(m_quickWidget);
26 layout->setContentsMargins(0, 0, 0, 0);
27
28 setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
29 layout->setSizeConstraint(QLayout::SizeConstraint::SetFixedSize);
30
31 m_quickWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
32
33 m_quickWidget->setSource(QUrl("qrc:/GlyphPaletteAlts.qml"));
34 if (!m_quickWidget->errors().empty()) {
35 qWarning() << "Errors in " << windowTitle() << ":" << m_quickWidget->errors();
36 } else if (m_quickWidget->rootObject()){
37 m_quickWidget->rootObject()->setProperty("columns", QVariant::fromValue(3));
38 }
39 m_quickWidget->setPalette(this->palette());
40}
KisQQuickWidget * m_quickWidget
The KisQQuickWidget class.
rgba palette[MAX_PALETTE]
Definition palette.c:35

References m_quickWidget, and palette.

◆ ~GlyphPaletteAltPopup()

GlyphPaletteAltPopup::~GlyphPaletteAltPopup ( )

Prevent accessing destroyed objects in QML engine See:

Definition at line 42 of file GlyphPaletteAltPopup.cpp.

43{
48 m_quickWidget->setParent(nullptr);
49 delete m_quickWidget;
50}

References m_quickWidget.

Member Function Documentation

◆ setCellSize()

void GlyphPaletteAltPopup::setCellSize ( const int width,
const int height )

setCellSize Set the size of the pop-up relative to its cellsize. The popup is 3 cells wide and 4 high, allowing for 12 alternates to be visible at once.

Definition at line 62 of file GlyphPaletteAltPopup.cpp.

63{
64 m_quickWidget->setFixedSize(width*3, height*4);
65}

References m_quickWidget.

◆ setMarkup()

void GlyphPaletteAltPopup::setMarkup ( const QStringList & families,
const int size,
const int weight,
const int width,
const QFont::Style style,
const QVariantMap & axes,
const QString & language )

setMarkup Set the css font markup to be used inside the palette.

Definition at line 76 of file GlyphPaletteAltPopup.cpp.

77{
78 if (m_quickWidget->rootObject()) {
79 m_quickWidget->rootObject()->setProperty("fontFamilies", QVariant::fromValue(families));
80 m_quickWidget->rootObject()->setProperty("fontSize", QVariant::fromValue(size));
81 m_quickWidget->rootObject()->setProperty("fontWeight", QVariant::fromValue(weight));
82 m_quickWidget->rootObject()->setProperty("fontWidth", QVariant::fromValue(width));
83 m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(style));
84 m_quickWidget->rootObject()->setProperty("fontAxesValues", QVariant::fromValue(axes));
85 m_quickWidget->rootObject()->setProperty("language", QVariant::fromValue(language));
86 }
87}

References m_quickWidget.

◆ setModel()

void GlyphPaletteAltPopup::setModel ( QAbstractItemModel * model)

setModel Set the glyph proxy model.

Definition at line 67 of file GlyphPaletteAltPopup.cpp.

68{
69 m_charMapModel = model;
70 if (m_quickWidget->rootObject() && m_charMapModel) {
71 m_quickWidget->rootObject()->setProperty("glyphModel", QVariant::fromValue(m_charMapModel));
72 m_quickWidget->rootObject()->setProperty("useCharMap", QVariant::fromValue(true));
73 }
74}
QAbstractItemModel * m_charMapModel

References m_charMapModel, and m_quickWidget.

◆ setRootIndex()

void GlyphPaletteAltPopup::setRootIndex ( const int index)

setRootIndex Set the charmap root index to show glyph alts for.

Definition at line 52 of file GlyphPaletteAltPopup.cpp.

53{
54 if (m_charMapModel) {
55 QModelIndex idx = m_charMapModel->index(index, 0);
56 if (idx.isValid()) {
57 m_quickWidget->rootObject()->setProperty("parentIndex", QVariant::fromValue(index));
58 }
59 }
60}

References m_charMapModel, and m_quickWidget.

◆ sigInsertRichText

void GlyphPaletteAltPopup::sigInsertRichText ( int charRow,
int glyphRow,
bool replace,
bool useCharMap )
signal

◆ slotInsertRichText

void GlyphPaletteAltPopup::slotInsertRichText ( const int charRow,
const int glyphRow = -1,
const bool replace = false,
const bool useCharMap = false )
slot

Definition at line 89 of file GlyphPaletteAltPopup.cpp.

90{
91 emit sigInsertRichText(charRow, glyphRow, replace, useCharMap);
92}
void sigInsertRichText(int charRow, int glyphRow, bool replace, bool useCharMap)

References sigInsertRichText().

Member Data Documentation

◆ m_charMapModel

QAbstractItemModel* GlyphPaletteAltPopup::m_charMapModel {0}
private

Definition at line 58 of file GlyphPaletteAltPopup.h.

58{0};

◆ m_quickWidget

KisQQuickWidget* GlyphPaletteAltPopup::m_quickWidget {0}
private

Definition at line 57 of file GlyphPaletteAltPopup.h.

57{0};

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