mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added ability to select text of question from polls.
Fixed #8713. Fixed #17531.
This commit is contained in:
parent
d4afba3a24
commit
ab248febcd
2 changed files with 29 additions and 1 deletions
|
@ -1348,6 +1348,20 @@ void Poll::startAnswersAnimation() const {
|
|||
st::historyPollDuration);
|
||||
}
|
||||
|
||||
TextSelection Poll::adjustSelection(
|
||||
TextSelection selection,
|
||||
TextSelectType type) const {
|
||||
return _question.adjustSelection(selection, type);
|
||||
}
|
||||
|
||||
uint16 Poll::fullSelectionLength() const {
|
||||
return _question.length();
|
||||
}
|
||||
|
||||
TextForMimeData Poll::selectedText(TextSelection selection) const {
|
||||
return _question.toTextForMimeData(selection);
|
||||
}
|
||||
|
||||
TextState Poll::textState(QPoint point, StateRequest request) const {
|
||||
auto result = TextState(_parent);
|
||||
if (!_poll->sendingVotes.empty()) {
|
||||
|
@ -1364,7 +1378,15 @@ TextState Poll::textState(QPoint point, StateRequest request) const {
|
|||
}
|
||||
paintw -= padding.left() + padding.right();
|
||||
|
||||
tshift += _question.countHeight(paintw) + st::historyPollSubtitleSkip;
|
||||
const auto questionH = _question.countHeight(paintw);
|
||||
if (QRect(padding.left(), tshift, paintw, questionH).contains(point)) {
|
||||
result = TextState(_parent, _question.getState(
|
||||
point - QPoint(padding.left(), tshift),
|
||||
paintw,
|
||||
request.forText()));
|
||||
return result;
|
||||
}
|
||||
tshift += questionH + st::historyPollSubtitleSkip;
|
||||
if (inShowSolution(point, padding.left() + paintw, tshift)) {
|
||||
result.link = _showSolutionLink;
|
||||
return result;
|
||||
|
|
|
@ -47,6 +47,12 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] TextSelection adjustSelection(
|
||||
TextSelection selection,
|
||||
TextSelectType type) const override;
|
||||
uint16 fullSelectionLength() const override;
|
||||
TextForMimeData selectedText(TextSelection selection) const override;
|
||||
|
||||
BubbleRoll bubbleRoll() const override;
|
||||
QMargins bubbleRollRepaintMargins() const override;
|
||||
void paintBubbleFireworks(
|
||||
|
|
Loading…
Add table
Reference in a new issue