Results 1 to 4 of 4

Thread: Counting the QListWidget Items by a QLineEdit each Drag&Drop event.

  1. #1
    Join Date
    May 2019
    Posts
    6
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Counting the QListWidget Items by a QLineEdit each Drag&Drop event.

    Hello Qt devs, I'm pretty new to qt and I would like to ask for a simple problem:
    _ I have a MainWindow with:
    + An initial widget for storing initial items.
    + 10 list widgets for storing dropped items.
    + A line edit inside a for showing a "count" variable which count how many items in there.
    What I want to do is after dropping a item in these 10 widgets, the "count" number plus one, and dragging an item outside the list widgets the "count" minus one. I tried eventFilter but after installingEventFilter to a widget, the dropped item dissappears. I have stuck at this for many hours so hopefully someone could give me a solution.
    Last edited by comvis; 11th May 2019 at 19:03.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Counting the QListWidget Items by a QLineEdit each Drag&Drop event.

    You don't need any event filter for that.

    Each list widget has a model for its data and each model has signals for when it adds or removes items.

    Simply connect to these and update the count.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    comvis (12th May 2019)

  4. #3
    Join Date
    May 2019
    Posts
    6
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Counting the QListWidget Items by a QLineEdit each Drag&Drop event.

    Can you tell me what is this Signal, is this viewportEntered or Entered. Thanks for your reply.

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Counting the QListWidget Items by a QLineEdit each Drag&Drop event.


  6. The following user says thank you to anda_skoa for this useful post:

    comvis (12th May 2019)

Similar Threads

  1. Replies: 5
    Last Post: 7th July 2015, 19:38
  2. Replies: 2
    Last Post: 30th January 2014, 07:46
  3. Replies: 2
    Last Post: 23rd January 2014, 09:43
  4. Drag and Drop items in QListWidget
    By tommynator128 in forum Qt Programming
    Replies: 4
    Last Post: 10th March 2011, 12:09
  5. Replies: 3
    Last Post: 10th June 2010, 16:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.