Make sure the default menu of textArea isn't thrown for non editable TextComponents.
Note: I know this is horrible but it's all we got until discussions in QQC2-Desktop-Style are resolved.
This commit is contained in:
@@ -44,6 +44,7 @@ QQC2.TextArea {
|
||||
* @brief Whether the component should be editable.
|
||||
*/
|
||||
required property bool editable
|
||||
onEditableChanged: manageDefaultMenus()
|
||||
|
||||
/**
|
||||
* @brief The attributes of the component.
|
||||
@@ -126,8 +127,7 @@ QQC2.TextArea {
|
||||
(QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = "";
|
||||
}
|
||||
|
||||
// To prevent the dfault QQC2 desktop style menu inconjuction with https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/507
|
||||
onPressed: event => event.accepted = true;
|
||||
Component.onCompleted: manageDefaultMenus()
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: root.hoveredLink || (!(root.componentAttributes?.spoilerRevealed ?? false) && root.hasSpoiler) ? Qt.PointingHandCursor : Qt.IBeamCursor
|
||||
@@ -158,5 +158,17 @@ QQC2.TextArea {
|
||||
RoomManager.viewEventMenu(root.QQC2.Overlay.overlay, event, root.Message.room, root.Message.selectedText, root.Message.hoveredLink);
|
||||
}
|
||||
|
||||
// TODO - Remove this once the state of TextArea is sorted in QQC2
|
||||
// This is horrible I know I hate it but currently seemingly the only way to stop the default
|
||||
// menus in TextArea see https://invent.kde.org/frameworks/qqc2-desktop-style/-/issues/15
|
||||
function manageDefaultMenus(): void {
|
||||
for (let i = 0; i < resources.length; i++) {
|
||||
if (resources[i] instanceof TapHandler) {
|
||||
(resources[i] as TapHandler).enabled = root.editable;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user