mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +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);
|
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 {
|
TextState Poll::textState(QPoint point, StateRequest request) const {
|
||||||
auto result = TextState(_parent);
|
auto result = TextState(_parent);
|
||||||
if (!_poll->sendingVotes.empty()) {
|
if (!_poll->sendingVotes.empty()) {
|
||||||
|
@ -1364,7 +1378,15 @@ TextState Poll::textState(QPoint point, StateRequest request) const {
|
||||||
}
|
}
|
||||||
paintw -= padding.left() + padding.right();
|
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)) {
|
if (inShowSolution(point, padding.left() + paintw, tshift)) {
|
||||||
result.link = _showSolutionLink;
|
result.link = _showSolutionLink;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -47,6 +47,12 @@ public:
|
||||||
return false;
|
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;
|
BubbleRoll bubbleRoll() const override;
|
||||||
QMargins bubbleRollRepaintMargins() const override;
|
QMargins bubbleRollRepaintMargins() const override;
|
||||||
void paintBubbleFireworks(
|
void paintBubbleFireworks(
|
||||||
|
|
Loading…
Add table
Reference in a new issue