Results 1 to 12 of 12

Thread: Multiple Widgets of same class, one single thread for computation - adressing problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Widgets of same class, one single thread for computation - adressing pro

    I found myself in that position a few months ago. Something like "QObject *sender" to be passed on the slots would save this problem...

    As far as I know, Qt does not have such things.

  2. #2
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Widgets of same class, one single thread for computation - adressing pro

    Quote Originally Posted by elcuco
    I found myself in that position a few months ago. Something like "QObject *sender" to be passed on the slots would save this problem...

    As far as I know, Qt does not have such things.
    It does. It's called QObject::sender(). Unfortunately, it would not help here as the OP's sender is always the same object.

    @burn2themax - Have you considered using a signal multiplexor?

    http://doc.trolltech.com/qq/qq08-act...ltiplexer.html

    You can use this to exclusively choose the widget you are intrested into to receive your signals. no other widgets will be notified.
    Last edited by Chicken Blood Machine; 6th July 2006 at 18:00.
    Save yourself some pain. Learn C++ before learning Qt.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Widgets of same class, one single thread for computation - adressing pro

    Quote Originally Posted by elcuco
    Something like "QObject *sender" to be passed on the slots would save this problem...

    As far as I know, Qt does not have such things.
    But of course it has: QObject::sender()

  4. The following user says thank you to jacek for this useful post:

    elcuco (6th July 2006)

  5. #4
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Multiple Widgets of same class, one single thread for computation - adressing problem

    what do you say... you learn something new each day.

  6. #5
    Join Date
    Jul 2006
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Widgets of same class, one single thread for computation - adressing pro

    @jacek
    I did a sample implementation with QEvent and... it works!! Thanks for this solution!

    @Chicken Blood Machine
    Thanks for the idea with the multiplexer! Seems to be an interesting concept for having multiple docs.
    But in my situation the receiver-widget changes permanently, so I had to call "setCurrentObject" on and on. This produces too much overhead.

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
  •  
Qt is a trademark of The Qt Company.