How to change default widge styles? - django

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

Related

Sitecore: Editing font and font color of a slide title

I have a Carousel on a page with some slides.
The author can edit the slide's content in the experience editor. i.e. He can change the text and the background image.
However, he cannot change the font color through the editor. So the default font-color in the css class, applied to the title field is white. If the author uses an image with a white background, the text is barely visible.
How could I allow the author to change the font color in the experience editor for the slide's title field?
Maybe allow him to choose from a variant of the title field with a different css class? Except, I don't know how to create a variant for the title field.
You have few options here:
Edit the text using Rich Text field edit fame buttons:
Rendering Variants are using default Sitecore field renderers so those edit frame buttons come from Sitecore - we are not customizing those.
Change style of the Page Content which is by default in each Carousel slide. In that way, you can also easily change font colour. You can also use edit frame button but this time on the Carousel itself:
Change style of the whole Carousel - the same approach as above but not for the Page Content but for whole Carousel.
Carousel Slide by default contains Page Content inside which is using variant configured to display fields from carousel slide. You can of course easily change the variant and display whatever you want.
If you need more information's about rendering variants take a look here

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

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.

How to add QMenus or Qactions on a Widget like QlistWidget area as a list item?

Is there any way to add QActions as a list item on QListWidget?
I want to make a customization window which will show list of actions on a widget for move up, move down, Rename and other options. I'd like to display it on the widget same as it appears as a context menu.
I tried adding it as a list item with icon and text, but the look it not very good:
i) list items with blank icon are not aligning properly, even after adding a blank icon of size 16*16 is not taking up any space and text with icons & w/o icon are not aligning.
ii) I'm unable to add right-pointing black triangle at the right most, in-case of sub-menus cause somehow unicode character for this is not getting displayed on my Linux machine.
That's why I want to add QActions as it are getting popped at original place.
Any suggestions?
Yes I have a suggestion : do not try to make fancy widgets like this, users will not find it intuitive
You should find another way to implement this.
Imo, something like a QToolButton with a QToolButton::MenuButtonPopup popup mode will do the trick. This way, you can embed menu and sub-menus in a widget, using QToolButton::setMenu().

Wrong stem position in balloon-style tooltips in report list-view

I'd like to change the default style of the list-view control's tooltips to balloon.
I first called ListView_GetToolTips() to get the HWND of the list-view's tooltips control, and then used GetWindowLongPtr()/SetWindowLongPtr() to add the TTS_BALLOON style.
I handle LVN_GETINFOTIP to customize the tooltip for the items (first column) in the list-view: the tooltip texts that appear for the first column items are actually a copy of the text of the third column. The other columns (subitems) are managed automatically by the list-view.
The balloon-style tooltips for the first column items seem OK; their stems are correctly positioned:
But the tooltips for the second column seem drawn wrongly, e.g. the balloon is drawn as if it was referred to a subitem in a row below the actual row pointed by the mouse cursor.
In the following picture, the "star" indicates the position in which the mouse cursor was when the tooltip appeared, but the tooltip's stem points to a row below, marked with an ellipse:
The strange thing is that the tooltips for the third column seem drawn correctly.
Is this a bug in the list-view control? (I'm using Windows 7.)
Or what am I missing here?
The ListView uses a tracking tooltip and positions it to unfold and reveal the hidden text in a column that's too small. It's not expecting its tooltip to be a balloon and so doesn't compensate for that.
You'd need to sub-class the tooltip itself, watch for TTM_TRACKPOSITION messages from the ListView, and adjust the coordinates.
Your second question - the shaded background comes from the system theme. You should be able to get it by calling SetWindowTheme on the tooltip (I'm not sure why the ListView disables themes for the tip).

Listview tristate checkbox

I have a listview in report style with checkboxes.
Is there any easy way to make the check box appear disabled? To give it a tristate sort of effect?
I want to have 3 states: Enabled, Disabled, and Unset.
The standard LVS_CHECKBOXES style does not support tri-state checkboxes. However, LVS_CHECKBOXES is internally implemented as a ListView-managed ImageList and normal ListView state indexes, so you can simply assign your own ImageList to the ListView, put three checkbox images into it, and set each ListView item's state index as needed. Then you just need to handle mouse messages for the ListView to switch between state indexes when clicking on an item's state image.