mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(notificationscrollarea): Add ability to delete widget from traced widgets list
This commit is contained in:
parent
75d64dc68d
commit
e3d74117ca
@ -25,8 +25,8 @@
|
|||||||
NotificationScrollArea::NotificationScrollArea(QWidget* parent)
|
NotificationScrollArea::NotificationScrollArea(QWidget* parent)
|
||||||
: AdjustingScrollArea(parent)
|
: AdjustingScrollArea(parent)
|
||||||
{
|
{
|
||||||
connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateTracking);
|
connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateVisualTracking);
|
||||||
connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateTracking);
|
connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateVisualTracking);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget)
|
void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget)
|
||||||
@ -66,12 +66,23 @@ void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationScrollArea::updateTracking()
|
/**
|
||||||
|
* @brief Delete notification bar to visible elements on scroll area
|
||||||
|
*/
|
||||||
|
void NotificationScrollArea::updateVisualTracking() {
|
||||||
|
updateTracking(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Delete notification bar from visible elements and widget on scroll area
|
||||||
|
* @param widget Chatroom widget to remove from tracked widgets
|
||||||
|
*/
|
||||||
|
void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget)
|
||||||
{
|
{
|
||||||
QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
|
QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
|
||||||
while (i != trackedWidgets.end())
|
while (i != trackedWidgets.end())
|
||||||
{
|
{
|
||||||
if (widgetVisible(i.key()) == Visible)
|
if (i.key() == widget || widgetVisible(i.key()) == Visible)
|
||||||
{
|
{
|
||||||
if (i.value() == Above)
|
if (i.value() == Above)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void trackWidget(GenericChatroomWidget* widget);
|
void trackWidget(GenericChatroomWidget* widget);
|
||||||
void updateTracking();
|
void updateVisualTracking();
|
||||||
|
void updateTracking(GenericChatroomWidget *widget);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) final override;
|
void resizeEvent(QResizeEvent *event) final override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user