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. QUuid change variant
Forum Updated to NodeBB v4.3 + New Features

QUuid change variant

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 191 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.
  • M Offline
    M Offline
    MadBee
    wrote on 14 Oct 2023, 01:33 last edited by
    #1

    Hi!
    I saw in documentation for QUuid have variants. but I didn't get how to generate it.
    if I generate by var = QUuid::createUuid();
    var.variant() - shows '2'
    but how to change it? how to generate uuid with variant 4?
    thanks in advance

    C 1 Reply Last reply 14 Oct 2023, 03:22
    0
    • M MadBee
      14 Oct 2023, 01:33

      Hi!
      I saw in documentation for QUuid have variants. but I didn't get how to generate it.
      if I generate by var = QUuid::createUuid();
      var.variant() - shows '2'
      but how to change it? how to generate uuid with variant 4?
      thanks in advance

      C Offline
      C Offline
      ChrisW67
      wrote on 14 Oct 2023, 03:22 last edited by
      #2

      @MadBee I think you are confusing the UUID variant (DCE, the variant described in RFC 4122) with the UUID version (a sub-type of variant):

      The following table lists the currently-defined versions for this
         UUID variant.
      
         Msb0  Msb1  Msb2  Msb3   Version  Description
      
          0     0     0     1        1     The time-based version
                                           specified in this document.
      
          0     0     1     0        2     DCE Security version, with
                                           embedded POSIX UIDs.
      
          0     0     1     1        3     The name-based version
                                           specified in this document
                                           that uses MD5 hashing.
      
          0     1     0     0        4     The randomly or pseudo-
                                           randomly generated version
                                           specified in this document.
      
          0     1     0     1        5     The name-based version
                                           specified in this document
                                           that uses SHA-1 hashing.
      

      You get a version 4 (random) UUID by default QUuid::createUuid() but there are similar functions to create version 3 and 5 UUIDs. You can construct a QUuid object specifying all the components yourself to obtain a UUID of any variant or version.

      1 Reply Last reply
      1

      1/2

      14 Oct 2023, 01:33

      • Login

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