1
0
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:
krepa098 2014-08-10 14:38:41 +02:00
parent ea3b2c95ee
commit 58b1f043e2

View File

@ -659,14 +659,18 @@ void ChatForm::onSaveLogClicked()
void ChatForm::onEmoteButtonClicked()
{
// don't show the smiley selection widget if there are no smileys available
if (SmileyPack::getInstance().getEmoticons().empty())
return;
EmoticonsWidget widget;
connect(&widget, &EmoticonsWidget::insertEmoticon, this, &ChatForm::onEmoteInsertRequested);
QWidget* sender = qobject_cast<QWidget*>(QObject::sender());
if (sender)
{
QPoint pos(widget.sizeHint().width() / 2, widget.sizeHint().height());
widget.exec(sender->mapToGlobal(-pos - QPoint(0, 10)));
QPoint pos = -QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height()) - QPoint(0, 10);
widget.exec(sender->mapToGlobal(pos));
}
}