QT combobox's item border is see throgh QAbstractItemView's radius - qt

I would like to have a rounded rectangle shape of the popup by combobox, which is easy to implement as I add a "border-radius: 20px" to QAbastractItemView.( the 20px is just for easy identification for demo)
However, I also need to have a separator line between combobox items. I use item's bottom-border style to let items look like they have separator. But as you could see in the snapshot, there will be a extra bottom border appear behind QAbastractItemView.
How can I hide this extra bottom-border ? I search Qt's documentation, QSS has no :last-child or nth-child equivalent as in CSS. And there is no sub-control like ::separator, so I cannot sytle the separator.
Could anyone has some clue ? Thank you.

Related

Gtk inspector cant find part of widget

I'm working on a Gtk3 theme using css. I want to style a dialog so I used gtkinspector to check what widgets are inside there. Works well, the inspector recognizes the dialog. But it is apparently unable to identify a border sitting around the dialog. (See image below).
The border around the entire widget doesnt get hilighted by the inspector. .. so what does this consist of?
This is reflected in the css: if I put something like dialog * {green} in the css, everything colors green, except for the border. If I put .background {green} then the border also colors green....
I tried to find 'padding' 'margin' and 'border' entries that could be causing the border, but cant seem to find any....Any ideas?
Without code or a glade file one can't say for sure which properties are being used to add that border.
The border itself isn't a widget but a GtkContainer property. So you must look to the parent, GtkDialog, for the correct properties being used. Most probably its the empty border around the container child (see GtkContainer "border-width") but could be alignment or padding.
If your goal is to change the color of the background color then you should change it via GtkDialog.

QT Tab bar's top highlight with stylesheet

I have a problem when trying to change the color of QTabBar's top line (blue line in the picture below).
Is this a separate part of tabBar (like scroller or tear) or its top border ? And how can I change its color with styleSheet and leave the other parts of tabBar unchanged?
P.S. : My tabBar::styleSheet returns an empty string, so I can't get current style and make changes in it.
If you're using a "system" style, you may not be able to change the color of the line (cause representation of UI elements is not handled by Qt but by the system).
You should define a complete style for QTabBar (and maybe QTabWidget too) that you can customize as you wish.
See the Qt Style Sheets Examples page.
Problem solved:
setStyleSheet("QTabBar::tab:selected { selection-background-color: red; }");

Flex ComboBox - Removing Borders

Does anyone know how to remove the small border around the combobox?
In a Flex3 Combobox (Halo Theme) there is this little gray border at the left, right, and bottom edges. I want to remove those borders so that the button part of the combobox doesn't have any border at all. Instead, I just want the top border.
Any ideas how it can be done?
Thanks.
I think you have to replace the Class that's used by default in the skin css property with one of your own. The docs say that is defined in ComboBase, so you'll need to look there to see what the Class is there and if you can extend or even do away with it (by setting skin to an empty ClassReference).

In flex how can someone add both bold and border?

I am trying to make a text area in flex 4.5. The problem is i need some part of it as bold not all. Also i need border.
A simple code is
<s:TextArea text="Text here1 Text here2">
By default s:TextArea contain border but I cant bold only one part of text that is "text here1"
If I try to use mx:TextArea Then I cant add border to it.
Please if anyone can help over how to add border along with if i can make only a part of text as bold or of different color etc.
Why can't you add a border to mxTextArea? There are a couple of ways:
specify borderStyle css property;
write a skin class, which draws a border and background you need, and assign it to borderSkin css property;
draw a 3x3 graphic skin and assign it to borderSkin css property.
Place a border container around the control
Use the textFlow property instead of the text property and you will be able to use rich text (bold, italics and so on).
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/elements/TextFlow.html

Change checkbox position for a QCheckBox

I have a QCheckbox in a grid layout defined as such:
self.isSubfactorCheckbox = QtGui.QCheckBox('Is &subfactor', self)
By default the checkbox is to the left of the "Is subfactor" text. I wish to move it to the right of the text.
I've tried playing around with subcontrol-position but to no avail.
self.isSubfactorCheckbox.setStyleSheet('QCheckBox::indicator{subcontrol-origin: content; subcontrol-position: top right;}')
This moves the checkbox to the right (it's still on the left of the text) but it pushes the text to the right and out of the window's edge.
This didn't help to move the text to the right:
self.isSubfactorCheckbox.setStyleSheet('QCheckBox::text{subcontrol-origin: content; subcontrol-position: top left; }')
A solution would be creating a QLabel and adding the checkbox on its right but I don't haven't found a way to underline letters in a QLabel so that the user will know which is the shortcut key. I've tried prefixing letters with & or wrapping them in <u> </u> tags.
I'd still prefer to use only a QLabel, but how would I switch the checkbox to the right of the text without the text getting pushed out.
Even easier...
Use the QWidget.setLayoutDirection method and set it RightToLeft vs. LeftToRight
You can do this in Designer or through code, it is a property or all widgets.
Use the buddy mechanism. Set the QCheckBox to the buddy of the QLabel. After that prefix & will underline the shortcut character in the label. See the documentation of the QLabel's setBuddy.

Resources