How do I remove this selected shape? - c++

So I have created a shape using items and then added those items to a QGraphicsItemGroup. The group is set with the flags movable and selectable. My issue is I cannot find a method that allows me to remove the group and all the items in it when it is selected.

Related

Prevent editable QComboBox selection from changing when item list modified

I have an editable QComboBox containing a list of ID numbers.
The ID numbers represent devices attached to the system. The devices are frequently added and removed at runtime.
The intent of the editable combo box is to contain, in its list, the list of IDs currently attached, for easy selection, but at the same time allow the user to manually enter IDs of devices not currently present. Also, it's valid to enter an empty string for the ID.
Basically I want to provide the user with a way to enter an arbitrary (or no) ID, with the added bonus of a quick selection of devices currently attached (which changes at runtime).
I am not currently using a list model to maintain the list, I'm just using the QComboBox's add and remove functions.
I need the selection to not change if devices are added or removed. However, I'm running into the following problems:
When the currently entered ID (either manually or by list selection) is removed from the list, the selection is changed to another ID in the list.
When the list is empty and an ID is entered manually, or no ID is entered at all, the selection is changed when an ID is added to the list.
Is there a way to make it so that adding and removing items from the combo box never, ever modifies the selection in the edit box? Or even some other UI element that accomplishes my goal?
Before updating the combo box, save the currently selected ID (or the blank string) to a temp. variable. After modifying the combo box contents, check if that ID still exists in the combo box (e.g. with findText()). If it does, select it with setCurrentIndex(). If it does not, set it with setCurrentText() or setEditText().

Change label of QComboxBox without using lineEdit

Currently I want to implement a widget to allow user to enable/disbale all provided options of a QSet. So i took a combobox and added selectable items. So far so good, but how I can change text displayed in combobox? Currently all my items have just ItemIsUserCheckable and ItemIsEnabled as enabled flags (ItemIsSelectable is not enabled), so text of ComboBox is always text of first item. Instead I want as text "Flag1, Flag 3, Flag6" if there multiple flags and user enabled Flag 1, 3 and 6. But setCurrentText and setEditText requiring setEditable(true) or an custom lineEdit. But using an lineEdit is changing appearance. So is there another way?
I had a similar problem a while back, I ended up 'solving' it by adding an extra item to my model that was first in the list and always set as the current item. I then updated it's text to say 'Select items...' or 'X item(s) selected' as appropriate.

Can we hide row in win32 listview

I am using win32 listview control. My requirement is to hide a certain number of rows from listview but I could not find any flag by which I can hide the row item in listview.
I try creating a group and try hiding one the group but the LVGS_HIDDEN flag is not working as well.
I am looking at the documentation from below link http://msdn.microsoft.com/en-us/library/windows/desktop/bb774769(v=vs.85).aspx
Also If the hiding of the group is not working, it is possible to move row item from one group to another group.
The LVGS_HIDDEN flag will only be applied if LVGF_STATE is set. An item's groupid can be changed by the LVM_SETITEM message.

Deselecting radio buttons

I am creating an application in which i use different group box for different categories which contains radio buttons for items.But if i select an item from one group box and then from another group box,the item in previous group box remains checked. But i want that whenever i select an item from different group box all other item must get deselected.
Can anyone help me with this regard??
Thank you.
Radio buttons with different parents will behave as separate groups so the radio buttons will all need to have the same parent. You could overlay group boxes by positioning group boxes over the radio buttons but this will be problematic if you are using layouts. An alternative is to just separate the groups of radio buttons you want to distinguish by using labels or line separators.
Group all the buttons together with either 1 group as parent or something else like the form, just have them in the group boxes visually.
By default, radio buttons will only be exlusive between those with the same parent. However, there is a simple solution to this. A QButtonGroup can be used to specify which buttons are related. Your solution would be to create your own button group, then set that group on each of the radio buttons you would like to be mutually exclusive.

How to create more than one group in List , SSRS 2005?

I am using a List in one of my reports. It has a detail grouping on a field, and controls like subreports. Now my requirements changed a bit and I need to have an outer group around the existing one, and a page break on the outer group.
How do i do this? I tried using the same list, but couldn't figure out how to create an inner and outer grouping. Do I have to use nested lists, where the outer list has does the outer grouping and the inner list does the inner grouping?
Your guess is correct.
You'll need to add another List control to the report. Drag the existing List control into the new control. Under the properties for the new List control go to "Edit details group" and add to needed column to the "Group on". Next, select either "Page break at start" or "Page break at end" to add the page breaks. The rest of the report design will determine which is most appropriate.
This answer assumes that the value for the outer group is already in the dataset for the existing list. If that assumption is incorrect, you'll need to add the column into the dataset.