1
0
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:
Diadlo 2016-05-04 02:22:12 +03:00
parent 75d64dc68d
commit e3d74117ca
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 17 additions and 5 deletions

View File

@ -25,8 +25,8 @@
NotificationScrollArea::NotificationScrollArea(QWidget* parent)
: AdjustingScrollArea(parent)
{
connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateTracking);
connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateTracking);
connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateVisualTracking);
connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateVisualTracking);
}
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();
while (i != trackedWidgets.end())
{
if (widgetVisible(i.key()) == Visible)
if (i.key() == widget || widgetVisible(i.key()) == Visible)
{
if (i.value() == Above)
{

View File

@ -33,7 +33,8 @@ public:
public slots:
void trackWidget(GenericChatroomWidget* widget);
void updateTracking();
void updateVisualTracking();
void updateTracking(GenericChatroomWidget *widget);
protected:
void resizeEvent(QResizeEvent *event) final override;