Today, QT is a little bit of a hindrance when it comes to doing a multi-threaded course. The function of this program is to open the Folder selection dialog box and select multiple TXT files. Then the background writes "Hello World" to the multiple TXT files, and when a file is written, the name of the file is displayed on the GUI.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/8E/wKioL1XmrVTQpwgjAASbSD8l4-U709.jpg "title=" Qq20150902155023.png "width=" "height=" 625 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:900px;height:625px; "alt = "Wkiol1xmrvtqpwgjaasbsd8l4-u709.jpg"/>
The program finishes seemingly well, but each time you select the file by clicking "Open" the dialog box will pop up. After a long time did not solve the problem, and finally just I know what happened. Here to make a note for yourself, there is a need to see.
Small memories under the process of doing this project, first set up the project file, and then into the Qtdesigner do interface, after that is the write slot function. I use the Write slot function as shown in the method. 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/8E/wKioL1Xmr6HQd0HVAAEH2EiYqJs692.jpg "title=" Qq20150902160000.png "alt=" Wkiol1xmr6hqd0hvaaeh2eiyqjs692.jpg "/>
Then it was the process of knocking the code, and after the code was knocked out, I added the Diglog function in the constructor of the statement:
Connect (ui->pushbutton,signal (clicked ()), This,slot (on_pushbutton_clicked ()));
Seemingly seamless operation process, the compilation phase did not error. The program runs basically normal, except that the Select File dialog box pops up two times. Then is a morning to adjust this problem, looking for information to see the post. Finally understand where the problem is, we use the "Go to Groove" method to create a slot function qt has already made our connection, and I again in the constructor function of the slot function is connected, so that the slot function has been executed two times.
If I need to see the code, I put it in the attachment.
This article is from "Lu Yao" blog, please be sure to keep this source http://cwxfly.blog.51cto.com/6113982/1690850
Questions about the QT dialog box popping up two times without a reason