How to make all tabs in QTabBar not been selected? - qt

How to make all tabs in QTabBar not been selected?
Thank you.

#ilyabvt at forum.crossplatform.ru suggested to create first fake tab and use Qt Style Sheets to make it's width = 0:
QTabBar::tab:first {
max-width: 0px;
}
This approach works fine with QTabBar integrated in QTabWidget. But unfortunately doesn't work with single QTabBar (look the screenshot below). Maybe it is my fault, but i cant find out where the mistake.

I think it's supposed to be like radio buttons, i.e. there is always one selected. If none of the tabs are active perhaps the whole bar should be disabled.

Related

GTK+3 Treeview expander not visible

I built a GUI with a treeview based on GTK+3. The tree view does currently not show the expander of the treeview. However, I can see that there is some space reserved for the expander as the indentation of the rows is larger if there is one element with a 'subcategory'.
In addition, I figured out, that the expander is shown if I use another GTK style.
Therefore, I tried to change to color of the expander, but it has no effect:
*.view { background-color: ... } changes the background color of the 'buttons' in the tree view. However, the expander is still not visible.
treeview.view.expander { color: ...} does not have any effect at all.
Now, my assumption is that the expander is hidden or has some transparency, but I could not find any option to change it.
Do you have any documentation links that explains exactly which CSS option does have an influence on the treeview or its expander or a hint what could be wrong in the CSS file?
Thanks!
I figured out what the problem is: I am missing the icon used by the treeview expander in /usr/share/icons.
The problem is solved by adding the icons specified in .expander { -gtk-icon-source: -gtk-icontheme("icon"); } to the icon sources in /usr/share/icons or /~.icons.

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; }");

Subclassing QMessageBox

I need to customize QMessageBox. I need to remove the frame and title bar and add my own title bar and close button. Also need to replace the standard buttons and probably redo the background color of the box.
Is it possible to subclass it and achieve the above? is there any example anywhere for this? Or, should I just subclass Dialog and create my own message box?
This tutorial on custom windows might help you. It's in French but the code examples are in English, it shows how to compose your own title bar, create a window and attach the new title bar on it. I've been through it before, it's pretty straightforward once you've done it.
There is no need to subclass QMessageBox or QDialog. You can pass a QMessageBox the parameter Qt::FramelessWindowHint to remove the frame and buttons. You can also use Qt Style Sheets to style the background of the QMessageBox as well as the buttons. Something like this should work:
msgBox->setStyleSheet("QDialog {background-color: red;}"
"QPushButton {background-color: blue;}")
I haven't tested this but it should work or be pretty close.

adobe flex datagrid selectable columns

I'm trying to make a Flex (Advanced)DataGrid component with some mechanism where the user can toggle the visibility of the columns. I've crudely implemented this by reading in the columns into the right-click menu, and when a column name is selected here, the visibility is toggled. It works, but it's not the most elegant solution.
Specifically, I'm trying to emulate the "datagrid" that Mozilla Thunderbird uses to display emails. Here is an image:
In the upper right, there is an icon over the scroll bar. If there is no scrollbar, the icon remains in the same place. When clicking the icon, it opens up a menu that shows all the possible columns, with the visible ones having a check mark next to them, like this:
Also, the scroll bar always appears under this button, never "pushing" it over into it's own column.
I'd like to re-create this in Flex. I believe the menu part and creating a column with a button headerRenderer is easy enough. But I can't figure out how (if at all possible) to do this with the scrollbar, because the scrollbar always seems to be "its own column". Any ideas or help would be appreciated. Thank you.
Ian
One dirty solution comes to mind. Create a component based on Canvas, then add an AdvancedDataGrid by overriding createChildren. Override updateDisplayList as well and add a button like the one in Thunderbird to the upper right of the Canvas. This will cause the button to appear over the DataGrid. Problemo solved?

Flex LinkBar: how to set a selected button's background color?

I was able to set the text color of a selected LinkBar button by "disabledColor" style of LinkBar. Accordingly, I expect to set the background color of the selected button by "backgroundDisabledColor" style, however, it didn't work; and except "backgroundDisabledColor", I didn't see any other style that could possibly achieve this. Please help. Thanks.
The problem is probably that you're setting the style on the LinkBar itself - try setting the LinkBar's linkButtonStyleName style to a different style selector that contains all of the styles you need for your button. You should be able to set the fillColors style of the buttons themselves there - this will change the default look of the button.
If you need to adjust the "selected" color or if you need something more advanced than just skinning the button background you'll need to write a custom skin class. This isn't too difficult - the Button class has a whole set of "Selected" styles - selectedDownSkin, selectedUpSkin, selectedDisabledSkin, etc. IMO the best practice is to set your button skin to a custom skin class that sets the different individual styles based on state.
David Flately illustrates this method here. Check out his source - that should get you what you need. A good book on this topic that has this sort of thing along with lots of other examples is Juan Sanchez and Andy McIntosh's Creating Visual Experiences with Flex 3.0. I can't post a link to it because my reputation isn't high enough here yet, but you can find it on amazon or barnes and noble or any other online bookstore.
FYI - answer here....
http://dezeloper.wordpress.com/2010/02/24/flex-css-linkbar-togglebuttonbar-selected-text-color/
Haha, was looking for same thing, you can see on the source code of LinkBar:
// Hilite the new selection.
child = Button(getChildAt(selectedIndex));
child.enabled = false;
Which is clever!!! Rather than set selected to true, they disable the selected button ... why not ;-( Took me half an hour to understand the Flex team logical ...
eBuildy, Flex Specialists

Resources