8 #include <QButtonGroup>
14 setFixedSize(260, 175);
15 setAttribute(Qt::WA_DeleteOnClose);
16 setStyleSheet(
"background:white");
18 QVBoxLayout *layout =
new QVBoxLayout(
this);
19 layout->setSpacing(0);
20 QToolButton *closeButton =
new QToolButton(
this);
21 closeButton->setFixedSize(16, 16);
23 closeButton->setCursor(QCursor(Qt::PointingHandCursor));
24 connect(closeButton, SIGNAL(clicked()),
this, SLOT(close()));
26 QWidget *labelWidget =
new QWidget(
this);
27 labelWidget->setFixedHeight(110);
29 QGridLayout *labelIconLayout =
new QGridLayout(labelWidget);
30 labelIconLayout->setContentsMargins(0, 0, 0, 0);
31 labelIconLayout->setSpacing(3);
34 connect(clickedGroup, SIGNAL(clicked(
int)), SLOT(
labelClicked(
int)));
36 for(
int i = 0; i < 3; ++i)
38 for(
int j = 0; j < 7; ++j)
41 label->setAlignment(Qt::AlignCenter);
43 label->setFixedSize(32, 32);
44 labelIconLayout->addWidget(label, i, j);
47 clickedGroup->
mapped(label);
50 labelWidget->setLayout(labelIconLayout);
52 QWidget *buttonWidget =
new QWidget(
this);
53 QHBoxLayout *buttonWidgetLayout =
new QHBoxLayout(buttonWidget);
54 buttonWidgetLayout->setContentsMargins(0, 0, 5, 0);
55 buttonWidgetLayout->addStretch(1);
57 QButtonGroup *buttonGroup =
new QButtonGroup(buttonWidget);
60 for(
int i = 0; i < 5; ++i)
62 QToolButton *button =
new QToolButton(buttonWidget);
63 button->setCursor(Qt::PointingHandCursor);
64 button->setText(QString::number(i + 1));
65 button->setFixedSize(15, 15);
66 buttonWidgetLayout->addWidget(button, 0 , Qt::AlignRight);
67 buttonWidget->setLayout(buttonWidgetLayout);
68 buttonGroup->addButton(button, i);
73 layout->addWidget(closeButton, 0, Qt::AlignRight | Qt::AlignVCenter);
74 layout->addWidget(labelWidget);
75 layout->addWidget(buttonWidget);
78 QFile file(
":/emoji/db");
79 if(file.open(QIODevice::ReadOnly))
101 for(
int i = 0; i < 3; ++i)
103 for(
int j = 0; j < 7; ++j)
105 const int in = i * 7 + j;
106 m_labelItems[in]->setPixmap(QPixmap(QString(
":/emoji/%1").arg(21 * index + in + 1)));
124 QLabel::leaveEvent(event);
static const QString BorderStyle01
border
The class of the label widget that can click.
static const QString BorderStyle04
void mapped(QWidget *widget)
static const QString BackgroundStyle01
Background.
TTK_MODULE_EXPORT QStringList split(const QString &value, const QString &key=TTK_DEFAULT_STR)
#define QtButtonGroupConnect(p, q, f, s)
Button group connect.
static const QString BorderStyle03
static constexpr const char * TinyBtnClose
The class of the label widget click group mapper.