Home > Back-end >  The same project, how the different modules qt slot function called
The same project, how the different modules qt slot function called

Time:11-13

A project which is divided into many modules, I need the function of the implementation is now, after I upload a file, you need to call to another module of rendering (not in the current module rendering), is similar to manually trigger a slot function, the module can't direct reference to another module header files, this kind of situation after how do I upload a file to invoke a another module function, to solve!

CodePudding user response:

Come on! I saw, but did not understand, field is different!

CodePudding user response:

expired kid, 1/f, reference response:
come on! I saw, but did not understand, field is different!

Me to describe the problem, may the above said is not very clear

A load module of the whole folder, after loading, will be assigned to the needed data rendering module, the assignment is completed, I wish to go to call the default rendering rendering module, is actually a button,
I want to manually trigger the,

Several problems:
1, render button event functions is protected members in other classes cannot directly invoke,
2, document load module, not directly introduce rendering module header files, but can be by adding depend on the path to introduce (but this would be to make the current module embedded module of other things, as far as possible, don't want to)
3, I tried to create a friend, but I create reminders friend yuan is invalid,
4, after the break the limit of 2 and the event functions into a public function, can lead to problems unresolved symbols, in other parts of the world but you can call, just call and not into the functional implementation of logic, but directly returned to the
5, I tried to copy function in the file content module implementation, but should use Q_D (); Identifier, can initialize an d object inside, but I have not had this Q_D in file module identifier, didn't also the way object initialization d

I just c + + beginners, so it may be myself into a dead end, hope that we can put forward their own opinions

CodePudding user response:

Surely there is a problem you wrote ah look closely

CodePudding user response:

Have you is QT, file loading module definition signals, the upper bound signal to the rotating module slot function not line??????? Child module unrelated. Like this, all handwritten code, will see, what you actually class is not the same file no problem, just class has, write their own new objects.
For example:
 
Class A {
Signals:
Void fileLoaded ();
};
Class B {
Public slots:
Void onFileLoaded () {
//internal call render
}
};
The class Core {
Public:
The Core () {
The connect (a, SIGNAL (fileLoaded ()), b, SLOT (onFileLoaded ());
}
Public:
A * A;
B * B;
};


reference 3 floor also night reply:
Quote: refer to 1st floor expired kid, response:
come on! I saw, but did not understand, field is different!

Me to describe the problem, may the above said is not very clear

A load module of the whole folder, after loading, will be assigned to the needed data rendering module, the assignment is completed, I wish to go to call the default rendering rendering module, is actually a button,
I want to manually trigger the,

Several problems:
1, render button event functions is protected members in other classes cannot directly invoke,
2, document load module, not directly introduce rendering module header files, but can be by adding depend on the path to introduce (but this would be to make the current module embedded module of other things, as far as possible, don't want to)
3, I tried to create a friend, but I create reminders friend yuan is invalid,
4, after the break the limit of 2 and the event functions into a public function, can lead to problems unresolved symbols, in other parts of the world but you can call, just call and not into the functional implementation of logic, but directly returned to the
5, I tried to copy function in the file content module implementation, but should use Q_D (); Identifier, can initialize an d object inside, but I have not had this Q_D in file module identifier, didn't also the way object initialization d

I just c + + beginners, so it may be myself into a dead end, hope everybody can put forward their own opinions

CodePudding user response:

leaf boat _ guo reference 5 floor response:
you is QT, file loading module defines the signal, the upper bound signal to the rotating module slot function not line??????? Child module unrelated. Like this, all handwritten code, will see, what you actually class is not the same file no problem, just class has, write their own new objects.
For example:
 
Class A {
Signals:
Void fileLoaded ();
};
Class B {
Public slots:
Void onFileLoaded () {
//internal call render
}
};
The class Core {
Public:
The Core () {
The connect (a, SIGNAL (fileLoaded ()), b, SLOT (onFileLoaded ());
}
Public:
A * A;
B * B;
};


Quote: refer to the third floor is the reply of the night:
Quote: refer to 1st floor expired kid, response:
come on! I saw, but did not understand, field is different!

Me to describe the problem, may the above said is not very clear

A load module of the whole folder, after loading, will be assigned to the needed data rendering module, the assignment is completed, I wish to go to call the default rendering rendering module, is actually a button,
I want to manually trigger the,

Several problems:
1, render button event functions is protected members in other classes cannot directly invoke,
2, document load module, not directly introduce rendering module header files, but can be by adding depend on the path to introduce (but this would be to make the current module embedded module of other things, as far as possible, don't want to)
3, I tried to create a friend, but I create reminders friend yuan is invalid,
4, after the break the limit of 2 and the event functions into a public function, can lead to problems unresolved symbols, in other parts of the world but you can call, just call and not into the functional implementation of logic, but directly returned to the
5, I tried to copy function in the file content module implementation, but should use Q_D (); Identifier, can initialize an d object inside, but I have not had this Q_D in file module identifier, didn't also the way object initialization d

I'm just beginner c + +, so the above may be myself into a dead end, hope everybody can put forward their own opinions

This is my rendering module slot function
 


leaf boat _ guo reference 5 floor response:
you is QT, file loading module defines the signal, the upper bound signal to the rotating module slot function not line??????? Child module unrelated. Like this, all handwritten code, will see, what you actually class is not the same file no problem, just class has, write their own new objects.
For example:
 
Class A {
Signals:
Void fileLoaded ();
};
Class B {
Public slots:
Void onFileLoaded () {
//internal call render
}
};
The class Core {
Public:
The Core () {
The connect (a, SIGNAL (fileLoaded ()), b, SLOT (onFileLoaded ());
}
Public:
A * A;
B * B;
};


Quote: refer to the third floor is the reply of the night:
Quote: refer to 1st floor expired kid, response:
come on! I saw, but did not understand, field is different!

Me to describe the problem, may the above said is not very clear

A load module of the whole folder, after loading, will be assigned to the needed data rendering module, the assignment is completed, I wish to go to call the default rendering rendering module, is actually a button,
I want to manually trigger the,

Several problems:
1, render button event functions is protected members in other classes cannot directly invoke,
2, document load module, not directly introduce rendering module header files, but can be by adding depend on the path to introduce (but this would be to make the current module embedded module of other things, as far as possible, don't want to)
3, I tried to create a friend, but I create reminders friend yuan is invalid,
4, after the break the limit of 2 and the event functions into a public function, can lead to problems unresolved symbols, in other parts of the world but you can call, just call and not into the functional implementation of logic, but directly returned to the
5, I tried to copy function in the file content module implementation, but should use Q_D (); Identifier, can initialize an d object inside, but I have not had this Q_D in file module identifier, didn't also the way object initialization d

I'm just beginner c + +, so the above may be myself into a dead end, hope everybody can put forward their own opinions

This is my rendering module slot function
 
QObject: : connect (this - & gt; ActionCenter, SIGNAL (triggered ()),
Q, SLOT (resetFocalPoint ()));
//you means below plus a this form?
QObject: : connect (qIOManger, SIGNAL (loadNodes ()),
Q, SLOT (resetFocalPoint ()));


  • Related