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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.8.1, 5.0.0
    • Component/s: Documentation
    • Environment:

      Qt 4.7. GNU/Linux Kubuntu 10.10 x86_64. APT package: qt4-doc 4:4.7.0-ubuntu4

    • Technical Risk:
      Normal

      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

            Assignee:
            teemukat Teemu Katajisto (Inactive)
            Reporter:
            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