0

Hello to everyone.

I'm trying to write a piece of C++/Qt code and I always seem to get stuck at the same thing.

I'm creating a DAQ System for my MSc thesis, who's purpose is to present and get some variables from the user interface (class name Interface) and when a pushbutton is clicked() to pass them to a class named DAQCycle that needs them in order to operate properly. So for example:

# interface.h
class Interface{
public:
Interface();
~Interface();
void doThat();

uint32_t VAR1;
int VAR2;
std::string VAR3;
std::vector<CLASSNAME*> VAR4;
};
#DAQCycle.h
class DAQCycle{...}
# DAQCycle.cpp
DAQCycle::DAQCycle(){
for(int k=0; k<Interface.VAR2; k++){
 // doSomething..
}

The problem is of course that I don't create (and I actually I cannot see how to create) an object of the class Interface in order to instantiate its variables that I need for my other class.

Is there any way to circumvent that?

PS. My main() is the standard Qt main function

#main.cpp
#include <QtGui/QApplication>

#include "Interface.h"
#include "DAQCycle.h"

using namespace Ui;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Interface w;
    w.show();    
    return a.exec();
}

Thanks in advance.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mike_2000_17
0

Just make the handler for the click button event in the Interface class, and then call a function of the DAQCycle class, and pass it the "this" pointer of the Interface object.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.