Files
tdesktop/Telegram/SourceFiles/profile/profile_block_widget.cpp
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

46 lines
1.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "profile/profile_block_widget.h"
#include "ui/painter.h"
#include "styles/style_profile.h"
#include "styles/style_widgets.h"
namespace Profile {
BlockWidget::BlockWidget(
QWidget *parent,
PeerData *peer,
const QString &title) : RpWidget(parent)
, _peer(peer)
, _title(title) {
}
int BlockWidget::contentTop() const {
return emptyTitle() ? 0 : (st::profileBlockMarginTop + st::profileBlockTitleHeight);
}
void BlockWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
paintTitle(p);
paintContents(p);
}
void BlockWidget::paintTitle(Painter &p) {
if (emptyTitle()) return;
p.setFont(st::profileBlockTitleFont);
p.setPen(st::profileBlockTitleFg);
int titleLeft = st::profileBlockTitlePosition.x();
int titleTop = st::profileBlockMarginTop + st::profileBlockTitlePosition.y();
p.drawTextLeft(titleLeft, titleTop, width(), _title);
}
} // namespace Profile