I know you can set a dropshadow in the CSS with:
-fx-effect: dropshadow( gaussian , rgba(255,255,255,0.5) , 0,0,0,1 );
but i wonder how do I set a gaussian blur in the CSS?
According to the JavaFX CSS Reference Guide JavaFX only supports setting a DropShadow or InnerShadow from CSS.
JavaFX CSS currently supports the DropShadow and InnerShadow effects from the JavaFX platform. See the class documentation in javafx.scene.effect for further details about the semantics of the various effect parameters.
Related
I am using QML component WebEngineView, It has been observed that, scrollbar is by default implemented in WebEngineView, but there is no interface to change the width of scrollbar. This is required in my use case where I cannot use swipe, I can use only mouse drag operation on scrollbar of the WebEngineView in order to view all hidden part of the web content where length is outside the view port area. Since Scrollbar size of WebEngineView( default is very small 15pix )its quite difficult to drag exactly on the area and drag using mouse.
Can Some one suggest how to customize the scrollbar of WebEngineView?
or
I can find webengine source code, then modify and build for the purpose?
or
Any Style Can apply on WebEngineView ?
I am using Qt 5.6.2
Qt Webengine Source code Observation:
QML Webengineview is not set any scrollbar width internally, instead it uses back-end scrollbar probably of chrome’s.
WebEngineView uses the scrollbar that comes from the Chromium backend and there is no QML or C++ API to customize it directly. However WebEngine supports to change these scrollbar styles in CSS, so the only thing you can do is to install a user script which applies a bigger width on all -webkit-scrollbar.
See this related example: http://doc.qt.io/qt-5.10/qtwebengine-webenginewidgets-stylesheetbrowser-example.html
And your stylesheet could look like this:
::-webkit-scrollbar {
width: 40px;
}
I have a button in javafx and its pseudoclass .button:pressed is supposed to have a drop and an inner shadow. What I'm trying is
.button:pressed {
-fx-effect: dropshadow( gaussian , rgba(0,0,0,0.7) , 10,0,0,1 );
-fx-effect: innershadow( gaussian , rgba(0,0,0,0.7) , 20,0,0,0 );
}
However, only the second effect seems to be applied to the button (actually, the effect whichever comes second will be applied). I've looked here: http://www.canoo.com/blog/2012/07/10/javafx-recipes-css-vs-code/?lang=de, but I don't see a difference to my approach.
Is there a way to apply two shadows to one button?
Thank you.
It's currently not possible in Java 7 nor in Java 8 to chain effects or apply multiple effects via CSS. See the Oracle CSS Documentation.
The site you reference mentions it as well:
Well at the moment it is not possible to chain effects in CSS which
means we only could apply one of the needed effects which would lead
to the following result for the code above…
Can't mix types (drop & inner), not even comma separated... I've tried, sorry.
Im not sure if I get the Key of your Question.
The commants looks obviously right ...
Might it depends on the given dropshadow parameters.
To understand the parameters you can use the oracle-documentation.
To find another rgba color you can use these rgba color chooser tool.
Even If I havent a directly awnser for you, I hope the links help you to get a better overview about the css comment dropshadow.
cheerse
Tobi
How to implement smooth transition effects while opening one Window from another using QT.
By smooth transition, I meant effects like we see in Iphones/Windows Metros etc.
Please suggest some libraries or how to implement this.
Thanks in advance.
You can try QPropertyAnimation Class and try animating opacity, size etc.
I've looked into the documentation for Qt Style Sheets and found out I could change the background colour of my widgets and even set transparency.
Here is code snippet that should---according to me---work:
application = QtGui.QApplication(sys.argv)
application.setStyleSheet(QtCore.QString('MainWindow {background-color: rgba(20, 0, 0, 75%)}'))
And indeed it works to the extent the background colour of the window is changed to the corresponding RGB values. However, as far as I can tell, the alpha value has no effect on my application.
EDIT: I realise the alpha channel is working now, only the application's background or canvas (I'm not sure how I should call it) is black. I need to make that transparent, not the main widget. How can I achieve this?
NB: I'm running on Ubuntu 11.04 with Gnome (but should that matter?).
I've found one answer elsewhere on SO but tags hadn't led met to it in the first place. So I'm going to answer my own question here:
The Qt Style Sheet will provide transparency for widgets only, but those are painted on black canvas. In order to make this canvas transparent, an attribute of the main widget should be changed like so:
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
This however provides a radical solution only: the entire window is transparent, but there is no way to set partial transparency like this. So I'm not entirely satisfied with this answer.
I also have problems with this code widget.setStyleSheet("background-color: rgba(20, 0, 0, 75%);"), but when I change to something like this widget.setStyleSheet("background-color: rgba(255, 0, 0, 75%);") it worked.
For widgets with parents (as in you case) you can use setMask and provide a mask with an alpha channel. Its particulary usefull for widgets with irregular shapes.
I have some CSS for displaying a reflection on an element which uses -webkit-gradient to fade out:
.foo { -webkit-box-reflect: below 0 -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(rgba(255, 255, 255, 0.5)), color-stop(0.7, transparent)); }
On browsers which support -webkit-box-reflect such as chrome, this displays a reflection of the element which gradually fades out as expected.
On browsers which don't support it at all, no reflection is show.
However, on Android's browser, a reflection is shown, but doesn't fade out.
Is there any way of getting Android to either:
fade out the reflection, or
not show the reflection at all.
I know I could use javascript to detect the browser and change the style accordingly, but I'd much prefer a CSS-only solution.
Without an example file or link, it is a little difficult to see what you need.
I also played with some reflection stuff a few months ago and didn't find anything that could do what you describe. I have some steps to get you what you want, outside of code. I recommend the item you wish to reflect be a PNG on a transparent background, to start.
The steps:
1.Take the image into your favorite image manipulation program (ex. Photoshop)
Double or extend the image canvas the necessary amount to include the reflection in the appropriate direction
Duplicate the layer (Photoshop-Layer/Duplicate Layer)
Reflect the image. (Photoshop-Layer/Image Rotation/Flip Canvas (your direction))
Move the duplicated layer such that it appears as a mirror using the Move tool
Select the Marquis tool, and set the edge blur to about 50% of your original image width.
Drag your cursor over the "reflected" layer, don't worry if it says the selection lines won't be visible, unless it says nothing was selected. If it says nothing was selected, reduce your edge blur to about 25% and try again.
Once you have a selection, be it visible or not, delete the selected area. This should give you a "reflected" look.
If desired, add a background on a layer below everything else.
Save your image as a jpg if you don't have a transparent background or a png if you do. Use it in place of the image you were reflecting and fading with code. This will be mostly browser compatible.
CSS isn't designed to handle stuff like that. In other words: no, it's not possible.
I'm having similar problems trying to do things with background gradients in the Android browser, and it appears completely unsupported
Unfortunately the above answer is right, there isn't a way to split your declaration up in a nice progressively enhanced way. You could use JavaScript/modernizr as you mentioned, and at least set a support class(es) so you don't actually have to flip the style within code.
You could try reproducing this effect with a HTML canvas element, using drawImage with your image and transforming it. Although canvas can be slow in mobile webkit.
Good luck
do gradients work at all in the android browser?
if they do, make sure you're using the correct version. There's an old webkit format you may need to use.
If not, just use modernizr to hide it on places that don't support gradients.