Results 1 to 7 of 7

Thread: 'QMessageBox::critical' : none of the 4 overloads could convert all the argument type

Hybrid View

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

    Default Re: 'QMessageBox::critical' : none of the 4 overloads could convert all the argument

    This looks reasonable.

    You can do the connect in main()
    Qt Code:
    1. QObject::connect( &mThread, SIGNAL(alertSignal(QString)), &w, SLOT(alertSlot(QString)), Qt::QueuedConnection);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 284 Times in 279 Posts

    Default Re: 'QMessageBox::critical' : none of the 4 overloads could convert all the argument

    And the last parameter is not needed because its default value is Qt::AutoConnection which means that for objects from different threads it is Qt::QueuedConnection.

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

    Default Re: 'QMessageBox::critical' : none of the 4 overloads could convert all the argument

    Quote Originally Posted by Lesiok View Post
    And the last parameter is not needed because its default value is Qt::AutoConnection which means that for objects from different threads it is Qt::QueuedConnection.
    True, however in this case both objects belong to the same thread. It will still work with auto connection because another check is which thread is executing the emit and that is a different thread then the owner of the reciever object.

    Doesn't hurt to explicitly specify Qt::QueuedConnection though.

    Cheers,
    _

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: 'QMessageBox::critical' : none of the 4 overloads could convert all the argument

    GUI objects in threads aside, the original error message:
    QMessageBox::critical' : none of the 4 overloads could convert all the argument
    is caused by:
    Qt Code:
    1. QMessageBox::critical(this,tr("ERROR"),tr("Large change in illumination.\nPlease re-capture reference image.\n"));
    To copy to clipboard, switch view to plain text mode 
    because the first argument, this, is not a pointer to a QWidget and cannot be converted to one.

Similar Threads

  1. How to convert image data type to plain text and back ?
    By aircraftstories in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2011, 17:00
  2. Why? Invalid type argument of unary *
    By progman in forum Newbie
    Replies: 4
    Last Post: 21st March 2011, 20:31
  3. unable to convert from one type to another
    By sachinmcajnu in forum Qt Programming
    Replies: 3
    Last Post: 16th March 2011, 01:34
  4. Replies: 0
    Last Post: 19th March 2009, 14:51
  5. Convert between a custom data type wrapped in a QVariant
    By darkadept in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2009, 10:07

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