Page Contents

Topics

Classes

QLButton Class

#include <QLayers/qlbutton.h>

Inherits: QLWidget

Public Functions

QLButton(const QLGraphic& graphic, const QString& text, QWidget* parent = nullptr)
QLButton(const QLGraphic& graphic, QWidget* parent = nullptr)
QLButton(const QString& text, QWidget* parent = nullptr)
QLButton(const QLGraphic& graphic, const QLGraphic& graphic_after, QWidget* parent = nullptr)
bool disabled() const
QLLabel* graphic_label() const
void set_disabled(bool cond = true)
void set_font_size(int size)
void set_font_size_f(qreal size)
void set_padding(int padding)
void set_padding(int left, int top, int right, int bottom)
void toggle_graphics()

Protected Functions

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

Signals

void clicked()

Detailed Description

A QLButton is a QLWidget that gives the user a labeled clickable interface to perform certain actions.

Member Function Documentation

QLButton(const QLGraphic& graphic, const QString& text, QWidget* parent = nullptr)

Constructs a button with a graphic and text.

QLButton(const QLGraphic& graphic, QWidget* parent = nullptr)

Constructs a button with a graphic.

By default, the button's fill is disabled.

QLButton(const QString& text, QWidget* parent = nullptr)

Constructs a button with text.

QLButton(const QLGraphic& graphic, const QLGraphic& graphic_after, QWidget* parent = nullptr)

Constructs a button with two graphics. The graphic that is displayed depends on whether the button is set to an enabled state or not.

By default, the button's fill is disabled.

void clicked()

Signal

This signal is emitted when the user clicks on the button.

bool disabled() const

Returns true if the button is disabled. Otherwise, returns false.

QLLabel* graphic_label() const

Returns a pointer to the button's graphic label. If the button does not have a graphic label, then nullptr is returned.

void set_disabled(bool cond = true)

Disables or enables the button depending on cond.

void set_font_size(int size)

Sets the font size of the button's text.

void set_font_size_f(qreal size)

Sets the font size of the button's text.

void set_padding(int padding)

Sets the button padding with a single value.

void set_padding(int left, int top, int right, int bottom)

Sets the button padding with individual values.

void toggle_graphics()

Toggles the visibility of the graphic labels.

This function only works if the button was initialized with two graphics.