GlobalDrawer QML Type

Import Statement: import org.kde.kirigami
Inherits:

OverlayDrawer

Properties

Methods

Detailed Description

A specialized form of the Drawer intended for showing an application's always-available global actions. Think of it like a mobile version of a desktop application's menubar.

Example usage:

import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
    globalDrawer: Kirigami.GlobalDrawer {
        actions: [
            Kirigami.Action {
                text: "View"
                icon.name: "view-list-icons"
                Kirigami.Action {
                    text: "action 1"
                }
                Kirigami.Action {
                    text: "action 2"
                }
                Kirigami.Action {
                    text: "action 3"
                }
            },
            Kirigami.Action {
                text: "Sync"
                icon.name: "folder-sync"
            }
        ]
    }
}

Property Documentation

actions : T.Action

This property holds the actions displayed in the drawer.

The list of actions can be nested having a tree structure. A tree depth bigger than 2 is discouraged.

Example usage:

import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
    globalDrawer: Kirigami.GlobalDrawer {
        actions: [
           Kirigami.Action {
               text: "View"
               icon.name: "view-list-icons"
               Kirigami.Action {
                   text: "action 1"
               }
               Kirigami.Action {
                   text: "action 2"
               }
               Kirigami.Action {
                   text: "action 3"
               }
           },
           Kirigami.Action {
               text: "Sync"
               icon.name: "folder-sync"
           }
        ]
    }
}

collapseButtonVisible : bool [since 2.12]

This property sets the visibility of the collapse button when the drawer collapsible.

default: true

This property was introduced in 2.12.


content : list<QtObject> [default]

This property holds items that are displayed under the actions.

Example usage:

import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
 [...]
    globalDrawer: Kirigami.GlobalDrawer {
        actions: [...]
        Button {
            text: "Button"
            onClicked: //do stuff
        }
    }
 [...]
}

currentSubMenu : T.Action [read-only]

This property points to the action acting as a submenu


This property holds an item that will always be displayed at the bottom of the drawer.

If the drawer contents can be scrolled, this item will stay still and won't scroll.

Note: This property is mainly intended for toolbars.


header : Item [since 2.12]

This property holds an item that will always be displayed at the top of the drawer.

If the drawer contents can be scrolled, this item will stay still and won't scroll.

Note: This property is mainly intended for toolbars.

This property was introduced in 2.12.


isMenu : bool [since 2.11]

This property sets whether the drawer becomes a menu on the desktop.

default: ``false``

This property was introduced in 2.11.


resetMenuOnTriggered : bool

This property sets whether activating a leaf action resets the menu to show leaf's parent actions.

A leaf action is an action without any child actions.

default: true


showContentWhenCollapsed : bool [since 2.5]

This property sets whether content items at the bottom should be shown. when the drawer is collapsed as a sidebar.

If you want to keep some items visible and some invisible, set this to false and control the visibility/opacity of individual items, binded to the collapsed property

default: false

This property was introduced in 2.5.

See also content.


showTopContentWhenCollapsed : bool [since 2.5]

This property sets whether content items at the top should be shown. when the drawer is collapsed as a sidebar.

If you want to keep some items visible and some invisible, set this to false and control the visibility/opacity of individual items, binded to the collapsed property

default: false

This property was introduced in 2.5.


title : string

This property holds the title displayed at the top of the drawer.


titleIcon : var

This property holds an icon to be displayed alongside the title.

See also Icon::source.


topContent : list<QtObject>

This property holds items that are displayed above the actions.

Example usage:

import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
 [...]
    globalDrawer: Kirigami.GlobalDrawer {
        actions: [...]
        topContent: [Button {
            text: "Button"
            onClicked: //do stuff
        }]
    }
 [...]
}

Method Documentation

ensureVisible(item, yOffset)

* @brief This method checks whether a particular drawer entry is in view, and scrolls * the drawer to center the item if it is not. * * Drawer items supplied through the actions property will handle this automatically, * but items supplied in topContent will need to call this explicitly on receiving focus * Otherwise, if the user passes focus to the item with e.g. keyboard navigation, it may * be outside the visible area. * * When called, this method will place the visible area such that the item at the * center if any part of it is currently outside. * * @code * QQC2.ItemDelegate { * id: item * // ... * onFocusChanged: if (focus) drawer.ensureVisible(item) * } * @endcode * * @param item The item that should be in the visible area of the drawer. Item coordinates need to be in the coordinate system of the drawer's flickable. * @param yOffset Offset to align the item's and the flickable's coordinate system (optional)


void resetMenu()

This function reverts the menu back to its initial state