Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardSizeWidget Class Reference

A widget for adjusting card sizes using a slider. More...

#include <card_size_widget.h>

Inheritance diagram for CardSizeWidget:
[legend]
Collaboration diagram for CardSizeWidget:
[legend]

Signals

void cardSizeSettingUpdated (int newValue)

Public Member Functions

 CardSizeWidget (QWidget *parent, FlowWidget *flowWidget=nullptr, int defaultValue=100)
QSlider * getSlider () const
 Gets the slider widget used for adjusting the card size.
void enableCtrlScrollResize (QWidget *host)
 Resizes the cards when the user Ctrl + scrolls over host or any of its descendants.

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) override

Private Slots

void updateCardSizeSetting (int newValue)
 Updates the card size setting in the application's cache.

Private Member Functions

bool adjustSliderForWheel (QWheelEvent *event)

Private Attributes

QWidget * parent
FlowWidget * flowWidget
QHBoxLayout * cardSizeLayout
QLabel * cardSizeLabel
QSlider * cardSizeSlider
QTimer debounceTimer
int pendingValue

Static Private Attributes

static constexpr int CARD_SIZE_WHEEL_STEP = 10
 Slider step applied per Ctrl + scroll notch.

Detailed Description

A widget for adjusting card sizes using a slider.

This widget allows users to dynamically change the card size in a linked FlowWidget and updates the application's settings accordingly.

Constructor & Destructor Documentation

◆ CardSizeWidget()

CardSizeWidget::CardSizeWidget ( QWidget * parent,
FlowWidget * flowWidget = nullptr,
int defaultValue = 100 )
explicit

< Slider range for card size adjustment.

< Initial slider value.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ adjustSliderForWheel()

bool CardSizeWidget::adjustSliderForWheel ( QWheelEvent * event)
private
Here is the caller graph for this function:

◆ cardSizeSettingUpdated

void CardSizeWidget::cardSizeSettingUpdated ( int newValue)
signal

Emitted when the slider value changes, but on a debounce timer. Any parents that care about saving the value to settings should use this signal to indicate when to save the new value to settings.

Here is the caller graph for this function:

◆ enableCtrlScrollResize()

void CardSizeWidget::enableCtrlScrollResize ( QWidget * host)

Resizes the cards when the user Ctrl + scrolls over host or any of its descendants.

Installs this widget as an event filter on the given host widget. If the host contains a scroll area the filter is also installed on the scroll area's content widget, so the resize intercepts the wheel event before the scroll area would scroll the view.

Here is the caller graph for this function:

◆ eventFilter()

bool CardSizeWidget::eventFilter ( QObject * watched,
QEvent * event )
overrideprotected
Here is the call graph for this function:

◆ getSlider()

QSlider * CardSizeWidget::getSlider ( ) const
nodiscard

Gets the slider widget used for adjusting the card size.

Returns
A pointer to the QSlider object.
Here is the caller graph for this function:

◆ updateCardSizeSetting

void CardSizeWidget::updateCardSizeSetting ( int newValue)
privateslot

Updates the card size setting in the application's cache.

Parameters
newValueThe new card size value set by the slider.
Here is the caller graph for this function:

Member Data Documentation

◆ CARD_SIZE_WHEEL_STEP

int CardSizeWidget::CARD_SIZE_WHEEL_STEP = 10
staticconstexprprivate

Slider step applied per Ctrl + scroll notch.

◆ cardSizeLabel

QLabel* CardSizeWidget::cardSizeLabel
private

◆ cardSizeLayout

QHBoxLayout* CardSizeWidget::cardSizeLayout
private

◆ cardSizeSlider

QSlider* CardSizeWidget::cardSizeSlider
private

◆ debounceTimer

QTimer CardSizeWidget::debounceTimer
private

◆ flowWidget

FlowWidget* CardSizeWidget::flowWidget
private

◆ parent

QWidget* CardSizeWidget::parent
private

◆ pendingValue

int CardSizeWidget::pendingValue
private

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