Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. Wann wird Q_DECLARE_METATYPE benutzt und wofür?
Forum Updated to NodeBB v4.3 + New Features

Wann wird Q_DECLARE_METATYPE benutzt und wofür?

Scheduled Pinned Locked Moved Solved German
4 Posts 3 Posters 1.6k 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.
  • G Offline
    G Offline
    Galilio
    wrote on last edited by
    #1

    Hallo Zusammen,

    Mir ist immer nicht ganz klar wann und warum Q_DECLARE_METATYPE zu benutzen ist?

    Was ist der Unterschied zwischen die beiden Deklarationen? :

    class A
    {
    ....
    };
    Q_DECLARE_METATYPE(A);
    

    und :

    class B
    {
    ...
    };
    
    

    Danke

    aha_1980A 1 Reply Last reply
    0
    • G Galilio

      Hallo Zusammen,

      Mir ist immer nicht ganz klar wann und warum Q_DECLARE_METATYPE zu benutzen ist?

      Was ist der Unterschied zwischen die beiden Deklarationen? :

      class A
      {
      ....
      };
      Q_DECLARE_METATYPE(A);
      

      und :

      class B
      {
      ...
      };
      
      

      Danke

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @Galilio,

      wie in der Hilfe dazu steht, benutzt man Q_DECLARE_METATYPE um eigene Klassen in einem QVariant speichern zu können.

      Weitere Bedingungen sind: default constructor, copy constructor und destructor (all public).

      Grüße

      Qt has to stay free or it will die.

      G 1 Reply Last reply
      1
      • aha_1980A aha_1980

        Hi @Galilio,

        wie in der Hilfe dazu steht, benutzt man Q_DECLARE_METATYPE um eigene Klassen in einem QVariant speichern zu können.

        Weitere Bedingungen sind: default constructor, copy constructor und destructor (all public).

        Grüße

        G Offline
        G Offline
        Galilio
        wrote on last edited by
        #3

        @aha_1980
        Danke
        noch eine andere Frage:
        Was bringt mir wenn ich so schreibe:

        qRegisterMetaType<A>();
        

        Was passiert hier und wann kann ich das benutzen?

        Danke in Voraus

        jsulmJ 1 Reply Last reply
        0
        • G Galilio

          @aha_1980
          Danke
          noch eine andere Frage:
          Was bringt mir wenn ich so schreibe:

          qRegisterMetaType<A>();
          

          Was passiert hier und wann kann ich das benutzen?

          Danke in Voraus

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Galilio http://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType

          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