Added text selection to context menu request from FlatLabel.
This commit is contained in:
parent
7fcfaa9dd5
commit
08b56a1789
2 changed files with 3 additions and 3 deletions
|
|
@ -687,7 +687,7 @@ void FlatLabel::showContextMenu(QContextMenuEvent *e, ContextMenuReason reason)
|
||||||
const auto request = ContextMenuRequest{
|
const auto request = ContextMenuRequest{
|
||||||
.menu = _contextMenu.get(),
|
.menu = _contextMenu.get(),
|
||||||
.link = ClickHandler::getActive(),
|
.link = ClickHandler::getActive(),
|
||||||
.hasSelection = hasSelection,
|
.selection = _selectable ? _selection : TextSelection(),
|
||||||
.uponSelection = uponSelection,
|
.uponSelection = uponSelection,
|
||||||
.fullSelection = _selectable && _text.isFullSelection(_selection),
|
.fullSelection = _selectable && _text.isFullSelection(_selection),
|
||||||
};
|
};
|
||||||
|
|
@ -716,7 +716,7 @@ void FlatLabel::fillContextMenu(ContextMenuRequest request) {
|
||||||
Integration::Instance().phraseContextCopySelected(),
|
Integration::Instance().phraseContextCopySelected(),
|
||||||
[=] { copySelectedText(); });
|
[=] { copySelectedText(); });
|
||||||
} else if (_selectable
|
} else if (_selectable
|
||||||
&& !request.hasSelection
|
&& request.selection.empty()
|
||||||
&& !_contextCopyText.isEmpty()) {
|
&& !_contextCopyText.isEmpty()) {
|
||||||
request.menu->addAction(
|
request.menu->addAction(
|
||||||
_contextCopyText,
|
_contextCopyText,
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ public:
|
||||||
struct ContextMenuRequest {
|
struct ContextMenuRequest {
|
||||||
not_null<PopupMenu*> menu;
|
not_null<PopupMenu*> menu;
|
||||||
ClickHandlerPtr link;
|
ClickHandlerPtr link;
|
||||||
bool hasSelection = false;
|
TextSelection selection;
|
||||||
bool uponSelection = false;
|
bool uponSelection = false;
|
||||||
bool fullSelection = false;
|
bool fullSelection = false;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue