added highlights to the scrollbar

This commit is contained in:
fourtf
2018-01-06 03:48:56 +01:00
parent 99f2d0dd27
commit 20eab57db5
10 changed files with 159 additions and 134 deletions
+9 -10
View File
@@ -1,5 +1,6 @@
#pragma once
#include "messages/limitedqueue.hpp"
#include "singletons/settingsmanager.hpp"
#include "widgets/basewidget.hpp"
#include "widgets/helper/scrollbarhighlight.hpp"
@@ -15,21 +16,18 @@ namespace widgets {
class ChannelView;
class ScrollBar : public BaseWidget
class Scrollbar : public BaseWidget
{
Q_OBJECT
public:
ScrollBar(ChannelView *parent = 0);
~ScrollBar();
Scrollbar(ChannelView *parent = 0);
void removeHighlightsWhere(std::function<bool(ScrollBarHighlight &)> func);
void addHighlight(ScrollBarHighlight *highlight);
Q_PROPERTY(qreal desiredValue READ getDesiredValue WRITE setDesiredValue)
void addHighlight(ScrollbarHighlight highlight);
void addHighlightsAtStart(const std::vector<ScrollbarHighlight> &highlights);
void replaceHighlight(size_t index, ScrollbarHighlight replacement);
void scrollToBottom(bool animate = false);
bool isAtBottom() const;
void setMaximum(qreal value);
@@ -50,6 +48,8 @@ public:
void printCurrentState(const QString &prefix = QString()) const;
Q_PROPERTY(qreal desiredValue READ getDesiredValue WRITE setDesiredValue)
protected:
void paintEvent(QPaintEvent *) override;
void resizeEvent(QResizeEvent *) override;
@@ -65,7 +65,7 @@ private:
QPropertyAnimation currentValueAnimation;
ScrollBarHighlight *highlights;
messages::LimitedQueue<ScrollbarHighlight> highlights;
bool atBottom = false;
@@ -73,7 +73,6 @@ private:
int mouseDownIndex = -1;
QPoint lastMousePosition;
// int buttonHeight = 16;
int buttonHeight = 0;
int trackHeight = 100;