tonnot
22nd September 2010, 08:47
Is there any QT tutorial explaining how to access componentes from code placed into different classes ?
Thanks
tbscope
22nd September 2010, 09:15
1. signals and slots
2. access functions
...
Example:
class A : public QObject
{
Q_OBJECT
public:
A();
~A();
int something();
void setSomething(int something);
signals:
void somethingWasSet(int something);
public slots:
void setSomethingElse(int something);
private:
int theThing;
};
class B : public QObject
{
Q_OBJECT
public:
B();
~B();
int something();
void setSomething(int something);
signals:
void somethingWasSet(int something);
public slots:
void setSomethingElse(int something);
private:
int theThing;
};
...
A a;
B b;
connect(&a, SIGNAL(somethingWasSet(int)), &b, SLOT(setSomethingElse(int)));
...
b.setSomething(a.something());
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.