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. When the QListWidgetItem exit editing which signal will be sent?
QtWS25 Last Chance

When the QListWidgetItem exit editing which signal will be sent?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 3.7k 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.
  • O Offline
    O Offline
    oiniya
    wrote on last edited by
    #1

    I make the Item in the QListWidget editable.

    @listWidget->item(i)->setFlags(listWidget->item(i)->flags () | Qt::ItemIsEditable);@

    and I want to close the listWidget when I stop editing the items.
    Which signal will be sent in that moment?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      the item delegate of your item view is responsible for the editor widget.
      So you can use it to get notified whenever the editor widget closes:
      @
      QAbstractItemDelegate* delegate = listWidget->itemDelegate();
      connect( delegate, SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)), this, SLOT(...) );
      @

      Or do you want to close the editor?
      This should also be already handled by the delegate on pressing ESC key (IIRC) and on focus out.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • O Offline
        O Offline
        oiniya
        wrote on last edited by
        #3

        [quote author="raven-worx" date="1384327903"]the item delegate of your item view is responsible for the editor widget.
        So you can use it to get notified whenever the editor widget closes:
        @
        QAbstractItemDelegate* delegate = listWidget->itemDelegate();
        connect( delegate, SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)), this, SLOT(...) );
        @

        Or do you want to close the editor?
        This should also be already handled by the delegate on pressing ESC key (IIRC) and on focus out.[/quote]

        Yes, I want to close the editor when focus out.
        If I select another cell in the QTableView the editor is cloesed.
        But when I click the blank area in the QTableView or I click other widgets in the QMainWindow the editor just lost the focus. It doesn't close.

        The SpinBox delegate works well it can be closed when focus out.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          are you using a custom delegate?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • O Offline
            O Offline
            oiniya
            wrote on last edited by
            #5

            [quote author="raven-worx" date="1384845442"]are you using a custom delegate?[/quote]
            Yes, I create two custom delegate: SpinBoxDelegate and ListWidgetDelegate.
            The ListWidgetDelegate's editor can't be closed when focus out.

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              and why don't you provide such important information beforehand?

              And which type of widget is your editor? Can it even have the focus and thus a focus out event?
              Did you reimplement the event filter in the delegate or do you just create the editor widget in there?

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • O Offline
                O Offline
                oiniya
                wrote on last edited by
                #7

                [quote author="raven-worx" date="1384847896"]and why don't you provide such important information beforehand?

                And which type of widget is your editor? Can it even have the focus and thus a focus out event?
                Did you reimplement the event filter in the delegate or do you just create the editor widget in there?[/quote]

                I'm so sorry, my English is poor. so I forgot to provide these information.
                OK, my question is :
                I create two delegates for the QTableView.
                SpinBoxDelegate's editor is QSpinbox,
                ListDelegate's editor is QListWidget.

                I set the editable flag for the QListWidget's items so I could change the value in the QListWidget editor.

                It works well. The only problem is that when the QListWidget editor is shown and I click the blank area in the QTableView or click other QWidgets in the QMainWindow , the QListwidget editor is still shown.
                it didn't close automatically.

                If I click other cell in the QTableView, this editor will close automatically.

                1 Reply Last reply
                0
                • raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  [quote author="raven-worx" date="1384847896"]
                  And which type of widget is your editor? Can it even have the focus and thus a focus out event?[/quote]

                  Edit: just post the code of the delegate that isn't working...

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  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