2017-09-25 09:02:55 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-09-25 09:02:55 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-09-25 09:02:55 +00:00
|
|
|
*/
|
|
|
|
#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) {
|
|
|
|
resize(
|
|
|
|
_point.x() + _icon->width(),
|
|
|
|
_point.y() + _icon->height());
|
|
|
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
2017-12-22 07:05:20 +00:00
|
|
|
parent->widthValue(
|
|
|
|
) | rpl::start_with_next(
|
|
|
|
[this] { moveToLeft(0, 0); },
|
|
|
|
lifetime());
|
2017-09-25 09:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FloatingIcon::paintEvent(QPaintEvent *e) {
|
2022-09-16 20:23:27 +00:00
|
|
|
auto p = QPainter(this);
|
2017-09-25 09:02:55 +00:00
|
|
|
_icon->paint(p, _point, width());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Profile
|
|
|
|
} // namespace Info
|