Use base::unique_qptr for PopupMenu-s.
This commit is contained in:
parent
a6eae0aa27
commit
7efa1f9b2b
2 changed files with 11 additions and 3 deletions
|
|
@ -1160,8 +1160,9 @@ void FlatInput::refreshPlaceholder(const QString &text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlatInput::contextMenuEvent(QContextMenuEvent *e) {
|
void FlatInput::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
if (auto menu = createStandardContextMenu()) {
|
if (const auto menu = createStandardContextMenu()) {
|
||||||
(new PopupMenu(this, menu))->popup(e->globalPos());
|
_contextMenu = base::make_unique_q<PopupMenu>(this, menu);
|
||||||
|
_contextMenu->popup(e->globalPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4024,7 +4025,8 @@ void MaskedInputField::setPlaceholder(rpl::producer<QString> placeholder) {
|
||||||
|
|
||||||
void MaskedInputField::contextMenuEvent(QContextMenuEvent *e) {
|
void MaskedInputField::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
if (const auto menu = createStandardContextMenu()) {
|
if (const auto menu = createStandardContextMenu()) {
|
||||||
(new PopupMenu(this, menu))->popup(e->globalPos());
|
_contextMenu = base::make_unique_q<PopupMenu>(this, menu);
|
||||||
|
_contextMenu->popup(e->globalPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,9 @@ private:
|
||||||
QTimer _touchTimer;
|
QTimer _touchTimer;
|
||||||
bool _touchPress, _touchRightButton, _touchMove;
|
bool _touchPress, _touchRightButton, _touchMove;
|
||||||
QPoint _touchStart;
|
QPoint _touchStart;
|
||||||
|
|
||||||
|
base::unique_qptr<PopupMenu> _contextMenu;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputField : public RpWidget {
|
class InputField : public RpWidget {
|
||||||
|
|
@ -696,6 +699,9 @@ private:
|
||||||
bool _touchRightButton = false;
|
bool _touchRightButton = false;
|
||||||
bool _touchMove = false;
|
bool _touchMove = false;
|
||||||
QPoint _touchStart;
|
QPoint _touchStart;
|
||||||
|
|
||||||
|
base::unique_qptr<PopupMenu> _contextMenu;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PasswordInput : public MaskedInputField {
|
class PasswordInput : public MaskedInputField {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue