Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
FlowWidget Class Reference

#include <flow_widget.h>

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

Public Slots

void setMinimumSizeToMaxSizeHint ()
 Sets every child widget's minimum size to the largest sizeHint in the layout.
void setSpacing (int hSpacing, int vSpacing)

Public Member Functions

 FlowWidget (QWidget *parent, Qt::Orientation orientation, Qt::ScrollBarPolicy horizontalPolicy, Qt::ScrollBarPolicy verticalPolicy)
 Constructs a FlowWidget.
void addWidget (QWidget *widget_to_add) const
 Adds a widget to the flow layout within the FlowWidget.
void insertWidgetAtIndex (QWidget *toInsert, int index)
void removeWidget (QWidget *widgetToRemove) const
void clearLayout ()
 Removes all widgets from the flow layout and deletes them.
int count () const
QLayoutItem * itemAt (int index) const

Public Attributes

QScrollArea * scrollArea
 Null when both scroll policies are AlwaysOff.

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 Marks the flow layout as dirty so Qt recomputes item positions.

Private Attributes

Qt::Orientation flowDirection
QHBoxLayout * mainLayout
FlowLayoutflowLayout
QWidget * container

Constructor & Destructor Documentation

◆ FlowWidget()

FlowWidget::FlowWidget ( QWidget * parent,
Qt::Orientation orientation,
Qt::ScrollBarPolicy horizontalPolicy,
Qt::ScrollBarPolicy verticalPolicy )

Constructs a FlowWidget.

When both scroll policies are Qt::ScrollBarAlwaysOff the scroll area is omitted entirely and the container is placed directly in the main layout.

Parameters
parentParent widget.
_flowDirectionQt::Horizontal for row-wrapping, Qt::Vertical for column-wrapping.
horizontalPolicyHorizontal scroll-bar policy.
verticalPolicyVertical scroll-bar policy.
Here is the caller graph for this function:

Member Function Documentation

◆ addWidget()

void FlowWidget::addWidget ( QWidget * widget_to_add) const

Adds a widget to the flow layout within the FlowWidget.

Parameters
widget_to_addThe widget to add to the flow layout.
Here is the caller graph for this function:

◆ clearLayout()

void FlowWidget::clearLayout ( )

Removes all widgets from the flow layout and deletes them.

If the layout pointer has somehow been lost it is recreated before returning.

◆ count()

int FlowWidget::count ( ) const
nodiscard

◆ insertWidgetAtIndex()

void FlowWidget::insertWidgetAtIndex ( QWidget * toInsert,
int index )

◆ itemAt()

QLayoutItem * FlowWidget::itemAt ( int index) const
nodiscard

◆ removeWidget()

void FlowWidget::removeWidget ( QWidget * widgetToRemove) const
Here is the caller graph for this function:

◆ resizeEvent()

void FlowWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

Marks the flow layout as dirty so Qt recomputes item positions.

We do NOT call adjustSize() or activate() here:

  • adjustSize() would freeze geometry by calling setFixedSize internally.
  • activate() called inside a resize event can cause synchronous re-entrancy. Qt automatically calls setGeometry on the layout after a resize, so simply invalidating is sufficient.

◆ setMinimumSizeToMaxSizeHint

void FlowWidget::setMinimumSizeToMaxSizeHint ( )
slot

Sets every child widget's minimum size to the largest sizeHint in the layout.

Useful for toolbars or button bars where all items should be the same size.

Here is the caller graph for this function:

◆ setSpacing

void FlowWidget::setSpacing ( int hSpacing,
int vSpacing )
slot

Member Data Documentation

◆ container

QWidget* FlowWidget::container
private

◆ flowDirection

Qt::Orientation FlowWidget::flowDirection
private

◆ flowLayout

FlowLayout* FlowWidget::flowLayout
private

◆ mainLayout

QHBoxLayout* FlowWidget::mainLayout
private

◆ scrollArea

QScrollArea* FlowWidget::scrollArea

Null when both scroll policies are AlwaysOff.


The documentation for this class was generated from the following files:
  • cockatrice/src/interface/widgets/general/layout_containers/flow_widget.h
  • cockatrice/src/interface/widgets/general/layout_containers/flow_widget.cpp