How to set display text for ComboBox (checkable) in Qt - qt

I follow these to create checkable combobox
ComboBox of CheckBoxes?
http://programmingexamples.net/wiki/Qt/ModelView/ComboBoxOfCheckBoxes
However when I do a this->Model->clear() then add items, the combobox text (the text combobox displays before user clicking anything) goes blank. The items will still show and are checkable when click on the combobox. I suspect the clear() remove the header and causes this, however I try setHorizontalHeaderLabels etc but I still can't set the combobox text. What am I missing?

Try setting the ComboBox's selected index after you add items. Like:
ui->combobox->setCurrentIndex(0);
Because it could be that after you clear the ComboBox, its display index may have gone to -1 and stayed there even if you add items.

Related

list window does not disapper of Obout ComboBox control

I am developing a web application. I used ajax Update panel & under update panel I used gridview for displaying data. In gridviews edit template I used three Obout ComboBox Control(third party) and bind the data from database.for moving one control to another controls I am using tab key.I used tab key from one combobox its move on second combobox when its move then it is displaying list window of combobox it wont disappear after I go to next control and also when I save the data it well display list of comboxBox.
For example of marked comboBox I attached two images
1)”” when I move one comboBox to another comboBox it is displaying list
2)”” when I save the data it is displaying list window of comboBox.
But when I remove the update panel it won't display such list after focus is moved.
Note:When I use mouse to move one comboBox to another comboBox, list window of ComboBox wont come on screen.
VS:2010
Code-Behind:VB.net
Obout Suite Version:3.5
using obout comboBox property openOnfoucs="false" , solved the problem. It does not display list window when focus moved to another control.

Flex: ItemEditor losing focus!

Here's an image of what my problem is:
I am using a combo-box as a Datagrid ItemEditor (Not just Renderer, my Renderer is a Label, double clicking on a cell makes the combo-box visible, as is the case with all item editors)
Now, selecting one of the entries in the combo-box is no problem. But my problem is only when i select the "Fruit" , which in turn pops open another layer called "Select Fruit" dialog
Questions:
How do i keep item editor, while the focus is on the layer; right now as soon as i click on the fruit , my handler popsup the "Select Fruit" dialog and the focus is on the layer. Once the focus goes out of the editor, the ItemEditor goes away and ItemRenderer label comes back.
I want to keep the ItemEditor alive! where do I hook up interms of events like begin/end ItemEdit etc?
You can keep your itemEditor alive by listening for DataGridEvent.ITEM_EDIT_END. Then you have a lot more control to do what you want. Some FYI from my blog:
DataGridEvent.ITEM_EDIT_END
- Dispatched when focus is removed from the cell
- List-based control’s default event listener will
1) use the .editorDataFrield property to deterine the property of the item editor to store the edited data; In a default TextInput control’s item editor, the “text” property would contain the new data.
2) Invoke destoryItemEditor() depending on the reason of the event
You can interrupt the default List-based control’s default event listener by using event.preventDefault() to
a) Modify the data returned from the item editor
b) Examine/Validate the data entered into the item editor; If the data is incorrect, you can halt Flex passing the data back from the item editor into the list-based control
http://knowledge.lapasa.net/?p=153
Try losing focus of your ItemEditor. Goto Combo Box Change Listener
protected function comboBox_changeHandler(event:ListEvent):void
{
// set focus out event on datagrid. Its like clicking outside the datagrid
event.target.parent.parent.parent.dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT);
}

Flex 4 Inline Item Editor Wiping Out Data

In this app that has an inline item editor, if you click on a location cell then press tab, the value in the location cell is wiped out.
focusOut doesn't work, nor could I get this to work in DataGrid itemEditEnding etc.
See this Flex forums post, because posting code here rots:
http://forums.adobe.com/thread/778496
The definition for the inline item editor needs this:
selectedItem="{data.location}"
instead of this:
prompt="{data.location}"
This is because the itemEditEnd event sets the newData property (deep within the code) to the value of selectedItem, so if you have only selected the cell and have not yet selected a value in the DropDownList, such as selecting the cell then immediately tabbing out, the value gets wiped out.

Setting a custom itemRenderer in a Flex3 ComboBox on specific list items after combobox creation

I'm trying to set a specific list item in a mx combobox to have a custom item renderer, the problem is that I cannot do this via mxml, it needs to be done via actionscript at a later stage, eg: combobox gets created, combobox gets populated, user does other tasks, combobox needs to set one or more items in the combobox to have icons (via item renderer)..
I can do this via the onChange event, but it only applies the icon when the combobox is opened and there is a slight delay so you can see the icon being added.
Thanks in advance for any help
J
The normal answer for this is to not do this in the onChange, but to change something in the ComboBox's dataProvider and let the itemRenderer handle it instead.
i.e. in the itemRenderer
<mx:Image id="icon" source={data.icon} visible={data.icon} includeInLayout={data.icon} />
Setting the icon property in whichever item you want to show the icon for. If icon is null, nothing gets shown.

Flex Combobox: Cancel Select

I've made an itemrenderer for the combobox control that shows a button next to the label.
If a user clicks this button, the item gets removed from the dataprovider. Works so far.
When he selects an item, the combobox closes, that's ok. But I don't want it to close when he removes an item.
So is there a way to cancel the change event?
I have tried several things, but to no avail.
I have to use the combobox for layout reasons, don't have enough space to use listboxes...
Thanks for your help.
In your custom itemrenderer , on mouse down handler stop Immediate Propogation
event.stopImmediatePropogation();
In your custom item renderer, try canceling the event in your button's click handler.
event.stopImmediatePropogation()

Resources