1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Respect configured emoticon size

This commit is contained in:
Mario Preksavec 2015-05-04 06:01:02 +02:00
parent 66cb02d1c3
commit ecee27b31d

View File

@ -17,6 +17,7 @@
#include "emoticonswidget.h" #include "emoticonswidget.h"
#include "src/misc/smileypack.h" #include "src/misc/smileypack.h"
#include "src/misc/style.h" #include "src/misc/style.h"
#include "src/misc/settings.h"
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
@ -52,6 +53,10 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
int row = 0; int row = 0;
int col = 0; int col = 0;
// respect configured emoticon size
const int px = Settings::getInstance().getEmojiFontPointSize();
const QSize size(px, px);
// create pages // create pages
buttonLayout->addStretch(); buttonLayout->addStretch();
for (int i = 0; i < pageCount; i++) for (int i = 0; i < pageCount; i++)
@ -81,11 +86,13 @@ EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
for (const QStringList& set : emoticons) for (const QStringList& set : emoticons)
{ {
QPushButton* button = new QPushButton; QPushButton* button = new QPushButton;
button->setIcon(SmileyPack::getInstance().getAsIcon(set[0]).pixmap(QSize(24,24))); button->setIcon(SmileyPack::getInstance().getAsIcon(set[0]).pixmap(size));
button->setToolTip(set.join(" ")); button->setToolTip(set.join(" "));
button->setProperty("sequence", set[0]); button->setProperty("sequence", set[0]);
button->setCursor(Qt::PointingHandCursor); button->setCursor(Qt::PointingHandCursor);
button->setFlat(true); button->setFlat(true);
button->setIconSize(size);
button->setFixedSize(size);
connect(button, &QPushButton::clicked, this, &EmoticonsWidget::onSmileyClicked); connect(button, &QPushButton::clicked, this, &EmoticonsWidget::onSmileyClicked);