Das KDevelop-Programmierhandbuch: Leitfaden zur C++-Anwendungsentwicklung für das K Desktop Environment (KDE) mit Hilfe der KDevelop-IDE in der Version 1.2
Zurück | Kapitel 6. The Dialogeditor: Where your Dialogs are Build | Vor

# 6.3. Properties of Qt supported Widgets

The following chapter gives a complete overview over the currently supported widgets of the Qt toolkit. To achieve a better understanding of the properties, these are separated to their inheritance. As all of them inherit `QWidget`, this class is described first. All `QWidget` properties are available for all other widgets as well, so these are not listed for them again. For widget groups that inherit an abstract subclass of `QWidget` as their base-class, the base-classes' properties are listed first (though this class does not provide a widget in the dialogeditor itself). Then the widget properties for the available widget of the group contains the properties that are specific to it. For a better understanding the inheritance tree of the available widgets is listed below:

- QWidget

  - QButton (abstract)

    - QCheckBox

    - QPushButton

    - QRadioButton

  - QComboBox

  - QFrame (abstract for now)

    - QGroupBox

    - QLCDNumber

    - QLabel

    - QProgressBar

    - QScrollView (abstract for now)

      - QListView

    - QSpinBox

    - QTableView (abstract)

      - QListBox

      - QMultiLineEdit

  - QLineEdit

  - QScrollBar

  - QSlider

## 6.3.1. QWidget Properties

`QWidget` is the base class for almost all widgets in Qt and KDE. Therefore widgets that inherit `QWidget` will allow to use the same settings in most cases.

- Appearance:

  - BgColor: Background color of the widget

  - BgMode: Background mode of the widget

  - BgPalColor: Color pallette for the background

  - BgPixmap: filename for a background pixmap

  - Cursor: Cursor over the widget

  - Font: Font for the widget

  - MaskBitmap: filename for a masking bitmap.

- C++ Code:

  - AcceptsDrops: if set to true, the widget item will accept drops by drag'n drop mechanisms (Qt drag'n drop protocol, not KDE 1.x !)

  - Connections: connects the item's signals to slots

  - FocusProxy: the item that gives its focus to this widget.

  - HasFocus: sets if the item has the focus by default. Mind that only one item per dialog can have this value as true

  - ResizeToParent: resizes the widget to its parent's size (not visible in editing mode)

  - VarName: Variable name of the item. Change this to names that describe the item's purpose.

- General:

  - IsEnabled: sets if the widget will accept user events

  - IsHidden: sets the item to be visible(false) or hidden(true)

  - Name: sets the name of the widget. Mind that the name is different from the VarName in C++ Code.

- Geometry:

  - Height: height of the item

  - IsFixedSize:

  - MaxHeight: maximum value for Height

  - MaxWidth: maximum value for Width

  - MinHeight: minimum value for Height

  - MinWidth: minimum value for Width

  - SizeIncX: pixel steps for resize actions to X direction

  - SizeIncY: pixel steps for resize actions to Y direction

  - Width: width of the item

  - X: position horizontal, counted from the left corner

  - Y: position vertical, counted up to down

## 6.3.2. QButton inherited widgets

`QButton` is an abstract widget class that provides properties common to buttons.

Inherits QWidget

Inherited by QCheckBox, QPushButton and QRadioButton inherit `QButton`.

- Appearance:

  - setPixmap: sets the pixmap filename to use

- General:

  - setText: the text on labels, buttons and boxes, also pre-set text for lineedits.

  - setAutoRepeat: if enabled, the clicked() signal is emitted at regular intervals while the button is down. No effect on toggle buttons.

  - setAutoResize: Enables auto-resizing if TRUE. When auto-resize is enabled, the button will resizes itself whenever the contents changes.

### 6.3.2.1. QCheckBox Properties

Inherits QWidget and QButton

- General:

  - isChecked: (setChecked) defines is the checkbox is set checked on construction

### 6.3.2.2. QPushButton Properties

Inherits QWidget and QButton

- General:

  - isAutoDefault: (setAutoDefault) the auto-default button becomes the default push button if it receives the keyboard input focus.

  - isDefault: (setDefault) there can be only one default button and it is only allowed to use in a dialog (see `QDialog`). The default button emits `clicked()` if the user presses the Enter key.

  - isMenuButton: (setIsMenuButton) tells the button to draw a menu indication triangle if enabled. The menu has to be inserted separately.

  - isToggleButton::(setToggleButton) makes a push button a toggle button, so the button has a similar state as check boxes.

  - isToggledOn: (setOn) (public slot) switches a toggle button on.

### 6.3.2.3. QRadioButton Properties

Inherits QWidget and QButton

- General:

  - isChecked: (setChecked) defines is the radio button is set checked on construction

## 6.3.3. QComboBox Properties

Inherits QWidget

( no additional properties for now)

## 6.3.4. QFrame inherited widgets

Inherits QWidget

For now only used as an abstract class.

- Appearance:

  - Margin (setMargin): sets the margin, which is the distance from the innermost pixel of the frame and the outermost pixel of the contents.

### 6.3.4.1. QGroupBox Properties

Inherits QWidget and QFrame

- General:

  - Title: (setTitle) sets the group box title that is displayed in the box frame.

### 6.3.4.2. QLCDNumber Properties

Inherits QWidget and QFrame

- General:

  - NumDigits:(setNumDigits) sets the number of digits displayed in QLCDNumber

  - Value: (display) (public slot) sets the initial value for QLCDNumber

