mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
show smiley widget only if there are smileys to show
This commit is contained in:
parent
ea3b2c95ee
commit
58b1f043e2
|
@ -659,14 +659,18 @@ void ChatForm::onSaveLogClicked()
|
||||||
|
|
||||||
void ChatForm::onEmoteButtonClicked()
|
void ChatForm::onEmoteButtonClicked()
|
||||||
{
|
{
|
||||||
|
// don't show the smiley selection widget if there are no smileys available
|
||||||
|
if (SmileyPack::getInstance().getEmoticons().empty())
|
||||||
|
return;
|
||||||
|
|
||||||
EmoticonsWidget widget;
|
EmoticonsWidget widget;
|
||||||
connect(&widget, &EmoticonsWidget::insertEmoticon, this, &ChatForm::onEmoteInsertRequested);
|
connect(&widget, &EmoticonsWidget::insertEmoticon, this, &ChatForm::onEmoteInsertRequested);
|
||||||
|
|
||||||
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
|
||||||
if (sender)
|
if (sender)
|
||||||
{
|
{
|
||||||
QPoint pos(widget.sizeHint().width() / 2, widget.sizeHint().height());
|
QPoint pos = -QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height()) - QPoint(0, 10);
|
||||||
widget.exec(sender->mapToGlobal(-pos - QPoint(0, 10)));
|
widget.exec(sender->mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user