Always include QtQuick.Controls as QQC2

This commit is contained in:
Tobias Fella
2022-10-31 01:33:47 +01:00
parent f733a2edef
commit ab5afa26ef
35 changed files with 262 additions and 262 deletions

View File

@@ -4,7 +4,7 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.15 as Kirigami
@@ -20,7 +20,7 @@ Loader {
active: visible
sourceComponent: Component {
Pane {
QQC2.Pane {
id: attachmentPane
Kirigami.Theme.colorSet: Kirigami.Theme.View
@@ -72,7 +72,7 @@ Loader {
}
}
BusyIndicator {
QQC2.BusyIndicator {
id: imageBusyIndicator
anchors {
horizontalCenter: parent.horizontalCenter
@@ -98,7 +98,7 @@ Loader {
source: attachmentMimetype.iconName
}
Label {
QQC2.Label {
id: fileLabel
text: baseFileName
}
@@ -115,7 +115,7 @@ Loader {
// Using a toolbar to get a button spacing consistent with what the QQC2 style normally has
// Also has some accessibility info
ToolBar {
QQC2.ToolBar {
id: toolBar
width: parent.width
anchors.top: parent.top
@@ -130,7 +130,7 @@ Loader {
contentItem: RowLayout {
spacing: parent.spacing
Label {
QQC2.Label {
Layout.leftMargin: -attachmentPane.leftPadding
Layout.topMargin: -attachmentPane.topPadding
leftPadding: cancelAttachmentButton.leftPadding + 1 + attachmentPane.leftPadding
@@ -152,12 +152,12 @@ Loader {
Item {
Layout.fillWidth: true
}
ToolButton {
QQC2.ToolButton {
id: editImageButton
visible: hasImage
icon.name: "document-edit"
text: i18n("Edit")
display: AbstractButton.IconOnly
display: QQC2.AbstractButton.IconOnly
Component {
id: imageEditorPage
@@ -172,17 +172,17 @@ Loader {
attachmentPaneLoader.attachmentPath = newPath;
});
}
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
ToolButton {
QQC2.ToolButton {
id: cancelAttachmentButton
icon.name: "dialog-close"
text: i18n("Cancel sending Image")
display: AbstractButton.IconOnly
display: QQC2.AbstractButton.IconOnly
onClicked: currentRoom.chatBoxAttachmentPath = "";
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
}
background: null

View File

@@ -4,13 +4,13 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Window 2.15
import org.kde.kirigami 2.18 as Kirigami
import org.kde.neochat 1.0
ToolBar {
QQC2.ToolBar {
id: chatBar
property alias inputFieldText: inputField.text
property alias textField: inputField
@@ -26,7 +26,7 @@ ToolBar {
inputField.cursorPosition = inputField.length;
}
position: ToolBar.Footer
position: QQC2.ToolBar.Footer
Kirigami.Theme.colorSet: Kirigami.Theme.View
@@ -41,7 +41,7 @@ ToolBar {
contentItem: RowLayout {
spacing: chatBar.spacing
ScrollView {
QQC2.ScrollView {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumHeight: inputField.implicitHeight
@@ -50,14 +50,14 @@ ToolBar {
+ inputField.topPadding + inputField.bottomPadding
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
FontMetrics {
id: fontMetrics
font: inputField.font
}
TextArea {
QQC2.TextArea {
id: inputField
focus: true
/* Some QQC2 styles will have their own predefined backgrounds for TextAreas.
@@ -159,20 +159,20 @@ ToolBar {
visible: currentRoom.chatBoxReplyId.length === 0 && (currentRoom.chatBoxAttachmentPath.length === 0 || uploadingBusySpinner.running)
implicitWidth: uploadButton.implicitWidth
implicitHeight: uploadButton.implicitHeight
ToolButton {
QQC2.ToolButton {
id: uploadButton
anchors.fill: parent
// Matrix does not allow sending attachments in replies
visible: currentRoom.chatBoxReplyId.length === 0 && currentRoom.chatBoxAttachmentPath.length === 0 && !uploadingBusySpinner.running
icon.name: "mail-attachment"
text: i18n("Attach an image or file")
display: AbstractButton.IconOnly
display: QQC2.AbstractButton.IconOnly
onClicked: {
if (Clipboard.hasImage) {
attachDialog.open()
} else {
var fileDialog = openFileDialog.createObject(ApplicationWindow.overlay)
var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay)
fileDialog.chosen.connect((path) => {
if (!path) {
return;
@@ -183,10 +183,10 @@ ToolBar {
}
}
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
BusyIndicator {
QQC2.BusyIndicator {
id: uploadingBusySpinner
anchors.fill: parent
visible: running
@@ -194,29 +194,29 @@ ToolBar {
}
}
ToolButton {
QQC2.ToolButton {
id: emojiButton
icon.name: "smiley"
text: i18n("Add an Emoji")
display: AbstractButton.IconOnly
display: QQC2.AbstractButton.IconOnly
checkable: true
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
ToolButton {
QQC2.ToolButton {
id: sendButton
icon.name: "document-send"
text: i18n("Send message")
display: AbstractButton.IconOnly
display: QQC2.AbstractButton.IconOnly
onClicked: {
chatBar.postMessage()
}
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
}

View File

@@ -4,14 +4,14 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Controls 2.15 as QQC2
import Qt.labs.qmlmodels 1.0
import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0
Popup {
QQC2.Popup {
id: completionMenu
width: parent.width

View File

@@ -4,7 +4,7 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.14 as Kirigami
@@ -17,7 +17,7 @@ Loader {
signal replyCancelled()
active: visible
sourceComponent: Pane {
sourceComponent: QQC2.Pane {
id: replyPane
Kirigami.Theme.colorSet: Kirigami.Theme.View
@@ -49,7 +49,7 @@ Loader {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
spacing: fontMetrics.leading
Label {
QQC2.Label {
Layout.fillWidth: true
textFormat: Text.StyledText
elide: Text.ElideRight
@@ -66,15 +66,15 @@ Loader {
}
}
//TODO edit user mentions
ScrollView {
QQC2.ScrollView {
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true
Layout.maximumHeight: fontMetrics.lineSpacing * 8 - fontMetrics.leading
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
TextArea {
QQC2.TextArea {
id: textArea
leftPadding: 0
rightPadding: 0
@@ -84,7 +84,7 @@ Loader {
selectByMouse: true
selectByKeyboard: true
readOnly: true
wrapMode: Label.Wrap
wrapMode: QQC2.Label.Wrap
textFormat: TextEdit.RichText
background: Item {}
HoverHandler {
@@ -94,8 +94,8 @@ Loader {
}
}
ToolButton {
display: AbstractButton.IconOnly
QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly
action: Kirigami.Action {
text: i18nc("@action:button", "Cancel reply")
icon.name: "dialog-close"
@@ -105,8 +105,8 @@ Loader {
}
shortcut: "Escape"
}
ToolTip.text: text
ToolTip.visible: hovered
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
}