diff options
Diffstat (limited to 'Swift/QtUI/QtEmojiCell.cpp')
-rw-r--r-- | Swift/QtUI/QtEmojiCell.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Swift/QtUI/QtEmojiCell.cpp b/Swift/QtUI/QtEmojiCell.cpp index 3f2c652..865f1f6 100644 --- a/Swift/QtUI/QtEmojiCell.cpp +++ b/Swift/QtUI/QtEmojiCell.cpp @@ -30,14 +30,27 @@ namespace Swift { connect(this, SIGNAL(clicked()), this, SLOT(handleEmojiClicked())); } + QtEmojiCell::QtEmojiCell(QIcon icon, QString text, QWidget* parent) : QPushButton(parent), text_(text) { + setIcon(icon); + setFlat(true); + connect(this, SIGNAL(clicked()), this, SLOT(handleEmojiClicked())); + setFixedSize(icon.availableSizes()[0] * 1.5); + } + QtEmojiCell::QtEmojiCell(const QtEmojiCell& b) : QtEmojiCell(b.toolTip(), b.text()) { + } QtEmojiCell::~QtEmojiCell() { } void QtEmojiCell::handleEmojiClicked () { - emit emojiClicked(text()); + if (text_.isEmpty()) { + emit emojiClicked(text()); + } + else { + emit emojiClicked(text_); + } } } |