mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-22 18:27:17 +00:00
41 lines
938 B
C++
41 lines
938 B
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 "info/profile/info_profile_icon.h"
|
|
|
|
namespace Info {
|
|
namespace Profile {
|
|
|
|
FloatingIcon::FloatingIcon(
|
|
RpWidget *parent,
|
|
const style::icon &icon,
|
|
QPoint position)
|
|
: FloatingIcon(parent, icon, position, Tag{}) {
|
|
}
|
|
|
|
FloatingIcon::FloatingIcon(
|
|
RpWidget *parent,
|
|
const style::icon &icon,
|
|
QPoint position,
|
|
const Tag &)
|
|
: RpWidget(parent)
|
|
, _icon(&icon)
|
|
, _point(position) {
|
|
setGeometry(QRect(
|
|
QPoint(0, 0),
|
|
QSize(_point.x() + _icon->width(), _point.y() + _icon->height())));
|
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
}
|
|
|
|
void FloatingIcon::paintEvent(QPaintEvent *e) {
|
|
auto p = QPainter(this);
|
|
_icon->paint(p, _point, width());
|
|
}
|
|
|
|
} // namespace Profile
|
|
} // namespace Info
|