Qcombobox class of QT

Source: Internet
Author: User

The qcombobox plug-in integrates buttons and drop-down menus.

Qcombobox provides a drop-down menu option when it occupies the minimum screen space.

Qcombobox displays a series of optional items while displaying the current options. You can also edit ComboBox.

ComboBox can contain pixmap and strings (insertitem and setitemtext ). For editable ComboBox, clearedittext can be used to clear the strings used for display without changing the content of ComboBox.

When the current value of ComboBox changes, two signals (currentindexchanged and activated) can be sent ). Whether or not user interaction is pre-configured or exists in the program, currentindexchanged will always be activated, and activated will only be activated when user interaction exists. The highlighted signal is triggered when the user lights up the ComboBox drop-down menu. Both the qstring and INT versions are available. If you select or click a pixmap, only the int signal is triggered. When an editable ComboBox changes, the edittextchanged signal is triggered.

When you enter a new string into an editable ComboBox, The ComboBox plug-in can insert it or not, and the plug-in can also insert it into many locations. The default rule is atbottom, but you can also use setinsertpolicy to change the rule.

You can use qvalidator to restrict the input (setvalidator) of the Editable ComboBox ). By default, all inbound and outbound traffic is acceptable.

You can use insertitem to add a project to ComboBox. The project can be changed using setiemtext. A project can be removed with removeitem, and all projects can be removed with clear. The content of the current project can be returned using currenttext, and the content of the digital project can be returned using text. You can use setcurrentindex to set the current project. You can use count to return the number of ComboBox projects. You can use setmaxcount to set the maximum number of projects. You can use seteditable to edit a project. For editable ComboBox, you can use setcompleter to set Automatic completion. You can use setduplicatesenabled to set whether you can add a copy.

Qcombobox uses the model/view architecture to display the drop-down list and storage items. By default, the qstandarditemmodel Storage Project and qlistview subclass display a drop-down list. Users can access model and view, but qcombobox also provides functions to set and obtain data (setitemdata and itemtext ). You can also set a new model and view. The ComboBox label uses the data of the model with QT: displayrole and QT: decorationrole.

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.