Questions about the signal slot

Source: Internet
Author: User
Manually add signal and slot in qtcreator

It is convenient to use the signals and slots provided by qtcreator to manage a program with a UI, but some functions are not yet available, such:

1. The function name is fixed when you go to the slot editing

2. when editing signals and slots in the UI, you cannot find the slot you have added, and you are not sure what the qtcreator has done behind it. Although you know that the UI has UIC for compilation, but the code that should be presented in the Code is not displayed, for example:Two qtextedit, one textchanged (qstring), and the other settext (qstring). This is not reflected in the Code, nor in the header file generated by designer.

3. When adding a slot, I feel that there are too many steps

Environment:

Qtcreator2.6.1

Qt 4.8.3

Win7

Procedure:

1. Add singal and slot definitions to the header file.

2. Add the corresponding connect to the constructor. For example, add an action to a qaction.

Connect (ui-> actionbackground,

            SIGNAL(triggered()),
            this,
            SLOT(actionBackGround_triggered()));

I think manual addition is advantageous. For example, to make the UI program more like a console program, the code is better read, and the management is more convenient, so that people can understand it.

Http://hakuyo.blog.51cto.com/6207832/1127551

Question:

Http://www.qtcn.org/bbs/read-htm-tid-57206.html

Questions about the signal slot

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: info-contact@alibabacloud.com 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.