c++ - qt dialog2 connect dialog1 to updateQtableWidget -
i tried many things , read day no real progress. typed question, went through stack overflow suggestions. goal? have dialog2 send out signal dialog1 call function in dialog1, load/update qwidgettable. in dialog2(no buttons), keypressevent(f4), opens file, saves text in lineedit, file. after stream out done, stream flushed, file closed , lineedit fields reset can input more stuff if needed. works perfect, in part forum. but, being dialog2 nothing more size of messagebox, can still see dialog1 behind it, , tablewidget doesn't update stuff saved file. looks weird user. i'm at...
connect(this->ui->lineedit,signal(textchanged(qstring)),dialog1,slot(loadtable())); (this) dialog2. doesn't compile. know i'm missing here. signals , slots relatively easy if widgets inside own "form"/"window".
any appreciated.
dialog1::dialog1(qwidget *parent) : qdialog(parent), ui(new ui::dialog1) { setwindowflags(qt::widget | qt::framelesswindowhint);//frameless ui->setupui(this); //move dialog away center this->setgeometry(0,0,this->width(),this->height()); //put dialog in screen center const qrect screen = qapplication::desktop()->screengeometry(); this->move( screen.center() - this->rect().center() ); loadtable(); } dialog2::dialog2(qwidget *parent) : qdialog(parent), ui(new ui::dialog2) { setwindowflags(qt::widget | qt::framelesswindowhint);//frameless ui->setupui(this); //move dialog away center this->setgeometry(0,0,this->width(),this->height()); //put dialog in screen center const qrect screen = qapplication::desktop()->screengeometry(); this->move( screen.center() - this->rect().center() ); connect(ui->lineedit,signal(textchanged(qstring)),&dialog1,slot(loadtable())); } i don't it.
i believe problem here :
connect(ui->lineedit,signal(textchanged(qstring)),&dialog1,slot(loadtable())); you don't have dialog1 instance. if dialog1 appear first, need pass dialog1 instance dialog2, , able connect it.
Comments
Post a Comment