Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(notificationscrollarea): Add ability to delete widget from trace…
Browse files Browse the repository at this point in the history
…d widgets list
  • Loading branch information
Diadlo committed May 14, 2016
1 parent 75d64dc commit e3d7411
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
19 changes: 15 additions & 4 deletions src/widget/notificationscrollarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion src/widget/notificationscrollarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class NotificationScrollArea final : public AdjustingScrollArea

public slots:
void trackWidget(GenericChatroomWidget* widget);
void updateTracking();
void updateVisualTracking();
void updateTracking(GenericChatroomWidget *widget);

protected:
void resizeEvent(QResizeEvent *event) final override;
Expand Down

0 comments on commit e3d7411

Please sign in to comment.