Important: Please read the Qt Code of Conduct -

How to use the code to set item's state activated ?

  • Hi, Thanks and regards advance!

    When i use the QListWidget, i saw the document and found the following

    QListWidgetItem class
    [signal] void QListWidget::itemActivated(QListWidgetItem *item)
    This signal is emitted when the item is activated. The item is activated when the user clicks or double clicks on it, depending on the system configuration. It is also activated when the user presses the activation key (on Windows and X11 this is the Return key, on Mac OS X it is Command+O).

    It says the user can make item to activated by clicks or double clicks ...
    Now, I want to use the code to set one item activated. but, I found nothing, there isn't one set_function to set it. like the following function

    void QListWidget::setCurrentItem(...)
    void QListWidget::setCurrentRow(...)

    How to use code to set item activated ? and what's state of item is Activated?

  • Lifetime Qt Champion


    Sets the current item to item.
    Unless the selection mode is NoSelection, the item is also selected.

  • @jsulm
    Thanks, But it is wrong way! I tried. setCurrentItem isn't emitted the itemActivated signal. I want to use the code to set item activated and then emit the itemActivated signal.

    And i want to know, is there another way to emit the itemActivated signal but users clicks or double clicks...

  • Lifetime Qt Champion


    Like you already saw, the conditions for itemActivated to be generate are explained in the signal's documentation.

    Are you trying to trigger the edition of that item ?

Log in to reply