Qt Stylesheets: How to apply style to menus? How to remove blue tinge around QTextEdit? - qt4.7

I am trying to make the menubar a gradient black colour and that works fine, except for the menu headings.
Here's the stylesheet i'm using:
QString styleSheet = "QMenuBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray)} QStatusBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray);color:white;} ";
this->setStyleSheet(styleSheet);
How do I apply the style to the meny headings too?
There is a blue tinge all around the QTextEdit which I can't get rid of. Is there a way to set it to black?
Thanks :)

I believe that the following website is a good resource for answering your question about the QT menubar issue you are having:
http://www.trinitydesktop.org/docs/qt4/stylesheet-examples.html#customizing-qmenubar
It gives a few code samples which should fully explain what you need to know. As for the blue tinge, I do not have a good idea on how to fix it - I haven't really seen that happen.
Best of luck.

This solved the problem for me:
QMenuBar::item {
background-color: transparent;
}

You can try using QMenuBar::item{}.

for aply color to the headings:
QMenuBar::item{
background-color: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4 gray)
}
For the blue tinge all around the QTextEdit:
QTextEdit{
border: 0
`

Related

Bottom of the page footer positioning issue

I'm having a hard time figuring out how to make my footer stick to the bottom of the screen, even when the page is smaller than the screen.
www.test-domain.sk
I'm guessing it's something to do with the container length, but I'm honestly completely unsure.
Any help would be appreciated. :)
This concept is something known as a sticky footer. The Mozilla Developer Network has a page here illustrating a few ways to accomplish it. In the example of your www.test-domain.sk page, I believe you can add the following css to make your footer stick to the bottom of the viewport (screen).
html {min-height:100%)
body {100vh}
div#page {min-height:100vh; display:grid; grid-template-rows: auto 1fr auto}
Assuming you are looking for something like this, but if not, be more specific. As in post the code you already have.
footer {
position: fixed;
bottom: 0;
}

Find real (optical) center of SVG icons using SCSS mixin

So I was reading through this pretty interesting (and accurate) article on the play button never being centered optically -
https://medium.com/#erqiudao/the-play-button-is-not-optical-alignment-4cea11bda175
After reading this I wanted to try and take a stab at creating a mixin that will always find the actual center of an icon no matter the shape of it. But! It is a lot trickier than I thought it would be so came here for some help!
Oh and side note: currently I am passing all of my svg icons into a font file that has some base styles on it such as:
font-family:"IconFont";
display:inline-block;
vertical-align:middle;
line-height:1;
font-weight:normal;
font-style:normal;
speak:none;
text-decoration:inherit;
text-transform:none;
text-rendering:optimizeLegibility;
-webkit-font-smoothing:antialiased;
-moz-osx-font-smoothing:grayscale;
Any help or guidance would be highly appreciated!
Best,
Artem

JavaFX ScrollPane border and background

I'm having some problem regarding the default background and border of the ScrollPane.
Using this style made the problem clearer to see.
setStyle("-fx-background-color:blue; -fx-border-color:crimson;");
I've tried this style and got no luck only the red border gone and left me with the blue one.
setStyle("-fx-background-color:blue; -fx-background-insets:0; -fx-border-color:crimson; -fx-border-width:0; -fx-border-insets:0;");
I've looked at this old post JavaFX Hide ScrollPane gray border and http://docs.oracle.com/javafx/2/ui_controls/editor.htm
This line of code doesn't work neither
scrollPane.getStyleClass().add("noborder-scroll-pane");
Thanks
In the current version of JavaFX 8, you can use the edge-to-edge style class to remove the border entirely:
<ScrollPane styleClass="edge-to-edge"/>
I have found a solution and would liked to post it here so others won't need to waste their time find it again.
By looking at the default css of JavaFx (caspian.css) which has been extracted from the library using this command.
jar xf jfxrt.jar com/sun/javafx/scene/control/skin/caspian/caspian.css
I could see that the one I missed is
-fx-padding: 0;
So this is the css class I'm using.
.scroll-pane {
-fx-background-insets: 0;
-fx-padding: 0;
}
.scroll-pane:focused {
-fx-background-insets: 0;
}
.scroll-pane .corner {
-fx-background-insets: 0;
}
Try use this first
.scroll-pane > .viewport {
-fx-background-color: transparent;
}
Before setting the background color
There seems to be a simple solution, which is to use "-fx-background: rgb(80,80,80);", that is,
scrollPane.setStyle("-fx-background: rgb(80,80,80);");
At least this works perfectly for me, while "-fx-background-color: rgb(80,80,80);" or "-fx-control-inner-background: rgb(80,80,80);" do not work in javafx 8. "-fx-background-color: rgb(80,80,80);" did work in earlier versions of javafx.
You can use:
-fx-background-color: transparent;
-fx-control-inner-background: transparent;
If you set only -fx-background-color, you will see the color change is applied to only the ScrollPane's inner edges, and the color of the center area is still not changed.
The -fx-control-inner-background property will change the color of that center area.
Honestly, your question was not clear enough, but I am only providing this answer to help others if I can.
What is causing this problem is you have the ScrollPane and inside it something called viewport that is bound to the ScrollPane. The properties that you apply for the ScrollPane object does not apply for the viewport. If you want to apply the properties for both ONLY, not the children too, you have to use the stylesheet property, not the style property itself, which uses in-line css code. For example, if you want to make the ScrollPane transparent, you have to apply the property for both, assuming the name of file is "scrollPane.css", like so:
#mainScrollPane > .viewport {
-fx-background-color: transparent;
}
#mainScrollPane {
-fx-background-color: transparent;
}
However, you need to apply a special Id property for the ScrollPane object, so it does not apply for the children:
ScrollPane scrollPane = new ScrollPane(root);
scrollPane.setId("mainScrollPane");
scrollPane.getStyleSheets().add("scrollPane.css");
Rather than use FXML or CSS I prefer to consume the event, but this only works on the portion that has content. If your scrollPane is larger than its content you also have to fill the remaining space.
scrollPane.getContent().setOnMousePressed(Event::consume);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);

xpages views alternating row colors

I am trying to add alternating row colors in a dynamicViewControl. I found this article by Mark Hughes http://dominoextnd.blogspot.com/2009/10/xpages-alternate-view-row-colors-made.html but when I try to enter rowEven, rowOdd in the rowClasses I get an error message about invalid character (comma) I have tried all sorts of different ways without success. What am I doing wrong. I have seen it in the examples, but I cannot reproduce that
You can try to use css:
.someClass tr:nth-child(even) {
background-color: yellow;
}
Naveen's solution worked fine. I just need to get more in the habit of working in the source code rather than the GUI for alot of things. Thanks!

CKEditor remove style preview from Styles dropdown

I've been searching and searching for an answer to this problem and cannot found a solution.
I have added some custom styles to the CKEditor that add a margin-left to the selected text. The problem is that this causes the style previews to move to the right in the styles list. So much so, that they go off the right side of the dropdown. I don't quite have enough rep to post a screenshot unfortunately.
I would just like the styles in the list to have no preview at all if possible.
I have tried to add .cke_panel_listItem p {margin-left: 0px !important;} to my global.css and to the editor.css. I cannot override the inline style no matter what I do.
Any suggestions? Thanks in advance!
I was able to do this using the contentsCss config property. So:
CKEDITOR.editorConfig = function( config ) {
config.contentsCss = 'wysiwyg.css';
}
then in wysiwyg.css put your CSS code:
.cke_panel_listItem p {
margin-left: 0px !important;
}

Resources