Setting QDockWidget::title StyleSheet - qt

My initial problem was to make QDockWidget title bold.
I tried this and it worked:
myDock->setStyleSheet("QDockWidget { font: bold }");
But I can't understand why the following code doesn't work:
myDock->setStyleSheet("QDockWidget::title { font: bold }";
Even if I use more complicated style sheet, every parameter of it has effect except for font: bold:
myDock->setStyleSheet("QDockWidget::title { font: bold;
text-align: left;
background: red;
padding-left: 30px; }");
What is the problem with QDockWidget::title font?

First of all, I dont know why the font does not work, I can only quess.
I have a felling that the default title bar is similar to window titlebar which is almost impossible to style.
I was searching through source code which widget is used for title bar but found nothing.. Here is some code, good luck.
I think that the style sheet does not support font changes. By default for everything derived from QWidget applies that parameters like background etc will allways work. Other stuff like font may or may not be implemented.
But why wont you make custom title bar? It can be anything bundled in QWidget.
QLabel *label = new QLabel("Header Text", myDock);
label->setStyleSheet("color: orange; font-size: 14pt; font-weight: bold;");
myDock->setWidget(bodyWidget);
myDock->setTitleBarWidget(label);
I've tested with Qt 5.3 it works, although there are missing buttons like close or undock :-/
I think that you can create them (with push button or so) and bundle everything in one widget, then set it with setTitleBarWidget and connect some signals.
There is at least hide() slot for close button and you may have to code slot for float using setFloat.

QDockWidget *dock = new QDockWidget();
QFont curFont = dock->font();
curFont.setBold(true);
dock->setFont(curFont);

Specify it like this way
MyDock->setStyleSheet("QDockWidget::title { font: 75 11pt "Ubuntu";}");
where 75 is the parameter for bold, 11pt the size of your font and "Ubuntu" the type of your font.

You're missing a semicolon (and a closing bracket?).
myDock->setStyleSheet("QDockWidget::title { font: bold; }");

Related

How to change the font of a form created in typo3 8.7?

Im absolutely new to typo3 and want to set up a simple contact form. So I created a form and added it to the page. My template record looks like this:
page = PAGE
page.typeNum = 0
page.10 < styles.content.get
page.includeCSS {
file1 = fileadmin/templates/css/style.css
}
I can see the form and it works appropriately, but unfortunately my css doesnt do anything.
My style.css looks like this:
p {
font-family: arial;
font-size: 120px;
}
Gotta admit i have no knowledge about CSS too. The changes I made had absolutely no impact on my page. Do these infos help you by any chance? I just have no idea how to fix it on my own, been searching for a solution all day long.
you should learn more about the structure of CSS-files. maybe you inspect some with your browser from other sites.
Then you will notice it is something like:
p {
font-family: arial;
}
For file pathes in typoscript or objects and attributes: don't insert spaces:
:
page.10 < styles.content.get
page.includeCSS {
file1 = fileadmin/templates/css/style.css
}
Your style.css should only contain this:
p {
font-family: arial;
font-size: 120px;
}
... and you'll see the difference ;)
Probably only a copy&paste error, but your TypoScript (aka template record) has spaces where it shouldn't:
...
file1 = fileadmin/templates/css/style.css
...
120px will result in a really big font ;-)
Set the style-definition to the body-tag (so for all elements below the body), not only for the p.
body {
font-family: Arial, sans-serif;
font-size: 12px;
}
You should define the styling of the input fields seperately. With some browsers the inheritance from the body tag definitions seem not to work.
input, textarea { font-size:1.25em; font-family:serif; border:1px solid darkgray; }
Something like that.

Remove embedded stylesheet for Gutenberg editor on the back end

The Gutenberg editor comes with an embedded stylesheet. Here's a snippet from that stylesheet:
...
.editor-styles-wrapper {
font-family: "Noto Serif", serif;
font-size: 16px;
line-height: 1.8;
color: #191e23;
}
.editor-styles-wrapper p {
font-size: 16px;
line-height: 1.8;
}
...
I've enqueued my own editor stylesheet using the following:
add_action("enqueue_block_editor_assets", "enqueue_custom_block_editor_assets");
function enqueue_custom_block_editor_assets() {
wp_enqueue_style("editor-style", get_stylesheet_directory_uri()."/editor-style.css", null, null);
}
Since I have my own editor stylehseet, I'd like to get rid of the default one. A search on this topic yields lots of results for removing default block styling on the front end, but I'm referring to the editor styling on the back end. Thanks for your help!
I drilled down into how it was being injected and found a way to nuke it out via the block_editor_settings filter. There is a styles key with an array that contains the css. The only iffy thing about this for me is that I'm assuming the shape of the array will always be the same, I should be doing some type of check here.
add_filter( 'block_editor_settings' , 'remove_guten_wrapper_styles' );
public function remove_guten_wrapper_styles( $settings ) {
unset($settings['styles'][0]);
return $settings;
}
My solution was a workaround to automatically override any styles within the .editor-styles-wrapper. Using LESS:
editor-style.css
.editor-styles-wrapper {
#import "style.less";
}
I would still love to disable that embedded stylesheet though, if anyone knows how to do that.

