CSShellCommand QML Type

Run shell commands. More...

Import Statement: import CSDataQuick.Components 1.0
Inherits:

BaseItem

Properties

Detailed Description

It is a menu button that usually has a graphic consisting of an “!” and a label. The model denote the commands that can be executed. If there is only one command specified in the menu, then the “!” and/or label appear in the middle of the button, and the command is activated immediately without bringing up a menu. If there is more than one item on the menu, the “!” and/or label are at the left of the button.

It is not activated until the button is released, so you can depress the button to check if there is more than one menu item or not, then abort by releasing the button away from the Shell Command.

If the command contains a “?”, then the rest of the command will be ignored, and a dialog box will prompt the user to complete (or otherwise edit) the command.

CSShellCommand {
    width: 150
    height: 25
    label: 'Shell Commands'
    model: ListModel {
        ListElement {label: 'ls'; command: 'ls'}
        ListElement {label: 'xterm'; command: 'xterm'}
        ListElement {label: 'run anything'; command: '?';}
    }
}

Property Documentation

font : font

The text font.


fontSizeMode : enumeration

This property specifies how the font size of the displayed text is determined.

See also fontSizeMode.


label : string

This property holds the text on the button.

The Label is the optional label that appears on the button. Normally, whether there is a label or not, there is a “!” symbol on the button to denote a Shell Command control. However, if the label text begins with "-" (for example "-My Label"), the “!” symbol will not appear.


model : var

The property holds the command list model.

The model can be ListModel or JSON object array. In any case, each element contains two properties:

  • label - the label on the menu item in the menu that is brought up when the Shell Command button is pressed.
  • command - the string in command will be executed as a system command when the menu item with that label is selected.

The GUI will block until the command is executed, so it is almost always wise to include an “&” at the end of the command so that it will execute in the background.

Note: Only in the form of JSON object array, it can be used in Qt Quick Designer