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. Storing global variables for using them by threads
Forum Updated to NodeBB v4.3 + New Features

Storing global variables for using them by threads

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 175 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.
  • A Offline
    A Offline
    Abdurahman_Gulamkadirov
    wrote on last edited by Abdurahman_Gulamkadirov
    #1

    Hi there. I'm creating a desktop app, and there are many-many global variables(about 400). They are used by threads. So, what do you advice, should I store them inside a class or QSettings?

    If QSettings would be better choice, what about it's speed?
    Thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • A Abdurahman_Gulamkadirov

      Hi there. I'm creating a desktop app, and there are many-many global variables(about 400). They are used by threads. So, what do you advice, should I store them inside a class or QSettings?

      If QSettings would be better choice, what about it's speed?
      Thanks in advance.

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

      @Abdurahman_Gulamkadirov Best advice is to not to use global variables. Such variables should only be used if really necessary. 400 global variables really sounds like bad design.

      QSettings should not be used to hold variables at runtime. QSettings is used to save and read application settings.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4

      • Login

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