modalutils: Various modal dialog utilities

Description Usage Arguments Details Author(s)

Description

These utilities provide simple wrappers for various built-in modal dialogs in Qt. Modal dialogs are used for one-time user input, such as getting a file name or choosing an item from a menu.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
qfile.choose(caption = "", dir = "", filter = "",
             allow.new = FALSE, parent = NULL)

qdir.choose(caption = "", dir = "", parent = NULL)

qgetColor(parent = NULL, title = "", alpha = 1)

qgetDouble(title = "Choose value",
           label = "Enter a numeric value",
           value = 0.0,
           minValue = -.Machine$double.xmax,
           maxValue = .Machine$double.xmax,
           decimals = 3L, parent = NULL)

qgetInteger(title = "Choose value", label = "Enter an integer value", value = 0L,
            minValue = -.Machine$integer.max,
            maxValue = .Machine$integer.max,
            step = 1L, parent = NULL)

qgetText(title = "Choose value", label = "Enter a text string",
         text = "",
         echomode = c("normal", "noecho", "password", "echoonedit"),
         parent = NULL)

qgetItem(title = "Choose value", label = "Choose a list item",
         items = "",
         current = 1L, editable = TRUE,
         parent = NULL)

Arguments

caption, title

Character string giving caption or window title.

dir

Character string giving the initial directory. The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected.

parent

An optional QWidget, specifying the parent of the dialog.

filter

Character string giving filter for file names. Only files that match the filter are shown. Multiple filters are separated with ';;'. For instance: "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"

allow.new

Logical flag, specifying whether a non-existent file may be selected.

alpha

An alpha-transparency factor (between 0 and 1) to be applied to the selected color.

label

Character string giving a label for the selection.

value, text

Initial value.

minValue

Minimum value allowed.

maxValue

Maximum value allowed.

decimals

The maximum number of decimals allowed.

step

The increment for qgetInteger.

echomode

Specifies how the user input should be displayed. Partial matching is allowed.

items

Character vector giving list of items to choose from.

current

The initial choice selected.

editable

Logical flag, specifying whether the list of items are immutable, or whether a new name may be specified.

Details

qfile.choose can be used to select a file name. It is a wrapper around either Qt$QFileDialog$getOpenFileName (if only an existing file's name may be selected) or Qt$QFileDialog$getSaveFileName. The function returns a character string giving the absolute path of the selected file, or NULL if the dialog is canceled.

qdir.choose is a similar wrapper for Qt$QFileDialog$getExistingDirectory that can be used to select a directory name.

qgetColor can be used to select a color. It is a wrapper for Qt$QColorDialog$getColor. The function returns a character string giving the color in "#RRGGBBAA" hexadecimal format, or NA if the dialog is canceled.

qgetInteger, qgetDouble, and qgetText can me used to obtain a double, integer, or character string respectively. qgetItem can be used to select an item from a list. They are wrappers for the corresponding static functions of Qt$QInputDialog. The return value on cancellation is the initial value for qgetInteger and qgetDouble, NULL for qgetText, and the initially selected element for qgetItem (which may be NULL is current is out of range).

Author(s)

Deepayan Sarkar


ggobi/qtutils documentation built on May 17, 2019, 3:15 a.m.