javafx + controlsfx glyphicon - unexpected behaviour when .text is set to font-weight: bold

I am using JavaFX with ControlsFX Glyph icons and fontawesome.
It works nicely with the default JavaFX Modena theme.
But when I add the yellowOnBlack CSS for high contrast, the icons turns to weird font shapes.
The Glyph source code explicitly sets the font family which I am passing "FontAwesome". Its sets thru Label.setFontFamily().
The control looks like this on Modena:
ToggleButton[id=btnHamburger, styleClass=toggle-button]''
Glyph#72cc2cbd[styleClass=label glyph-font]''
Text[text="", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=FontAwesome, family=FontAwesome, style=Regular, size=14.0], fontSmoothingType=LCD, fill=0x333333ff]
When I add the yellowOnBlack it looks like this:
ToggleButton[id=btnHamburger, styleClass=toggle-button]''
Glyph#3bd84c6d[styleClass=label glyph-font]''
Text[text="", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=12.0], fontSmoothingType=LCD, fill=0xffff00ff]
It is overriding the font-family, which is weird because it was set thru the .setFontFamily().
That's because yellowOnBlack sets this CSS:
.text,
.text-input {
-fx-font-weight: bold;
}
It works if i do this:
.glyph-font .text {
-fx-font-weight: normal;
-fx-font-family: "FontAwesome";
}
But I cannot fix the -fx-font-family to "FontAwesome" because it's optional on the Glyph constructor.
Any alternative ideas to fix it?
Thanks.
I recently stumbled over the same problem. In my case it was enough to remove the "label" style class from the Glyph object:
glyph.getStyleClass().remove("label");
As a consequence, none of my style rules, in which some font property was set, were applied to the glyph resulting in the correct rendering of the icon.
I have created a subclass and overriden the setFontFamily():
#Override
public void setFontFamily(String family) {
setStyle(String.format("-fx-font-family: \"%s\"", family));
}
It worked. Not the best solution tho.

change background color of GtkTextView (GTK 3.22) using CSS

I would like to change (on Linux/Debian/Sid/x86-64, GTK 3.22) the default background color (for untagged text) in a GtkTextView (or else its GtkTextBuffer).
This and that answers don't help (are obsolete).
In my bismon program (see this question for details) I tried, on some global extern GtkWidget *commandview_BM; initialized with:
commandview_BM = gtk_text_view_new_with_buffer (commandbuf_BM);
gtk_widget_set_name (commandview_BM, "commandview");
To use
#commandview {
background-color: seashell;
font-size: 18px;
font-family: Inconsolata;
}
in my bismon.css file, but that does not work. Replacing #commandview by #commandview.text or #commandview.view don't change anything.
I would also be happy if some default tag existed in GtkTextBuffer-s, but this does not seem to be the case.
I have (at least) two textviews in the same window (one for commands; another for logging) and I would like them to have different background colors.
The working syntax in CSS file is with a space to separate the name from the class, so in my case:
#commandview text {
background-color: seashell;
font-size: 19px;
font-family: Inconsolata;
}

Not able to change SuperTabNavigator tab text's font

I'm struggling with SuperTabNavigator coz I'm not able to change the tab text's font.
My font is a OTF embedded in the application via #face-font syntax in my style sheet, and I have used this successfully in other places e.g. spark label.
Then I have defined a style for the SuperTabNavigator referencing the aformentioned font both in term of fontStyle and fontFamily.
No result achieved.
Could you please provide the correct way to change tab text's font in the SuperTabNavigator component?
Thanks in advance
Best Regards
Try to modify CSS the SuperTabNavigation
#font-face {
src:url("./fonts/YOURFONT.TTF");
fontFamily: myFont;
}
#font-face {
src:url("./fonts/YOURFONT.TTF");
fontWeight: bold;
fontFamily: myFont;
}
SuperTabNavigator {
popupButtonStyleName: "popupButton";
tabStyleName: "firefoxLikeTabs";
leftButtonStyleName: "leftButton";
rightButtonStyleName: "rightButton";
buttonWidth:20px;
font-family: "myFont";
font-size: 11;
}

Resources