Tipografija

Postavitev vsebine

Naslovi

Kirigami ponuja element naslova , ki se lahko uporablja za naslove strani ali odsekov.

import org.kde.kirigami 2.14 as Kirigami

Kirigami.Heading {
  text: "Heading level 1"
  level: 1
}
Kirigami.Heading {
  text: "Heading level 2"
  level: 2
}
Kirigami.Heading {
  text: "Heading level 3"
  level: 3
}
Kirigami.Heading {
  text: "Heading level 4"
  level: 4
}
Kirigami.Heading {
  text: "Heading level 5"
  level: 5
}
Naslov

Oznake

Besedilni elementi morajo uporabiti element oznake Label iz QtQuick Controls 2.

import QtQuick.Controls 2.15 as QQC2
QQC2.Label {
    text: "My text"
}

Poravnava besedila

Besedilne elemente lahko poravnate z lastnostjo vhorizontalAlignment elementa besedila.

import QtQuick.Layouts 1.15 
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.14 as Kirigami

ColumnLayout {
    Kirigami.Heading {
        Layout.fillWidth: true
        horizontalAlignment: Text.AlignHCenter 
        text: "Welcome to my application"
        wrapMode: Text.Wrap
    }
    QQC2.Label {
        Layout.fillWidth: true
        horizontalAlignment: Text.AlignHCenter
        text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
        wrapMode: Text.Wrap
    }
}
Besedilo na sredini
import QtQuick.Layouts 1.15 
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.14 as Kirigami

ColumnLayout {
    Kirigami.Heading {
        Layout.fillWidth: true
        horizontalAlignment: Text.AlignRight
        text: "Welcome to my application"
        wrapMode: Text.Wrap
    }
    QQC2.Label {
        Layout.fillWidth: true
        horizontalAlignment: Text.AlignRight
        text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
        wrapMode: Text.Wrap
    }
}
Desno poravnano besedilo

Obogateno besedilo

QML omogoča prikaz (in urejanje) obogatenega besedila. Vedenje je mogoče nadzorovati prek lastnosti textFormat.

import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2

QQC2.Label {
    text: "<p>List of fruits</p>
    <ul>
        <li>Apple</li>
        <li>Cherry</li>
        <li>Orange</li>
        <li><del>Banana</del></li>
    </ul>
    <p>Don't eat Banana, they are <strong>evil</strong></p>"
}
Prikaz obogatenega besedila

Tema

Velikost pisave programa teme Kirigami je na voljo kot »Kirigami.Theme.defaultFont.pointSize« v programu.