Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use the code to set item's state activated ?

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • joeQJ Offline
    joeQJ Offline
    joeQ
    wrote on last edited by
    #1

    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?

    Just do it!

    jsulmJ 1 Reply Last reply
    0
    • joeQJ joeQ

      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?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @joeQ http://doc.qt.io/qt-5/qlistwidget.html#setCurrentItem

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      joeQJ 1 Reply Last reply
      0
      • jsulmJ jsulm

        @joeQ http://doc.qt.io/qt-5/qlistwidget.html#setCurrentItem

        Sets the current item to item.
        
        Unless the selection mode is NoSelection, the item is also selected.
        
        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by
        #3

        @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...

        Just do it!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          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 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved