BibleTime
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CScrollButton Class Reference

#include <cscrollbutton.h>

Inheritance diagram for CScrollButton:

Signals

void change_requested (int count)
 Indicates a change the user made by moving the mouse. More...
 
void lock ()
 The lock() signal is emitted when the button grabs the mouse and enters the locked state. More...
 
void unlock ()
 The unlock() signal is emitted when the button releases the leaves the locked state. More...
 

Public Member Functions

 CScrollButton (QWidget *parent=nullptr)
 

Protected Member Functions

void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 Grabs the mouse on left button click and emits lock(). More...
 
void mouseReleaseEvent (QMouseEvent *e) override
 If the mouse is grabbed and we release the left mouse button, releases the mouse and emits unlock(). More...
 

Protected Attributes

bool m_isLocked
 Indicates whether the button is in locked state or not. More...
 
float m_movement
 The amount the mouse moved. More...
 

Detailed Description

This Class implements the direct chooser button used in the KeyChooser Widget.

Author
The BibleTime team.

Definition at line 28 of file cscrollbutton.h.

Constructor & Destructor Documentation

◆ CScrollButton()

CScrollButton::CScrollButton ( QWidget parent = nullptr)

Definition at line 22 of file cscrollbutton.cpp.

Member Function Documentation

◆ change_requested

void CScrollButton::change_requested ( int  count)
signal

Indicates a change the user made by moving the mouse.

Parameters
countthe number of items to be changed in the KeyChooser ComboBox.

Referenced by CScrollerWidgetSet::CScrollerWidgetSet(), and mouseMoveEvent().

◆ lock

void CScrollButton::lock ( )
signal

The lock() signal is emitted when the button grabs the mouse and enters the locked state.

Referenced by CScrollerWidgetSet::CScrollerWidgetSet(), and mousePressEvent().

◆ mouseMoveEvent()

void CScrollButton::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 45 of file cscrollbutton.cpp.

References change_requested(), m_isLocked, and m_movement.

◆ mousePressEvent()

void CScrollButton::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Grabs the mouse on left button click and emits lock().

Definition at line 28 of file cscrollbutton.cpp.

References lock(), and m_isLocked.

◆ mouseReleaseEvent()

void CScrollButton::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

If the mouse is grabbed and we release the left mouse button, releases the mouse and emits unlock().

Definition at line 36 of file cscrollbutton.cpp.

References m_isLocked, m_movement, and unlock().

◆ unlock

void CScrollButton::unlock ( )
signal

The unlock() signal is emitted when the button releases the leaves the locked state.

Referenced by CScrollerWidgetSet::CScrollerWidgetSet(), and mouseReleaseEvent().

Member Data Documentation

◆ m_isLocked

bool CScrollButton::m_isLocked
protected

Indicates whether the button is in locked state or not.

If the button is in the locked state, this means the mouse is grabbed and any mouse move events invoke calculation about whether to emit the change_requested() signal.

Definition at line 76 of file cscrollbutton.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

◆ m_movement

float CScrollButton::m_movement
protected

The amount the mouse moved.

This is saved so slow movements of mice can still be tracked and yet not emitting a change for every smallest movement of the mouse.

Definition at line 84 of file cscrollbutton.h.

Referenced by mouseMoveEvent(), and mouseReleaseEvent().


The documentation for this class was generated from the following files: