qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
emoticonswidget.h
Go to the documentation of this file.
1 /*
2  Copyright © 2014-2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include <QMenu>
23 #include <QStackedWidget>
24 #include <QVBoxLayout>
25 #include <QVector>
26 
27 #include <memory>
28 
29 class QIcon;
30 
31 class EmoticonsWidget : public QMenu
32 {
33  Q_OBJECT
34 public:
35  explicit EmoticonsWidget(QWidget* parent = nullptr);
36 
37 signals:
38  void insertEmoticon(QString str);
39 
40 private slots:
41  void onSmileyClicked();
42  void onPageButtonClicked();
43  void PageButtonsUpdate();
44 
45 protected:
46  void mouseReleaseEvent(QMouseEvent* ev) final;
47  void mousePressEvent(QMouseEvent* ev) final;
48  void wheelEvent(QWheelEvent* event) final;
49  void keyPressEvent(QKeyEvent* e) final;
50 
51 private:
52  QStackedWidget stack;
53  QVBoxLayout layout;
55 
56 public:
57  QSize sizeHint() const override;
58 };
EmoticonsWidget::PageButtonsUpdate
void PageButtonsUpdate()
Definition: emoticonswidget.cpp:182
EmoticonsWidget::onPageButtonClicked
void onPageButtonClicked()
Definition: emoticonswidget.cpp:138
EmoticonsWidget
Definition: emoticonswidget.h:31
EmoticonsWidget::keyPressEvent
void keyPressEvent(QKeyEvent *e) final
Definition: emoticonswidget.cpp:193
EmoticonsWidget::EmoticonsWidget
EmoticonsWidget(QWidget *parent=nullptr)
Definition: emoticonswidget.cpp:34
EmoticonsWidget::layout
QVBoxLayout layout
Definition: emoticonswidget.h:53
EmoticonsWidget::wheelEvent
void wheelEvent(QWheelEvent *event) final
Definition: emoticonswidget.cpp:162
EmoticonsWidget::sizeHint
QSize sizeHint() const override
Definition: emoticonswidget.cpp:147
QList
Definition: friendlist.h:25
EmoticonsWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *ev) final
Definition: emoticonswidget.cpp:152
EmoticonsWidget::stack
QStackedWidget stack
Definition: emoticonswidget.h:52
EmoticonsWidget::onSmileyClicked
void onSmileyClicked()
Definition: emoticonswidget.cpp:127
EmoticonsWidget::emoticonsIcons
QList< std::shared_ptr< QIcon > > emoticonsIcons
Definition: emoticonswidget.h:54
EmoticonsWidget::mousePressEvent
void mousePressEvent(QMouseEvent *ev) final
Definition: emoticonswidget.cpp:158
EmoticonsWidget::insertEmoticon
void insertEmoticon(QString str)