I have a vbox, where I'm putting some hyperlinks.
Hyperlink clickableString;
clickableString = new Hyperlink();
clickableString.setStyle("-fx-text-fill: black;-fx-padding: 0; -fx-line-spacing: 0em;"); //set the hyperlink to black.
clickableString.setLineSpacing(0);
clickableString.setText("This is a test");
myVBox.getChildren().add(clickableString);
clickableString = new Hyperlink();
clickableString.setStyle("-fx-text-fill: black;-fx-padding: 0; -fx-line-spacing: 0em;"); //set the hyperlink to black.
clickableString.setLineSpacing(0);
clickableString.setText("This is a test");
myVBox.getChildren().add(clickableString);
I'm trying to get the spacing between the characters as small as possible, so that I can fit as many rows as possible. As it is, the space between the lines is about half a character tall. Does anyone know how to fine tune this?
Is it possible that the font itself is taking up the white space, and therefore, I can't remove the white space? Or is there some kind of padding that I can change?
Men,
I was looking into the same thing, but "-fx-line-spacing" does not appear in the official JavaFX CSS documentation.
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html
Edit -
But testing it worked. In my case I had to put a negative number to get the lines closer to each other.
Related
I am working with Qt to create a GUI for a small game theory project I'm working on. I'm using a combobox as a selector for the team. I can align the contents in the dropdown window just fine, e.g.
for(int i = 0; i < ui.comboBox->count(); i++)
{
ui.comboBox->setItemData(i, Qt::AlignLeft, Qt::TextAlignmentRole);
}
I can't figure out how to align the top item that is selected, as you can see here. The contents is not aligned to the left and the name even goes off the screen. Does anyone know how I can align this similarly to the contents in the dropdown list?
I already searched online, but I'm having trouble phrasing the question correctly. Furthermore if I go through the options available to me by the autocompleter when typing ui.combobox-> I don't really see an option that can do what I want.
Not sure if this is the go to fix, but I solved it by setting an icon size for the combobox. What I think goes wrong is that there is probably some default size set, no matter the size of the icons when adding items. My icons were of size 50x15 and so I added the following lines:
QSize size(50, 15);
ui.comboBox->setIconSize(size);
Now it is done correctly and gives the correct view.
I'm hand-coding an FXML file and the CheckMenuItem's little box is invisible when deselected. For the longest time I thought the CheckMenuItem tag wasn't working because there wasn't a white square just empty space. I'm assuming there is a CSS way to fix this but I can't find how anywhere.
When I use a datatable and start shrinking my browser window, the datatable has a weird behavior. The center part (where the data is), doesn't shrink but the paginator does.
Here are some pics about the problem.
Thanks in advance.
It's because it can't break up the titles in your table header. If you would place spaces in between instead of using capital letters, it would break the title up and divide it over multiple lines.
If you don't have access to the table header's name (or the ability to change it), take a look at the word-wrap-property in CSS.
I was playing with the Config Dialog Example, all was fine. Then I changed something in the right part of the dialog.
Then I found the contentsWidget (QListWidget) in the left part of the dialog became smaller and showed the scroll bars (both Horizontal and Vertical).
I want the QListWidget to show all its content so that no scroll bars are needed.
All items are added at the beginning and fixed. No dynamic.
I guess there is a simply method to let the QListWidget expand to show all its content at the beginning.
Could anyone help me and tell me the magic word?
Here is the code:
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128);
contentsWidget->setSpacing(12);
//contentsWidget->setMinimumWidth(contentsWidget->sizeHintForColumn(0));
//contentsWidget->setMaximumWidth(contentsWidget->sizeHintForColumn(0));
//contentsWidget->adjustSize();
//qDebug()<<contentsWidget->sizeHintForColumn(0);
createIcons();
contentsWidget->setCurrentRow(0);
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(contentsWidget);
horizontalLayout->addWidget(pagesWidget, 1);
I tried contentsWidget->sizeHintForColumn(0), but it didn't work. It was 0. I tried some other methods but nothing worked.
I think you should try:
contentsWidget->setMinimumWidth(128);
This will ensure that no matters what, the size of contentsWidget will always be at least 128, hence large enough to contains the icons.
I have a handful of sprites that I am attempting to group together via addChild().
Here is some pseudo-code demonstrating what I would like to accomplish:
import nav.text.TextSprite;
spr1:Sprite = new Sprite();
spr1.graphics.clear();
spr1.graphics.beginFill(0x000000);
spr1.graphics.drawRect(0,0,100,100);
txt1:TextSprite = new TextSprite;
txt1.text = "hello";
spr1.addChild(txt1);
//this is what isn't working: the sprite is hidden but not the text
spr1.alpha = 0.0;
For some reason I cannot seem to get the TextSprite to draw correctly... All it is is a Sprite with a TextField added to it. I think everything is working there, but I might have something wrong w/r/t making sure all of TextSprites children are grouped correctly.
I should mention that it does position correctly; but the alpha property won't respond in the way I would expect it to. I.E., the sprite that the TextField is attached to will allow it's alpha to be set but the text remains visible.
Any thoughts?
Most likely you just need to embed the font in your textfield. Try changing the x, y of spr1 and see if txt1 moves along with it. If it truly is a child then it will respond to the new position.
You need to embed the font using textfield.embedFonts = true. If your text is disappearing when you do this, how are you going about embedding the font (using the Flex embed meta tag or using the Flash IDE?), check that you are not changing the font weight (setting the text to bold when you have only embedded the normal weight font) and if you are using a text format, be sure to apply the text format AFTER you set the textfield.text property. You can get around this by using textfield.defaultTextFormat.