Added scrolling over tabs with wheel to switch channels.
This commit is contained in:
@@ -479,6 +479,20 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
Button::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void NotebookTab::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
float mouseMultiplier = getSettings()->mouseScrollMultiplier;
|
||||
wheelValue += event->delta() * mouseMultiplier;
|
||||
|
||||
if (wheelValue > WHEEL_STEP) {
|
||||
this->notebook_->selectNextTab();
|
||||
wheelValue = 0;
|
||||
} else if (wheelValue < -WHEEL_STEP) {
|
||||
this->notebook_->selectPreviousTab();
|
||||
wheelValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QRect NotebookTab::getXRect()
|
||||
{
|
||||
// if (!this->notebook->getAllowUserTabManagement()) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
#define NOTEBOOK_TAB_HEIGHT 28
|
||||
#define WHEEL_STEP 240
|
||||
|
||||
// class Notebook;
|
||||
class Notebook;
|
||||
@@ -61,6 +62,7 @@ protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
private:
|
||||
bool hasXButton();
|
||||
@@ -83,6 +85,8 @@ private:
|
||||
bool mouseOverX_ = false;
|
||||
bool mouseDownX_ = false;
|
||||
|
||||
float wheelValue = 0;
|
||||
|
||||
HighlightState highlightState_ = HighlightState::None;
|
||||
bool highlightEnabled_ = true;
|
||||
QAction *highlightNewMessagesAction_;
|
||||
|
||||
Reference in New Issue
Block a user