tools/chatgui: Qt5 GUI chat app stub with tray, channel list, message bubbles
This commit is contained in:
1 parent
6717c863e7
commit
b667d6f352
20 files changed
+1089
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#include "chatview.h"
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
|
||||
ChatView::ChatView(QWidget *parent)
|
||||
: QListView(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ChatView::setBackgroundImage(const QString &path) {
|
||||
if (!m_background.load(path)) {
|
||||
qWarning() << "ChatView: failed to load background" << path;
|
||||
return;
|
||||
}
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void ChatView::resizeEvent(QResizeEvent *event) {
|
||||
QListView::resizeEvent(event);
|
||||
scheduleDelayedItemsLayout();
|
||||
}
|
||||
|
||||
void ChatView::scrollContentsBy(int dx, int dy) {
|
||||
QListView::scrollContentsBy(dx, dy);
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void ChatView::paintEvent(QPaintEvent *event) {
|
||||
if (!m_background.isNull()) {
|
||||
QPainter p(viewport());
|
||||
p.drawTiledPixmap(viewport()->rect(), m_background);
|
||||
}
|
||||
QListView::paintEvent(event);
|
||||
}
|
||||
Reference in new issue
Block a user