Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Function to handle logical combination of enums
Forum Updated to NodeBB v4.3 + New Features

Function to handle logical combination of enums

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 3 Posters 1.4k 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.
  • S Offline
    S Offline
    Sam
    wrote on last edited by
    #1

    Hi,

    I have a class that has enums as

    @enum SomeVariable
    {
    A = 1,
    B= 2,
    c= 3
    };
    Q_ENUMS(SomeVariable)@

    I need a function that would accept logical combination of these enums

    like
    @setVariable( A | B);
    setVariable(B | C);
    setVariable(A);
    setVariable(B);
    setVariable(C);@

    How can I handle this ? For different combination I will set a different setting in my application.

    PS: Basic question :)

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      QFlags is designed for your use-case; http://qt-project.org/doc/qt-5/QFlags.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        Also,

        there is a tutorial "in the wiki":http://qt-project.org/wiki/QFlags_tutorial

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0

        • Login

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