Questions about the QT dialog box popping up two times without a reason

Source: Internet
Author: User

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:// "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:// "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

Questions about the QT dialog box popping up two times without a reason

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.