### 6.3.4.3. QLabel Properties

Inherits QWidget and QFrame

- Appearance:

  - Margin (setMargin): sets the margin, which is for QLabel the distance from the frame to the first letter of the label text, depending on the alignment of the label.

- C++ Code:

  - Buddy: (setBuddy) sets the buddy widget of the label.

- General:

  - Text: (setText) sets the label text.

  - isAutoResize: (setAutoResize) if TRUE, the label will resize itself if the contents changes. The top left corner is not moved.

### 6.3.4.4. QProgressBar Properties

Inherits QWidget and QFrame

- General:

  - TotalSteps: (setTotalSteps) (public slot) sets the total steps of the progress bar. During the iteration of your action to display the progress, you have to call setProgress(int) to advance the progress step displayed to (int).

### 6.3.4.5. QScrollView

Inherits QWidget and QFrame

Inherited by QListBox (abstract for now)

Provides a scrollable widget that manages the display of a child widget by a vertical and horizontal scrollbar.

#### 6.3.4.5.1. QListView

Inherits QWidget, QFrame and QListView

Provides a list view to display hierarchical data either in a table or a tree. Manages itself by scrollbars through QScrollView.

- Appearance:

  - ListViewFont: (setFont()) Sets the font of the ListView items

  - ListViewPalette: (setPalette()) Sets the palette of the list view items

  - TreeStepSize: (setTreeStepSize(int)) Offset of pixels of a child item to its parent item

  - hScrollBarMode: Scrollbar mode provided by QScrollView for the horizontal scrollbar

  - isAllColumnsShowFocus: (setAllColumnsShowFocus(bool)) displays focus on all columns of an item.

  - isMultiSelection: enables multi-selection of list items

  - isRootDecorated: enables the + and - decoration to open and close trees

  - vScrollBarMode:Scrollbar mode provided by QScrollView for the vertical scrollbar

- General:

  - Entries: lets you insert a list of entries that are pre-set as QListViewItems.

  - isAutoUpdate:

### 6.3.4.6. QSpinBox Properties

Inherits QWidget and QFrame

- General:

  - MaxValue: the maximum value the user can choose

  - MinValue: the minimum value the user can choose

  - Prefix:

  - Suffix:

  - Value: the pre-set value when the widget is shown

  - isWrapping:

### 6.3.4.7. QTableView inherited widgets

Inherits QWidget, QFrame and QTableView

Inherited by QListBox and QMultiLineEdit

#### 6.3.4.7.1. QListBox Properties

Inherits QWidget, QFrame and QTableView

- General:

  - isAutoBottomScrollBar: (setAutoBottomScrollBar)

  - isAutoScroll: (setAutoScroll)

  - isAutoScrollBar: (setAutoScrollBar)

  - isAutoUpdate: (setAutoUpdate)

  - isBottomScrollBar: (setBottomScrollBar)

  - isDragSelect: (setDragSelect)

  - isSmoothScrolling: (setSmoothScrolling)

- Geometry:

  - setFixedVisibleLines: sets a fixed height for the widget so that the given number of text lines are displayed using the current font.

#### 6.3.4.7.2. QMultiLineEdit Properties

Inherits QWidget, QFrame and QTableView

- General:

  - Text: (setText) (public slot) sets the text of the widget.

  - isAutoUpdate: (setAutoUpdate) used to avoid flicker during large changes; the view is not updated if disabled.

  - isOverWriteMode: (setOverwriteMode) (public slot) sets overwrite enabled or disabled.

  - isReadOnly: (setReadOnly) (public slot) sets the widget text to read only; disables text input.

  - isTextSelected: (selectAll)(public slot) marks the whole text selected

- Geometry:

  - setFixedVisibleLines: sets a fixed height for the widget so that the given number of text lines are displayed using the current font.

## 6.3.5. QLineEdit Properties

Inherits QWidget

- General:

  - CursorPosition: (setCursorPosition) sets the default cursor position.

  - MaxLength: (setMaxLength) sets the maximum string length

  - Text: (setText) (public slot) sets the contents displayed on construction

  - hasFrame: (setFrame) draws the line edit within a two-pixel frame if enabled.

  - isTextSelected: (selectAll) (public slot) sets the text to be selected.

## 6.3.6. QScrollBar Properties

Inherits QWidget and `QRangeControl`.

- General:

  - MaxValue: sets the maximum slider value; used in constructor (optional)

  - MinValue: sets the minimum slider value; used in constructor (optional)

  - Orientation: (setOrientation) sets the orientation of the scrollbar to horizontal or vertical.

  - Value: sets the initial value of the scrollbar in the constructor (optional)

  - isTracking: (setTracking) if enabled, the scrollbar emits `valueChanged()` whenever the bar is dragged; otherwise only on mouse release.

## 6.3.7. QSlider Properties

Inherits QWidget and `QRangeControl`.

- General:

  - MaxValue: sets the maximum slider value; used in constructor (optional)

  - MinValue: sets the minimum slider value; used in constructor (optional)

  - Orientation: (setOrientation) sets the orientation of the slider to horizontal or vertical.

  - Value: (setValue) (public slot) uses `QRangeControl::setValue()` to set the value.

  - isTracking:(setTracking) if enabled, the slider emits `valueChanged()` whenever the slider is dragged; otherwise only on mouse release.

Zurück | Anfang | Vor
Qt and KDE Widgets | Hoch | Properties of KDE supported Widgets