QCombBox: How to show the the scroll-bar in dropdown list automatically - c++

Means the dropdown needs to be scrollable depending on the resolution. Don’t need to show the scroll-bar, if we have space to make the dropdown taller to show all contents.

Related

Bootstrap dropdown menu not scrollable inside ember-perfectscroll

I'm showing a few lists of items under different categories in kanban view. In each item-list, I use ember-perfectscroll to scroll through the items vertically. And in each item-card, I have bs-dropdown to select from a list of sub-categories. Everything works fine until the item-list grows bigger and needs to be scrolled.
When I want to open and scroll inside sub-categories dropdown menu, the item-list is getting scrolled instead. I'm able to scroll sub-categories menu only for the items which are at the end of the item-list.
How can I make the dropdown menu scrollable by suppressing perfect-scroll ?

Win32 (C++) :- How to make a list item collapsible

I have a listbox in which multiple list items are there. I want to implement something like if we click on the list item, it will collapse and show the summary of the clicked item:
I have been searching this on the web for quite sometime but haven't got any good solution. I am very new to Win32. Any suggestions on how to approach this like which control should I use. Any help will be appreciated.
Standard ListBox and ListView controls do not natively support expanding/collapsing items, however it is possible to implement it in a ListBox with some extra work.
Give the ListBox the LBS_OWNERDRAWVARIABLE list box style to allow the list to contain items of different heights. When a new item is added to the list, the ListBox will send a WM_MEASUREITEM message to its parent window asking for the item's initial height. Return an appropriate height based on whether the item should be displayed as collapsed or expanded.
Once an item has been added to the list, you can send the ListBox a LB_SETITEMHEIGHT message to assign a new height for that item based on whether it should now be displayed collapsed or expanded. Then invalidate the ListBox to trigger a repaint of the items.
The LBS_OWNERDRAW... styles require you to manually draw each list item whenever the ListBox sends a WM_DRAWITEM message to its parent window. You can draw the requested item on the provided HDC however you want, such as with the DrawText() function, configuring its parameters based on whether the item's text is currently being displayed as collapsed or expanded. Also use the state information provided by the message itself to configure the HDC's font and background/foreground colors as desired (particularly important when rendering items in the selected and focused states).
With that in place, all you have left to do is make your click handler determine the index of the item being clicked on (via GetMessagePos(), ScreenToClient(), and LB_ITEMFROMPOINT), and then assign it a new height based on its new expanded/collapsed state, and let the resulting repaint draw the new text accordingly.

How to change default widge styles?

I add field like
forms.ChoiceField(widget=forms.Select(choices=OPTIONS, initial=0)
when display, the normal dropdown is replaced with one with a search box on item list, I think that is Django widget?
I had to add the style to set wdith, otherwise, the dropdown will show with width 33px, way too small
But then I need embed those dropdowns into a jquery accordion. I found dropdowns in non-active section will all have width set to 0px. I guess widget set it to 0 after it detects them are hidden.
From A you can tell the dropdown has styles to make it have round corners
From B, you can see the dropdown doesn't show anything, from the html code, I see the width is set to 0px
If I don't apply the accordion, you see all three dropdowns are fine
I am looking for a way to solve this, either make widget not set width that way, or remove widget effect at all.
Any idea?
thanks

QTableWidget show scroll bar

I would like the horizontal scroll bar to appear whenever there is text eliding. Such that the user won't have to resize the whole GUI. How would I do this?
This is what I have coded:
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch);
ui->tableWidget->resizeColumnsToContents();
I also tried enabling scrollbar to appear always, but scrolling to the very right doesn't do anything.
If I set textElideMode to ElideNone , the text from the 2nd column is partially hidden and no scrollbar appears.
QHeaderView::Stretch will stretch the column width to the available space. Use QHeaderView::ResizeToContents to make the column wide enough to display the content, resulting in a horizontal scroll bar if necessary.
This will have a couple of side effects of which I'm not sure you want them.
There will probably be no more ellipsis in the elided text.
If all of the values in your Hash column are very small, then that column will be very thin, so there might be 'empty' space next to that column.

extjs grid ListFilter scroll handles (ListFilter overflow)

I have a grid with a ListFilter on one of the columns. The list of filter items is long enough that it overflows the height the pages. However I do not get scroll handles on the list like I do with the column menu.
To illustrate this:
Column menu comes standard with top and bottom scroll handles on overflow, top handle shown here:
The ListFilter menu has no scroll handle on overflow (though it will scroll with mouse wheel):
Initially, I thought this was happening because my ListFilter implementation was based off a remote data store rather than a fixed list of options (the data isn't loaded before the grid renders). I changed to a fixed list and I still dont have any handles. Has anyone implemented scroll handles on these filter lists?
Add this.self.xtype='menu'; to the constructor function inside ListMenu.js and it should work.