Is there a way to not display empty TreeCells in JavaFX? - javafx

My TreeView is displayed even though there are no TreeItems in it. Is there any way to not display the TreeCells before they actually have a corresponding TreeItem to display?
This is how it looks without any items:
This is how it looks when one item is added to the root:
Thanks for any suggestions :)

I think you can not prevent empty TreeCells being added to the TreeView, but if all you care about is appearance, you can define different style for empty cells. Empty cells have the :empty pseudo class, which you can use in your CSS:
.tree-cell:empty {
-fx-background-color: transparent;
}

Related

How to style the items in PrimeVue's Dataview differently in List and Grid mode?

When switching from list to grid mode in PrimeVue's DataView, the following changes happen in the DOM:
I don't understand why in both display modes, the direct parent of the items to be displayed in the Dataview is a grid. Only the grandparent div changes its class.
In List mode I would like to use a different flex display than in Grid mode. How can I achieve this? 🤔
All right, I found a working solution:
.p-dataview-list :deep( .p-grid) {
// my stlye
}
In my previous attempts, I was using deep() the wrong way.

Issue with displaying the text colors of the items inside QCombobox

I have a QCombobox, consists of 3 or 4 items.
Whenever,I try to select an item from my QCombobox, the color of the item changes to black(is not at all visible clearly).When I move my cursor away from the Dialog UI, then the color of the item changes to white (and is now clearly visible).
I think the problem lies with my QCombobox focus, but still not sure if I need to take care of it while adding the items inside my QCombobox.
Can someone explain the method, so that text of the items inside my QCombobox are clearly visible always?
Look for any stylesheets added for the combobox.
Also you can look for "setItemdata" function and anything is done with respect colors (backgroundrole).
Or if it is tough to figure out and wasting time, after adding your combobox items, change the background color of items to your convenience (Red in below code is just an example).
ui->comboBox->addItems({"text1","text2","text3","text4"});
ui->comboBox->setStyleSheet("QAbstractItemView { selection-background-color: red; }");

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.

p:selectCheckboxMenu highlight list item when mouse is over an item

I know p:selectCheckboxMenu has all its style classes, but i want to change something.
I would want that when i open the menu and move with the mouse over an item, it will be highlighted in blue. I want it to be highlighted only when the mouse is over that item.
i think that the css class i need to override is : .ui-selectcheckboxmenu-item which means
Each options in the collection.
(from the primefaces 5.0 documentation)
I am kind of a novice in css....any suggestions?
You can use the :hover pseudo-selector.
If .ui-selectcheckboxmenu-item select the elements that you want to highlight, then with this code should work:
.ui-selectcheckboxmenu-item:hover{
background-color: blue;
}

Tree Parent child hierarchy Hiding

I want to implement tree widget but it doesn't have to show the hierarchy line.
Please help on this.
(Hierarchy means the line between parent and child.)
Use QSS styles - assign empty image to lines...
QTreeView::branch
{
border-image: none;
image: url(:/style/blankImage.png);
}
if lines are still exists after that- create png with one transparent pixel and assign it to TreeView's branch, i haven't checked variant with no image at all.

Resources