Page Contents

Topics

Classes

QLToggleSwitch Class

#include <QLayers/qltoggleswitch.h>

Inherits: QLWidget

Public Functions

QLToggleSwitch(bool vertical = false, QWidget* parent = nullptr)
void set_toggled(bool toggled)
void setFixedHeight(int h)
void toggle(bool emit_toggled_event =true)
bool toggled() const

Protected Functions

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

Signals

void toggled_event(bool toggled)

Detailed Description

A QLToggleSwitch is a QLWidget that provides the user with a way to control an on/off state.

Member Function Documentation

QLToggleSwitch(bool vertical = false, QWidget* parent = nullptr)

Constructs a toggle switch.

The vertical parameter is used to determine the orientation of the switch. The switch is in horizontal orientation by default.

void set_toggled(bool toggled)

Sets the toggle state of the switch.

void setFixedHeight(int h)

Sets both the minimum and maximum heights of the widget to h without changing the widths.

void toggle(bool emit_toggled_event = true)

Toggles the switch.

The emit_toggled_event parameter is used to determine if the toggled_event() signal should be emitted. It is true by default.

bool toggled() const

Returns the toggle state of the switch.

void toggled_event(bool toggled)

Signal

This signal is emitted when the switch is toggled.