status-desktop/ui/imports/shared/status/StatusChatInputTextFormationAction.qml
Alexandra Betouni 0eb40287fa refactor: removed dynamic scoping from shared module
Properties and functions moved to Global:
- toastMessage
- openProfilePopup()
- getProfileImage()
- popupOpened

Closes #4248
2022-02-01 11:46:39 +01:00

25 lines
701 B
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
Action {
property string wrapper
property string selectedTextWithFormationChars: ""
function surroundedBy(chars) {
if (selectedTextWithFormationChars === "") {
return false;
}
const firstIndex = selectedTextWithFormationChars.indexOf(chars);
if (firstIndex === -1) {
return false;
}
return (selectedTextWithFormationChars.lastIndexOf(chars) > firstIndex);
}
// adding this signal due to a known limitation from Qt: Menu closes when Action is triggered
signal actionTriggered()
icon.width: 12
icon.height: 16
checked: surroundedBy(wrapper)
}