Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved] How to enable QT_DEPRECATED in Qt 5.4.0 build
QtWS25 Last Chance

[Solved] How to enable QT_DEPRECATED in Qt 5.4.0 build

Scheduled Pinned Locked Moved Mobile and Embedded
qt5.4
4 Posts 2 Posters 3.3k Views
  • 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.
  • N Offline
    N Offline
    njozwiak
    wrote on last edited by njozwiak
    #1

    Hi all,

    How do I enable the QT_DEPRECATED flag when I build Qt 5.4.0? I am trying to build zbar against Qt, but it uses deprecated members and functions.

    In file included from qt/QZBarThread.h:30:0,
                 from qt/QZBar.cpp:28:
    ./include/zbar/QZBarImage.h: In constructor ‘zbar::QZBarImage::QZBarImage(const QImage&)’:
    ./include/zbar/QZBarImage.h:57:38: error: ‘const class QImage’ has no member named ‘numBytes’
         unsigned long datalen = qimg.numBytes();
                                      ^
    qt/QZBar.cpp: In constructor ‘zbar::QZBar::QZBar(QWidget*)’:
    qt/QZBar.cpp:52:39: error: ‘x11Info’ was not declared in this scope
         thread->window.attach(x11Info().display(), winId());
                                       ^
    ...
    

    QtGui/qimage.h:

    ...
    #if QT_DEPRECATED_SINCE(5, 0)
        QT_DEPRECATED inline int numColors() const;
        QT_DEPRECATED inline void setNumColors(int);
        QT_DEPRECATED inline int numBytes() const;
    #endif
    ...
    

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      IIRC, you need to use QT_DISABLE_DEPRECATED_BEFORE with a value 0x040900

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        njozwiak
        wrote on last edited by
        #3

        Hi,

        Thanks for the response. Could you give a little more detail? How would the QT_DISABLE_DEPRECATED_BEFORE flag be set?

        Thanks

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Add

          DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900

          to your pro file and your should be good to go

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved