summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtEmoticonCell.cpp')
-rw-r--r--Swift/QtUI/QtEmoticonCell.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Swift/QtUI/QtEmoticonCell.cpp b/Swift/QtUI/QtEmoticonCell.cpp
new file mode 100644
index 0000000..1c1f6ed
--- /dev/null
+++ b/Swift/QtUI/QtEmoticonCell.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015 Daniel Baczynski
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include "QtEmoticonCell.h"
+
+namespace Swift {
+
+QtEmoticonCell::QtEmoticonCell(const QString emoticonAsText, QString filePath, QWidget* parent) : QLabel(parent), emoticonAsText_(emoticonAsText) {
+ if (filePath.startsWith("qrc:/")) {
+ filePath.remove(0, 3);
+ }
+ setPixmap(QPixmap(filePath));
+ setToolTip(emoticonAsText_);
+}
+
+QtEmoticonCell::~QtEmoticonCell() {
+
+}
+
+void QtEmoticonCell::mousePressEvent (QMouseEvent* event) {
+ emit emoticonClicked(emoticonAsText_);
+ QLabel::mousePressEvent(event);
+}
+
+}
+
+