Combobox with searchbox at the top - c++

How to create a combobox with searchbox at the top? (https://learn.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.ComboBox?view=winrt-19041)

Combobox with searchbox at the top
As #Luca Lindholm said, you could set IsEditable as true that could make the input auto -complete. If you want to the dropdown will display the matched item dynamically, we suggest use AutoSuggestBox. And this is related tutorial.

Related

how to show Qtreewidget item as editable by default?

How to show Qtreewidget item as in editable mode? means when a data of that particular column will show it should be look like it can be edit.
Means it should be taken data as input.
QTreeWidgetItem *item=NULL;
item->setBackgroundColor(0,color);
item->setIcon(0,coloricon);
item->setText(0,QString(sample->sampleName.c_str()));
item->setData(0,Qt::UserRole,QVariant::fromValue(samples[i]));
**//I want to show this particular column as in editable mode**
item->setText(1,QString(sample->getSetName().c_str()));
item->setText(2,QString::number(sample->getNormalizationConstant(),'f',2));

Lotus Notes: Dialog list - refresh fields on keyword change not working

I have a dialog list which use Use View dialog for Choices.
I have a row in a table which its appearing depends on the value selected from that dialog list. ( I am using Hide when formula... ) The form has Automatically refresh fields checked.
The problem is that after I select a certain value from the dialog list, and I even had selected Refresh fields on keyword change property, I MUST hit F5 or just TAB ( to go to a next field ) in order to make that row table to appear. I also tried to add uidoc.Refresh at the Exiting/OnChange event(s) of the dialog list.
I have noticed the following:
the refresh works fine for combo box, list box, radio button or check box
the refresh works fine for dialog list where you are using a list of choices / formula.
the refresh doesn't work for dialog list where you are using view dialog for choices ( my case ).
Is there any solution for this issue? I want when I selected a value from the dialog list, immediately the row / line should appear/disappear.
Thank for your time!

QTreeWidget: Windows Explorer-like editing

I want to create a QTreeWidget where the items are both editable and launchable. I want it to behave like Windows Explorer:
Single click -> selection
Single click on a previously selected item -> open LineEdit to edit the name
Double click -> perform the 'launch'
So I created slots for itemClicked() and itemDoubleClicked(). The first one is the following:
def EditName(self, item, column):
if self.lastclick == item:
self.editItem(item)
self.lastclick = item
The second one just 'launches' the file.
However, this kind of solution doesn't distinguish between a double click and two consecutive clicks, so the QLineEdit still appears after a double click. Is it possible to get rid of the editor forcibly? I tried a hack solution like hiding and showing the item but it didn't work.
You just need to set flags on your QTreeWidgetItem to include the ItemIsEditable option, and set the edit triggers on the QTreeWidget for SelectedClick
def populate( self, tree ):
tree.setEditTriggers(tree.SelectedClicked)
for i in range(10):
item = QTreeWidgetItem(['Testing %02i' % i])
item.setFlags(item.flags() | item.ItemIsEditable)

Adding a drop-down menu button to a CMFCToolbar

I'm trying to add a menu to a CMFCToolbar. Following advice I found online, I'm doing it like this:
CMenu m_Menu;
m_Menu.LoadMenu(IDR_MYMENU);
m_Toolbar.ReplaceButton ( ID_DOTHISWHENCLICKED,
CMFCToolBarMenuButton( ID_DOTHISWHENCLICKED,
m_Menu,
10,
nullptr,
FALSE));
So the above gives me a button with a drop-down arrow. When I click the button, it does the action ID_DOTHISWHENCLICKED. When I click the drop-down arrow, I get a menu with one item in it. The item is the title of IDR_MYMENU and this has a sub-menu that is the menu I would like to be displayed. Something like this:
[BUTTON]
My Menu
Submenu Item 1
Submenu Item 2
Submenu Item 3
Obviously what I want to see is:
[BUTTON]
Submenu Item 1
Submenu Item 2
Submenu Item 3
So my question is.... why aren't all of the menu items in IDR_MYMENU in the menu, instead of being in a sub-menu off of it?
Thanks.
This problem is fixed simply by passing in .GetSubMenu(0)->GetSafeHmenu(), instead of the CMenu in question, when creating the menu button. Why this should be so is a complete mystery to me, and one of those MFC'isms that you know if you know.
Not sure whether to delete this question or tick it solved in case anyone else ever has this issue.

Disable a column of a QTreeWidgetItem or remove set CheckBox

I have QTreeWidgetItem set in a QTreeWidget with 2 columns. Both cells got a CheckBox set by setCheckState(...).
When the user unchecks the CheckBox in my first column I uncheck the second CheckBox in column 2.
Now, I would like to prevent the user to check this second CheckBox again. Is it possible to remove this CheckBox in column 2 or to disable only this cell?
So far I have just seen that all the flags work on the complete item and a set CheckBox won't disapear.
Btw. The items are not editable and I don't want to use a QTableWidget/-Item.
Update:
The CheckBox will be automatically inserted by Qt when I call setCheckState for the item:
QTreeWidgetItem *item = new QTreeWidgetItem(ui.TreeWidget);
item->setCheckState(0, Qt::Checked);
After the new the item does not own a CheckBox (by Qt default). Calling setCheckState(...) I automatically insert a CheckBox (here in column 0) with the Qt::CheckState I want.
But after I have done it there's no way to remove the CheckBox - so it seems.
Maybe anyone got a solution how I can get rid of this CheckBox at a later time? Any help is much appreciated!
This will do it:
item->setData(0, Qt::CheckStateRole, QVariant()); //No checkbox at all (what you wanted)
any of these others will show the checkbox space
item->setData(0, Qt::CheckStateRole, Qt::Unchecked); //Unchecked checkbox
item->setData(0, Qt::CheckStateRole, Qt::Checked); //Checked checkbox
item->setData(0, Qt::CheckStateRole, Qt::PartiallyChecked); //Partially checked checkbox (gray)
The setCheckState method can not set 'no check state', only Checked, PartiallyChecked or Unckecked.