Results 1 to 2 of 2

Thread: what would make more sense?

  1. #1
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default what would make more sense?

    a rather general question, i hope it isn't too unrelated..
    i have a class derived from QObject - i want to know when a dynamic property changes, so i added a signal
    Qt Code:
    1. void dynamicPropertyChanged ( QByteArray name );
    To copy to clipboard, switch view to plain text mode 
    that i emit whenever a dynamic property changed event is caught (mainly to inform client objects):
    Qt Code:
    1. bool polly::Element::event(QEvent *e)
    2. {
    3. if( e->type() == QEvent::DynamicPropertyChange )
    4. {
    5. e->accept();
    6. emit dynamicPropertyChanged( static_cast<QDynamicPropertyChangeEvent*>(e)->propertyName() );
    7. }
    8. return true;
    9. }
    To copy to clipboard, switch view to plain text mode 
    now, i have a class derived from the class that emits this signal, where i want to test the property to make sure its of the appropriate type/value.
    my question is: should i do it by:
    - overloading event in the derived class and respond there
    - create a slot that tests the new value and connect it to the signal
    ?

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: what would make more sense?

    You should test it not in one way, but in _every_ way that you think people would use your class.

    If your class is for your personal use, test it for the first use you have in mind and go from there.

Similar Threads

  1. Replies: 5
    Last Post: 24th May 2011, 11:36
  2. Replies: 1
    Last Post: 15th December 2010, 13:20
  3. Replies: 7
    Last Post: 13th November 2010, 07:58
  4. designer intelli-sense
    By mhoover in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2010, 13:25
  5. qsqldatabase does not sense db disconnect
    By rburge in forum Qt Programming
    Replies: 0
    Last Post: 9th March 2006, 18:59

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.