C++ (Qt)class Child : public QWidget{ Q_OBJECTpublic: ...signals: void changedString( const QString &str );}; class mainWindow : ...{ mainWindow(...) { ui.setupUi( this ); m_child = new Child( this ); connect( m_child, SIGNAL( changedString( const QString & ) ), ui.actNumberSklad, SLOT( setText( const QString & ) ) ); }};
signals: void changedString( const QString &str );
emit changedString(dirCount);
private slots:void setDirCount(const QString &str );
void mainWindow::setDirCount(const QString &str){ dirCount = str; ui.actNumberSklad->setText(dirCount);}
fMyOrg *child = new fMyOrg; connect (child, SIGNAL(changedString( const QString & )), this, SLOT(setDirCount( const QString & ))); child->dirCount = dirCount;
C++ (Qt)void customMessageHandler(QtMsgType, const char *msg){ QMessageBox::critical(0, '', QString::fromAscii(msg));} int main(int argc, char *argv[]){... qInstallMsgHandler(customMessageHandler);...}
class fMyOrg;...class mainWindow : public QMainWindow{Q_OBJECTpublic:mainWindow();QString dirCount;...private:fMyOrg *createFormMyOrg();private slots:void setDirCount(const QString &str );};
fMyOrg *mainWindow::createFormMyOrg(){ fMyOrg *child = new fMyOrg; g_fMyOrg = child; connect (child, SIGNAL(changedString( const QString & )), this, SLOT(setDirCount( const QString & ))); child->dirCount = dirCount; workspace->addWindow(child); return child;}void mainWindow::setDirCount(const QString &str){ dirCount = str; ui.actNumberSklad->setText(dirCount);}
class fMyOrg : public QWidget{ Q_OBJECTpublic:QString dirCount;...signals: void changedString( const QString &str );};
void fMyOrg::pbAddSkladClicked(){...emit changedString(dirCount);}