2014-09-11 2 views

답변

1

대화 상자로 표현 된 두 개의 QWidget (또는 상속 된) 객체가있는 경우 QObject :: connect 메소드를 사용해야합니다. Qt에 신호와 슬롯에 대해 알아보십시오. 모양은 다음과 같습니다.

class DialogA : public QWidget { 
Q_OBJECT 
... 
public slots: 
    void ShowSomeText(); // called when receive a signal 
... 
}; 

class DialogB : public QWidget { 
Q_OBJECT 
... 
    void SendTextSignal(); // sends a signal 
... 
}; 

// somwhere in code 
DialogA da; 
DialogB db; 
connect(db, SIGNAL(SendTextSignal()), da, SLOT(ShowSomeText())); 
관련 문제