Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Signals with enum
Forum Updated to NodeBB v4.3 + New Features

Signals with enum

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 294 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1
    enum {
        LINE_DRAW,
        RECT_DRAW,
        ELLIPSE_DRAW,
        TEXT_DRAW,
        IMAGE_DRAW
    } draw_type;
    
    signals:
        newItem(enum draw_type);
    

    https://github.com/sonichy

    1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      MOC needs to be aware of them, see:
      Q_ENUM(draw_type)
      Q_ENUM_NS(draw_type) - if inside namespace

      1 Reply Last reply
      10
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        To add to what @6thC said this is not the correct syntax. You're defining a variable of an anonymous enum type.
        Should be:

        enum DrawType {
            LINE_DRAW,
            RECT_DRAW,
            ELLIPSE_DRAW,
            TEXT_DRAW,
            IMAGE_DRAW
        };
        
        signals:
            void newItem(DrawType drawType) const;
        
        1 Reply Last reply
        11

        • Login

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