read a value from a class into another class
-
Hello everyone,
I have a probelm with my Qt project. I want to create a very simplified version of a flight simulator.
In this simulation, I want a menu where you can choose the plane you want to fly with. So I created a class "choix" where you can choose your plane : when you click on a specific plane, for example, x takes the value 1.
My problem is that I want to read this value in another class... -
You can't just jump in to Qt. You need to comprehend the signal/slot mechanism for passing data through the framework. Start with the many example applications.
A QListBox (or equivalent) "signal" can send the selected entry to a "slot" in another class.
-
Hello everyone,
I have a probelm with my Qt project. I want to create a very simplified version of a flight simulator.
In this simulation, I want a menu where you can choose the plane you want to fly with. So I created a class "choix" where you can choose your plane : when you click on a specific plane, for example, x takes the value 1.
My problem is that I want to read this value in another class...@Gaaaab said in read a value from a class into another class:
My problem is that I want to read this value in another class
Either implement a getter method which returns the value, or use signals/slots to emit the signal with the value (see https://doc.qt.io/qt-5/signalsandslots.html).
-
Hello everyone,
I have a probelm with my Qt project. I want to create a very simplified version of a flight simulator.
In this simulation, I want a menu where you can choose the plane you want to fly with. So I created a class "choix" where you can choose your plane : when you click on a specific plane, for example, x takes the value 1.
My problem is that I want to read this value in another class...