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. what is the best way to use variable read from a doubleSpin in another cpp file?
Forum Updated to NodeBB v4.3 + New Features

what is the best way to use variable read from a doubleSpin in another cpp file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 543 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.
  • P Offline
    P Offline
    pedromenezes
    wrote on last edited by pedromenezes
    #1

    I have a doubleSpin on form 1 and I need to use it value as a variable in another cpp file. I should use global variable or write in a file and read it after or there is a better way to do?
    Is it possible to show a short exemple?

    aha_1980A 1 Reply Last reply
    0
    • P pedromenezes

      I have a doubleSpin on form 1 and I need to use it value as a variable in another cpp file. I should use global variable or write in a file and read it after or there is a better way to do?
      Is it possible to show a short exemple?

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

      @pedromenezes the best way is to use Signals&Slots for that task.

      Qt has to stay free or it will die.

      1 Reply Last reply
      3
      • P Offline
        P Offline
        pedromenezes
        wrote on last edited by
        #3

        Thank you! I have other variables that get several widgets values. I want to use all the variables, even if the values ​​of all the widgets are not changed. So, is there a way to do a function to get all the values ​​and send them to another cpp file (as a single signal) or do I have to send a signal from each widget to the other file?

        Thanks again.

        jsulmJ 1 Reply Last reply
        0
        • P pedromenezes

          Thank you! I have other variables that get several widgets values. I want to use all the variables, even if the values ​​of all the widgets are not changed. So, is there a way to do a function to get all the values ​​and send them to another cpp file (as a single signal) or do I have to send a signal from each widget to the other file?

          Thanks again.

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

          @pedromenezes You can have a signal with more than one parameter or you create a struct containing these parameters and use this struct as parameter type for your signal.

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

          1 Reply Last reply
          3

          • Login

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