tools/chatgui: input bar with emoji panel, custom tab bar, Ctrl+Enter multiline, scroll fixes

This commit is contained in:
Evgeny committed 2026-06-23 00:17:07 +03:00
1 parent b667d6f352
commit e50ca9978e
11 files changed
+521 -23

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
#include "emojitabbar.h"
#include <QPainter>
#include <QStyleOptionTab>
EmojiTabBar::EmojiTabBar(QWidget *parent)
: QTabBar(parent)
{
setDrawBase(false);
setExpanding(false);
setUsesScrollButtons(false);
}
void EmojiTabBar::paintEvent(QPaintEvent *event) {
Q_UNUSED(event);
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
int w = width();
int h = height();
static const QColor bgColor(255, 255, 255);
static const QColor activeTextColor(0x33, 0x90, 0xEC);
static const QColor inactiveTextColor(0x8E, 0x8E, 0x93);
static const QColor activeBarColor(0x33, 0x90, 0xEC);
static const QColor separatorColor(0xE0, 0xE0, 0xE0);
p.fillRect(rect(), bgColor);
QFont f = font();
f.setPointSize(f.pointSize() - 1);
p.setFont(f);
int current = currentIndex();
for (int i = 0; i < count(); ++i) {
QRect r = tabRect(i);
if (!r.isValid()) continue;
bool active = (i == current);
p.setPen(active ? activeTextColor : inactiveTextColor);
p.drawText(r, Qt::AlignHCenter | Qt::AlignVCenter, tabText(i));
if (active) {
int barX = r.left() + 4;
int barW = r.width() - 8;
p.fillRect(QRect(barX, h - 3, barW, 3), activeBarColor);
}
}
p.fillRect(QRect(0, h - 1, w, 1), separatorColor);
}