Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15653

Error in QMetaType "MyClass" custom type allocation and destruction example

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P3: Somewhat important
    • 4.8.1, 5.0.0
    • None
    • Documentation
    • Qt 4.7. GNU/Linux Kubuntu 10.10 x86_64. APT package: qt4-doc 4:4.7.0-ubuntu4

    Description

      In the following snippet from the example in the detailed description of QMetaType:

      int id = QMetaType::type("MyClass");
      if (id == 0) {
      ...

      The if condition is wrong. According to QMetaType documentation, type() returns 0 if the type is not registered, so the condition should be (id != 0), so the program tries to do something only when the type exists.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            teemukat Teemu Katajisto (Inactive)
            naproxeno Álvaro Manuel Recio Pérez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes