|
本人遇到一个问题,其实很简单,就是在同一个界面上一个textedit输入内容,另外一个textedit负责显示内容。功能很简单,但是显示不管怎么样就是显示不出数据。麻烦帮我看下哪里存在问题。谢谢了。
file:///C:/Documents%20and%20Settings/Administrator/Application%20Data/Tencent/Users/609496715/QQ/WinTemp/RichOle/IZNKK2GIGCWNEO%60LUJD3Q_Y.jpg
以下是我的部分代码:
mainwindow.cpp:
#include "mainwindow.h"#include "ui_mainwindow.h"#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); connect(ui->send_btn,SIGNAL(clicked()),this,SLOT(process()));}MainWindow::~MainWindow(){ delete ui;}void MainWindow::setSend(QString str){ sendTo = str;}QString MainWindow::getReceive(){ return sendTo;}void MainWindow::process(){ qDebug() << "left - textedit input -->" << ui->textEdit1->toPlainText()<<endl; this->setSend(ui->textEdit1->toPlainText()); QString show; show = this->getReceive(); ui->textEdit2->toPlainText() = show; qDebug() << "right - textedit show -->" << show << endl;} main.cpp:#include <QtGui/QApplication>#include <QTextCodec>#include "mainwindow.h"int main(int argc, char *argv[]){ QApplication a(argc, argv); QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030")); //Q_RESOURCE(hello); MainWindow w; w.show(); return a.exec();}
|
|