EditableLabel

Label that becomes editable on double-click, with an inline pencil affordance painted after the text.

Inherits QLabel
Group widgets

Declared in src/libs/libwidgets/components/EditableLabel.hpp.

Detailed description

The pencil icon is rendered directly in paintEvent, immediately to the right of the text run (with an 8 px gap). This avoids the flicker / placement bugs of the previous QLabel-child approach, where the icon either ended up under the text on first paint or got stranded at the right edge after typing.

A QLineEdit child overlays the label during edit mode. As the user types, the label's minimumWidth grows so the surrounding layout gives us extra space and the line edit can paint past the original label width.

EditableLabel
EditableLabel

See also QLabel, QLineEdit.

Member function documentation

setEditOnDoubleClick

void EditableLabel::setEditOnDoubleClick(bool on)

Make a double click start the editor when on is true.

True is the default. When on is false, the label ignores a double click, and Qt passes the event on to the parent: a card that holds the label then gets the double click on its name too. startEditing() opens the editor in both cases, so a "Rename" action of a context menu still works.

In this section