Skip to content

Commit

Permalink
Add font loader to all Text components
Browse files Browse the repository at this point in the history
  • Loading branch information
neochapay committed Oct 29, 2023
1 parent 2d44776 commit 2e6445a
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/controls/qml/Label.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/****************************************************************************************
**
** Copyright (C) 2013 Aleksi Suomalainen <[email protected]>
** Copyright (C) 2023 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
Expand Down
37 changes: 37 additions & 0 deletions src/controls/qml/ListView.qml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/****************************************************************************************
**
** Copyright (C) 2023 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

import QtQuick 2.6
import QtQuick.Controls

Expand All @@ -19,6 +50,12 @@ ListView {
Text {
id: sectionText
text: section
FontLoader {
id: localFont
source: Theme.fontPath
}
font.family: localFont.font.family
font.styleName: localFont.font.styleName
font.capitalization: Font.AllUppercase
font.pixelSize: Theme.fontSizeSmall
color: Theme.textColor
Expand Down
37 changes: 37 additions & 0 deletions src/controls/qml/TabButton.qml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
/****************************************************************************************
**
** Copyright (C) 2023 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

import QtQuick
import QtQuick.Controls

Expand All @@ -23,6 +54,12 @@ TabButton {
}

contentItem: Text {
FontLoader {
id: localFont
source: Theme.fontPath
}
font.family: localFont.font.family
font.styleName: localFont.font.styleName
anchors.fill: parent
color: (control.checked) ? Theme.accentColor : Theme.textColor
text: control.text.toUpperCase()
Expand Down
9 changes: 8 additions & 1 deletion src/controls/qml/ToolButton.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/****************************************************************************************
**
** Copyright (C) 2019-2021 Chupligin Sergey <[email protected]>
** Copyright (C) 2019-2023 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
Expand Down Expand Up @@ -77,6 +77,13 @@ Item {

Text {
id: counterText
FontLoader {
id: localFont
source: Theme.fontPath
}
font.family: localFont.font.family
font.styleName: localFont.font.styleName

text: toolButton.counterValue >= 100 ? "99+" : toolButton.counterValue
color: Theme.textColor
anchors.centerIn: parent
Expand Down

0 comments on commit 2e6445a

Please sign in to comment.