LensStudio:Ui.LineEdit
ClassWidget for single-line text input.
Index
Properties
- autoFillBackground
- backgroundRole
- className
- contextMenuPolicy
- cursorPosition
- devicePixelRatio
- enabled
- fontRole
- foregroundRole
- hasFocus
- height
- hidden
- icon
- isNull
- isTransparentForMouseEvents
- layout
- objectName
- onClose
- onEditingFinished
- onFocusIn
- onFocusOut
- onHide
- onKeyPress
- onMouseDoubleClick
- onMouseMove
- onMousePress
- onMouseRelease
- onResize
- onReturnPressed
- onShow
- onTextChange
- placeholderText
- readonly
- text
- toolTip
- visible
- width
- windowTitle
Methods
- actions
- activateWindow
- adjustSize
- blockSignals
- close
- deleteLater
- findChild
- getProperty
- getTypeName
- grab
- isOfType
- isSame
- mapToGlobal
- move
- raise
- resize
- setContentsMargins
- setCursor
- setCursorPixmap
- setFixedHeight
- setFixedWidth
- setFocus
- setMaximumHeight
- setMaximumWidth
- setMinimumHeight
- setMinimumWidth
- setProperty
- setSizePolicy
- setUndoable
- setUndoableRecursive
- show
- unsetCursor
Example
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
layout.spacing = 8;
root.layout = layout;
const output = new Label(root);
output.text = 'Type something below:';
output.fontRole = FontRole.Title;
layout.addWidget(output);
// Text input with placeholder
const input = new LineEdit(root);
input.placeholderText = 'Enter object name...';
layout.addWidget(input);
// Live text change feedback
this.connections.push(
input.onTextChange.connect((text: string) => {
output.text = text ? `Name: "${text}"` : 'Type something below:';
})
);
// Return key handler
this.connections.push(
input.onReturnPressed.connect(() => {
output.text = `Submitted: "${input.text}"`;
input.text = '';
})
);
Extends
Extended by
Constructors
Constructor
new LineEdit(
parent):LineEdit
Initialize a single-line text input widget.
Parameters
| Parameter | Type |
|---|---|
parent | Widget |
Returns
LineEdit
Overrides
Properties
autoFillBackground
autoFillBackground:
boolean
Whether the widget automatically fills its background before painting.
Inherited from
backgroundRole
backgroundRole:
ColorRole
The color role used for the widget's background.
Inherited from
className
readonlyclassName:string
Class name of the underlying widget type.
Inherited from
contextMenuPolicy
contextMenuPolicy:
ContextMenuPolicy
Controls how the widget handles context menu requests.
Inherited from
cursorPosition
cursorPosition:
number
The current position of the text cursor.
devicePixelRatio
readonlydevicePixelRatio:number
The ratio between physical and logical pixels for the widget's display.
Inherited from
enabled
enabled:
boolean
Whether the widget is interactive and accepts user input.
Inherited from
fontRole
fontRole:
FontRole
The font role applied to the widget's text rendering.
Inherited from
foregroundRole
foregroundRole:
ColorRole
The color role used for the widget's foreground elements.
Inherited from
hasFocus
readonlyhasFocus:boolean
True when the widget currently holds keyboard focus.
Inherited from
height
readonlyheight:number
Current height of the widget in pixels.
Inherited from
hidden
hidden:
boolean
Whether the widget is hidden from view.
Inherited from
icon
icon:
Icon
The icon displayed in the line edit.
isNull
readonlyisNull:boolean
True if the underlying native widget object has been destroyed.
Inherited from
isTransparentForMouseEvents
isTransparentForMouseEvents:
boolean
When true, mouse events pass through the widget to widgets below.
Inherited from
Widget.isTransparentForMouseEvents
layout
layout:
Layout
The layout manager assigned to arrange child widgets.
Inherited from
objectName
objectName:
string
Identifier by which the widget can be located via findChild.
Inherited from
onClose
readonlyonClose:signal1<CloseEvent,void>
Signal emitted when the widget is closed.
Inherited from
onEditingFinished
readonlyonEditingFinished:signal0<void>
Signal emitted when editing is finished.
onFocusIn
readonlyonFocusIn:signal0<void>
Emitted when the widget gains keyboard focus.
Inherited from
onFocusOut
readonlyonFocusOut:signal0<void>
Emitted when the widget loses keyboard focus.
Inherited from
onHide
readonlyonHide:signal0<void>
Signal emitted when the widget becomes hidden.
Inherited from
onKeyPress
readonlyonKeyPress:signal1<number,void>
Signal emitted when a key is pressed while the widget has focus.
Inherited from
onMouseDoubleClick
readonlyonMouseDoubleClick:signal1<MouseEvent,void>
Signal emitted when the user double-clicks on the widget.
Inherited from
AbstractButton.onMouseDoubleClick
onMouseMove
readonlyonMouseMove:signal1<MouseEvent,void>
Signal emitted when the mouse moves over the widget.
Inherited from
onMousePress
readonlyonMousePress:signal1<MouseEvent,void>
Signal emitted when a mouse button is pressed on the widget.
Inherited from
onMouseRelease
readonlyonMouseRelease:signal1<MouseEvent,void>
Signal emitted when a mouse button is released on the widget.
Inherited from
onResize
readonlyonResize:signal2<number,number,void>
Signal emitted when the widget is resized.
Inherited from
onReturnPressed
readonlyonReturnPressed:signal0<void>
Signal emitted when the return key is pressed.
onShow
readonlyonShow:signal0<void>
Signal emitted when the widget becomes visible.
Inherited from
onTextChange
readonlyonTextChange:signal1<string,void>
Signal emitted when the text changes.
placeholderText
placeholderText:
string
Placeholder text shown when the input is empty.
readonly
readonly:
boolean
Whether the line edit is read-only.
text
text:
string
The current text content.
toolTip
toolTip:
string
Text displayed in a tooltip when the user hovers over the widget.
Inherited from
visible
visible:
boolean
Whether the widget is currently visible.
Inherited from
width
readonlywidth:number
Current width of the widget in pixels.
Inherited from
windowTitle
windowTitle:
string
Title text displayed in the widget's title bar when shown as a window.
Inherited from
Methods
actions()
actions():
Action[]
Returns
Action[]
Inherited from
activateWindow()
activateWindow():
void
Brings the widget's top-level window to the foreground and gives it focus.
Returns
void
Inherited from
adjustSize()
adjustSize():
void
Resizes the widget to fit its contents based on the size hint.
Returns
void
Inherited from
blockSignals()
blockSignals(
blocked):void
Blocks or unblocks signal emission from the widget.
Parameters
| Parameter | Type |
|---|---|
blocked | boolean |
Returns
void
Inherited from
close()
close():
void
Closes the widget, hiding it and emitting the onClose signal.
Returns
void
Inherited from
deleteLater()
deleteLater():
void
Schedules the widget for deletion after the current event loop iteration.
Returns
void
Inherited from
findChild()
findChild(
objectName):Widget
Returns the descendant widget with the given object name, or null if none matches.
Parameters
| Parameter | Type |
|---|---|
objectName | string |
Returns
Inherited from
getProperty()
getProperty(
name):any
Returns the value of the dynamic property with the given name.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
any
Inherited from
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
grab()
grab():
Pixmap
Captures the widget's current rendered content as a Pixmap.
Returns
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
mapToGlobal()
mapToGlobal(
x,y):Point
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns
Inherited from
move()
move(
ax,ay):void
Moves the widget to the specified position.
Parameters
| Parameter | Type |
|---|---|
ax | number |
ay | number |
Returns
void
Inherited from
raise()
raise():
void
Raises the widget to the top of the parent widget's stack.
Returns
void
Inherited from
resize()
resize(
width,height):void
Resizes the widget to the specified width and height.
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void
Inherited from
setContentsMargins()
setContentsMargins(
left,top,right,bottom):void
Sets the margins around the widget's contents.
Parameters
| Parameter | Type |
|---|---|
left | number |
top | number |
right | number |
bottom | number |
Returns
void
Inherited from
setCursor()
setCursor(
shape):void
Sets the cursor shape displayed when the mouse is over the widget.
Parameters
| Parameter | Type |
|---|---|
shape | CursorShape |
Returns
void
Inherited from
setCursorPixmap()
setCursorPixmap(
pixmap):void
Sets a custom pixmap as the cursor when the mouse is over the widget.
Parameters
| Parameter | Type |
|---|---|
pixmap | Pixmap |
Returns
void
Inherited from
setFixedHeight()
setFixedHeight(
height):void
Locks the widget's height to the given value, preventing resizing.
Parameters
| Parameter | Type |
|---|---|
height | number |
Returns
void
Inherited from
setFixedWidth()
setFixedWidth(
width):void
Locks the widget's width to the given value, preventing resizing.
Parameters
| Parameter | Type |
|---|---|
width | number |
Returns
void
Inherited from
setFocus()
setFocus():
void
Gives keyboard input focus to the widget.
Returns
void
Inherited from
setMaximumHeight()
setMaximumHeight(
height):void
Sets the maximum height the widget can be resized to.
Parameters
| Parameter | Type |
|---|---|
height | number |
Returns
void
Inherited from
setMaximumWidth()
setMaximumWidth(
width):void
Sets the maximum width the widget can be resized to.
Parameters
| Parameter | Type |
|---|---|
width | number |
Returns
void
Inherited from
setMinimumHeight()
setMinimumHeight(
height):void
Sets the minimum height the widget must maintain.
Parameters
| Parameter | Type |
|---|---|
height | number |
Returns
void
Inherited from
setMinimumWidth()
setMinimumWidth(
width):void
Sets the minimum width the widget must maintain.
Parameters
| Parameter | Type |
|---|---|
width | number |
Returns
void
Inherited from
setProperty()
setProperty(
name,value):boolean
Sets the dynamic property with the given name to the given value.
Parameters
| Parameter | Type |
|---|---|
name | string |
value | any |
Returns
boolean
Inherited from
setSizePolicy()
setSizePolicy(
horizontal,vertical):void
Controls how the widget grows or shrinks relative to its layout.
Parameters
Returns
void
Inherited from
setUndoable()
setUndoable(
undoable):void
Marks property changes on this widget as undoable via the undo stack.
Parameters
| Parameter | Type |
|---|---|
undoable | boolean |
Returns
void
Inherited from
setUndoableRecursive()
setUndoableRecursive(
undoable):void
Marks property changes on this widget and all its children as undoable.
Parameters
| Parameter | Type |
|---|---|
undoable | boolean |
Returns
void
Inherited from
show()
show():
void
Makes the widget visible.
Returns
void
Inherited from
unsetCursor()
unsetCursor():
void
Resets the cursor to the parent widget's cursor.
Returns
void