Important: Please read the Qt Code of Conduct -

QML : If condition in delegate?

  • I'm designing a spinner list control, which displays 3 items at a time.

    Its working fine as required behaviour the only issue am facing is I need the central element appearance little bigger.

    The approach which I can think as of now is to have an if condition in the delegate, which on the basis of current index increases the font size.

    Is the above approach is possible? Any suggestions to achieve the particular behaviour

    Below is the code snippet
    @SpinnerData {
    id: spinner
    focus: true
    model: 20
    delegate: Text { font.pixelSize: spinner.height/4.5; text: index; height: spinner.height }

  • Moderators

    Yes it should work.

Log in to reply