2013-02-16 5 views

답변

1

당신을 위해 일부 의사 코드 ...

mainwindow.h

class MainWindow : public QMainWindow 
{ 
... 
signals: 
    void sendListText(const QString&); 
private slots: 
    void nextClicked(void); 

... 
}; 

mainwindow.cpp

MainWindow::MainWindow(QWidget* parent) 
{ 
    ui.setupUi(this); 
    connect(ui.nextButton, SIGNAL(clicked()), this, SLOT(nextClicked())); 
} 

MainWindow::nextClicked(void) 
{ 
    QModelIndex current = ui.list->currentIndex(); 
    qDebug() << current.data().toString(); 
    emit(sendListText(current.data().toString()); 
} 

otherwindow.h

class OtherWindow 
{ 
    ... 
public slots: 
    void setEditText(const QString&); 

}; 

otherwindow.cpp

void OtherWindow::setEditText(const QString& text) 
{ 
    // add your text 
} 

지금 당신은 당신이 그들 모두에 액세스 할 경우 슬롯 OtherWindow::setEditText()MainWindow::sendListText()를 연결해야합니다. 많은, 유 plz 수 있습니다 김 긴 자이

+0

안녕 Zaiborg

, 감사 – highlander141

+0

답변을 편집 ... 강령 방식을 확인합니다. 지금 당신은 그것 (또는 아마 다른 위젯)로 새 창을 채워야 만합니다. – Zaiborg

+0

맞아요. 컴파일 창에서 문자열을 얻었습니다. 다른 창으로 넘겨서 QTextEdit에 표시해야합니다. 그러면 Next 버튼의 신호가 QTextEdit의 슬롯을 호출해야합니까? 그 비슷한.? 안내 나에게 .. 감사합니다. – highlander141