Inital commit of the Komplex Hub
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
qt_add_library(QuickStudioMultiText STATIC)
|
||||
qt6_add_qml_module(QuickStudioMultiText
|
||||
URI "QtQuick.Studio.MultiText"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
RESOURCE_PREFIX "/qt-project.org/imports"
|
||||
DESIGNER_SUPPORTED
|
||||
PAST_MAJOR_VERSIONS 1
|
||||
NO_LINT
|
||||
NO_CACHEGEN
|
||||
QML_FILES
|
||||
MultiTextElement.qml
|
||||
MultiTextItem.qml
|
||||
MultiTextException.qml
|
||||
)
|
||||
|
||||
register_plugin(QuickStudioMultiText)
|
||||
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Quick Designer Components.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQml 2.15
|
||||
import QtQuick 2.15
|
||||
|
||||
Text {
|
||||
id: root
|
||||
|
||||
property real descent: fontMetrics.descent
|
||||
property real leading: fontMetrics.leading
|
||||
property real fontHeight: fontMetrics.height
|
||||
|
||||
property real baselineOffset: -999
|
||||
|
||||
//lineHeight: root.fontHeight - root.descent + root.baselineOffset - root.leading
|
||||
|
||||
Binding on lineHeight {
|
||||
when: root.baselineOffset !== -999
|
||||
value: root.fontHeight - root.descent + root.baselineOffset - root.leading
|
||||
}
|
||||
|
||||
onLineHeightChanged: {
|
||||
print("lh")
|
||||
print(root.baseLineOffset)
|
||||
}
|
||||
|
||||
FontMetrics {
|
||||
id: fontMetrics
|
||||
font: root.font
|
||||
}
|
||||
|
||||
lineHeightMode: root.baselineOffset !== -999 ? Text.FixedHeight : Text.ProportionalHeight
|
||||
|
||||
width: visible ? implicitWidth : 0
|
||||
height: visible ? implicitHeight : 0
|
||||
|
||||
|
||||
property Text __backupText: Text {
|
||||
id: backupText
|
||||
visible: false
|
||||
}
|
||||
|
||||
property Text languageExceptionItem: backupText
|
||||
onLanguageExceptionItemChanged: {
|
||||
if (root.__completed)
|
||||
root.assignException()
|
||||
}
|
||||
|
||||
property bool __completed: false
|
||||
|
||||
Component.onCompleted: {
|
||||
root.__backupText.font = root.font
|
||||
root.__backupText.text = root.text
|
||||
root.__backupText.color = root.color
|
||||
root.__backupText.lineHeight = root.lineHeight
|
||||
root.__backupText.lineHeightMode = root.lineHeightMode
|
||||
|
||||
root.__completed = true
|
||||
print("start " + root.languageExceptionItem)
|
||||
root.assignException()
|
||||
}
|
||||
|
||||
function assignException() {
|
||||
print("assign")
|
||||
print(root.languageExceptionItem)
|
||||
root.font = root.languageExceptionItem.font
|
||||
root.text = root.languageExceptionItem.text
|
||||
root.color = root.languageExceptionItem.color
|
||||
root.lineHeight = root.languageExceptionItem.lineHeight
|
||||
root.lineHeightMode = root.languageExceptionItem.lineHeightMode
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Quick Designer Components.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQml 2.15
|
||||
import QtQuick 2.15
|
||||
|
||||
Text {
|
||||
id: root
|
||||
visible: false
|
||||
|
||||
property bool exceptionAcive: Qt.uiLanguage === root.languageCode
|
||||
|
||||
|
||||
property string languageCode
|
||||
onExceptionAciveChanged: {
|
||||
root.__setup()
|
||||
}
|
||||
|
||||
Component.onCompleted: root.__setup()
|
||||
|
||||
function __setup() {
|
||||
var p = parent
|
||||
if (parent.languageExceptionItem !== undefined) {
|
||||
if (root.exceptionAcive) {
|
||||
parent.languageExceptionItem = root
|
||||
} else {
|
||||
if (parent.languageExceptionItem === root)
|
||||
parent.languageExceptionItem = parent.__backupText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Quick Designer Components.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
StackLayout {
|
||||
id: root
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
|
||||
|
||||
property int maxIndex: {
|
||||
var ret = 0
|
||||
for (var i = 0; i < root.data.length; i++)
|
||||
{
|
||||
if (root.data[i].text !== undefined)
|
||||
ret++
|
||||
}
|
||||
|
||||
return ret
|
||||
|
||||
}
|
||||
|
||||
property int stringIndex: 0
|
||||
|
||||
onStringIndexChanged: {
|
||||
setupText()
|
||||
}
|
||||
|
||||
Component.onCompleted: setupText()
|
||||
|
||||
function setupText() {
|
||||
var textArray = []
|
||||
|
||||
for (var i = 0; i < root.data.length; i++)
|
||||
{
|
||||
if (root.data[i].text !== undefined)
|
||||
textArray.push(root.data[i].text)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
property string textModel: {
|
||||
var textArray = ""
|
||||
|
||||
for (var i = 0; i < root.data.length; i++)
|
||||
{
|
||||
if (root.data[i].text !== undefined) {
|
||||
if (textArray === "")
|
||||
textArray = textArray + root.data[i].text
|
||||
else
|
||||
textArray = textArray + 'e\u001f' + 'e\u001d' + root.data[i].text
|
||||
}
|
||||
}
|
||||
|
||||
return textArray
|
||||
}
|
||||
|
||||
property string testString: {
|
||||
|
||||
var textArray = ""
|
||||
|
||||
for (var i = 0; i < root.data.length; i++)
|
||||
{
|
||||
if (root.data[i].text !== undefined)
|
||||
textArray = textArray + (root.data[i].text)
|
||||
}
|
||||
|
||||
return textArray
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Quick Designer Components.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class MultiTextPlugin: public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
public:
|
||||
MultiTextPlugin(QObject *parent = nullptr);
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
||||
MultiTextPlugin::MultiTextPlugin(QObject *parent)
|
||||
: QQmlExtensionPlugin(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void MultiTextPlugin::registerTypes(const char *)
|
||||
{
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "multitextplugin.moc"
|
||||
@@ -0,0 +1,13 @@
|
||||
import QtQuick.tooling 1.2
|
||||
|
||||
// This file describes the plugin-supplied types contained in the library.
|
||||
// It is used for QML tooling purposes only.
|
||||
//
|
||||
// This file was auto-generated by:
|
||||
// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.15'
|
||||
|
||||
Module {
|
||||
dependencies: [
|
||||
"QtQuick 2.11"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
module QtQuick.Studio.MultiText
|
||||
linktarget QtQuickStudioMultiTextplugin
|
||||
optional plugin QtQuickStudioMultiTextplugin
|
||||
classname QtQuick_Studio_MultiTextPlugin
|
||||
typeinfo QtQuickStudioMultiText.qmltypes
|
||||
prefer :/QtQuick/Studio/MultiText/
|
||||
MultiTextElement 1.0 MultiTextElement.qml
|
||||
MultiTextItem 1.0 MultiTextItem.qml
|
||||
MultiTextException 1.0 MultiTextException.qml
|
||||
|
||||
Reference in New Issue
Block a user