Skip to content

Slint Rust : How does the "paste()" function works on LineEdit ? #4910

Answered by ogoffart
Frank-schaefer asked this question in Q&A
Discussion options

You must be logged in to vote

Basically you can call this function from a callback.

A basic example is this:

import { Button, VerticalBox, LineEdit, HorizontalBox } from "std-widgets.slint";
export component Demo {
    VerticalBox {
        alignment: start;
        HorizontalBox {
            alignment: center;
            Button {
                text: "Copy";
                clicked => {l.copy()}
            }
            Button {
                text: "Paste";
                clicked => {l.paste()}
            }
        }
        l := LineEdit {
            text: "Hello";
        }
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Frank-schaefer
Comment options

Answer selected by tronical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants