Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Qt.io webservices
  4. Qt5.0-beta1 QObject::connect return type and suggested framework operator
Forum Updated to NodeBB v4.3 + New Features

Qt5.0-beta1 QObject::connect return type and suggested framework operator

Scheduled Pinned Locked Moved Qt.io webservices
3 Posts 2 Posters 2.4k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    pacanek
    wrote on last edited by
    #1

    Hi Guys,
    I'm pretty amazed how easy our migration to Qt5 was, but there was one change that I've needed to do and I think it could be taken into framework itself.

    Compiler: gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

    This lines of codes shows the case:
    @ bool res = true;
    res &= connect( this, SIGNAL(x()), this, SIGNAL(x2()));@

    Qt4.8 passed this cause connect returned bool.
    Qt5.0 returns QMetaObject::Connection and in this case we have compilation error caused by trying to do bitwise or on bool and QMetaObject::Connection.

    To avoid changing code I've defined at global space this operator:
    @bool& operator&=(bool& a_res, const QMetaObject::Connection& a_res2)
    {
    a_res = (a_res & static_cast<bool>(a_res2));
    return a_res;
    }@

    I hope it will help somebody or even get into Qt5.0

    ==
    P4C

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on last edited by
      #2

      As the documentation says ("QMetaObject":http://doc-snapshot.qt-project.org/qt5-stable/qtcore/qmetaobject-connection.html ), the & should still work because the Connection defines operator bool()

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pacanek
        wrote on last edited by
        #3

        Try it ;-)

        operator&
        is not a operator&=

        "September 18, 2012" ;-D

        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