Page Contents

Topics

Classes

QLMainWindow Class

#include <QLayers/qlmainwindow.h>

Inherits: QLWidget

Public Functions

QLMainWindow(QWidget* parent = nullptr)
void open_central_widget(QWidget* central_widget)
void open_central_widget(QWidget* central_widget, const QLGraphic& tab_icon_graphic)
virtual void update() override

Protected Functions

virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override

Detailed Description

QLMainWindow Example

A QLMainWindow is a QLWidget that provides a main window interface for Layers applications.

The image above shows how the main window appears in the Layers Demo application.

Central Widgets

Central widgets are widgets that appear underneath the window's titlebar and take up a majority of the window's visible space. Multiple central widgets can be opened at a time, but only one visible, so there is a corresponding tab in the titlebar for each open central widget to give the user a way to switch between them.

To open a central widget, use the open_central_widget() function. For example:

open_central_widget(new LayersDemo,
    QLGraphic(":/images/layers.imgseq", QSize(35, 35)));

The example above shows how the LayersDemo central widget is set in the Layers Demo application.

Titlebar

The main window contains a titlebar with a QLTabBar for swapping between central widgets and QLButton widgets for window management.

There is a special titlebar button called the settings button, labeled with a gear icon, that opens a LSettingsMenu as a central widget.

Closing the Application

The user can close the application by clicking on the exit button in the window's titlebar, or by closing all of the central widget tabs.

Member Function Documentation

QLMainWindow(QWidget* parent = nullptr)

Constructs a main window.

void open_central_widget(QWidget* central_widget)

Opens central_widget and associates it with a tab in the window's titlebar.

void open_central_widget(QWidget* central_widget, const QLGraphic& tab_icon_graphic)

Opens central_widget and associates it with a tab in the window's titlebar.

The tab_icon_graphic is the graphic given to the tab's icon.

void update()

Virtual

Override

Updates the main window.

This function overrides QLThemeable::update() to adjust the window's layout according to the border thickness and margins.