Add parent, minimum and maximum size to notifications

This commit is contained in:
Ilya Fedin 2020-05-14 22:38:44 +04:00 committed by John Preston
parent bdf28370f9
commit 3479a4ec59
2 changed files with 10 additions and 3 deletions

View file

@ -431,13 +431,17 @@ NotificationsCount::~NotificationsCount() {
NotificationsCount::SampleWidget::SampleWidget(
NotificationsCount *owner,
const QPixmap &cache)
: QWidget(nullptr)
: QWidget(App::wnd())
, _owner(owner)
, _cache(cache) {
resize(
const QSize size(
cache.width() / cache.devicePixelRatio(),
cache.height() / cache.devicePixelRatio());
resize(size);
setMinimumSize(size);
setMaximumSize(size);
setWindowFlags(Qt::WindowFlags(Qt::FramelessWindowHint)
| Qt::WindowStaysOnTopHint
| Qt::BypassWindowManagerHint

View file

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/call_delayed.h"
#include "facades.h"
#include "app.h"
#include "mainwindow.h"
#include "styles/style_dialogs.h"
#include "styles/style_layers.h"
#include "styles/style_window.h"
@ -374,7 +375,7 @@ Widget::Widget(
QPoint startPosition,
int shift,
Direction shiftDirection)
: TWidget(nullptr)
: TWidget(App::wnd())
, _manager(manager)
, _startPosition(startPosition)
, _direction(shiftDirection)
@ -488,6 +489,8 @@ void Widget::addToHeight(int add) {
void Widget::updateGeometry(int x, int y, int width, int height) {
setGeometry(x, y, width, height);
setMinimumSize(QSize(width, height));
setMaximumSize(QSize(width, height));
update();
}