How to customize QDialogButtonBox buttons' background color? - qt

I have :
auto btnBox = new QDialogButtonBox(QFlags({QDialogButtonBox::Abort, QDialogButtonBox::Ok}));
layout()->addWidget(btnBox);
I tried
btnBox->setStyleSheet("QPushButton {background-color : red;}");
But the buttons remains light gray...
Thanks for your help

The following shorter version changes the Background-Color of the Buttons:
auto btnBox = new QDialogButtonBox( QDialogButtonBox::Abort| QDialogButtonBox::Ok );
layout()->addWidget(btnBox);
btnBox->setStyleSheet("background: red");

#SteveXP solution works, if you don't use QWindowsVistaStyle, which uses native drawing

Related

Codename One CSS Material Icon color not changing

I have created an application to test the new CN1 CSS support.
The plugin is great and everything works fine and out-of-the-box, except that the material icon on a button does not change its color with the button's text color. It just stays always the same (black) color.
Before using the CSS support, I changed the theme editor's default foreground color setting to reach the material icon, but now the theme editor seems to be dis-attached from the styling and it does not have any effect anymore.
Is there a UIID for the icon or any other way to change the color of the material icon?
Here is my code:
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_CHECK, "TitleCommand", 3);
Button buttonTest = new Button("Test css");
buttonTest.setUIID("ButtonTest");
buttonTest.setIcon(icon);
And the CSS:
ButtonTest {
color: red;
}
try it
FontImage img = FontImage.createMaterial(FontImage.MATERIAL_THUMB_UP, style);
Just to post a complete answer that might be able to guide someone:
Style style = new Style();
style.setBgColor(ColorUtil.GREEN);
style.setFgColor(ColorUtil.WHITE);
style.setBgTransparency(255);
FontImage imageBack = FontImage.createMaterial(FontImage.MATERIAL_NEXT_WEEK, style);

Changing three.js background to transparent or other color

I've been trying to change what seems to be the default background color of my canvas from black to transparent / any other color - but no luck.
My HTML:
<canvas id="canvasColor">
My CSS:
<style type="text/css">
#canvasColor {
z-index: 998;
opacity:1;
background: red;
}
</style>
As you can see in the following online example I have some animation appended to the canvas, so cant just do a opacity: 0; on the id.
Live preview:
http://devsgs.com/preview/test/particle/
Any ideas how to overwrite the default black?
I came across this when I started using three.js as well. It's actually a javascript issue. You currently have:
renderer.setClearColorHex( 0x000000, 1 );
in your threejs init function. Change it to:
renderer.setClearColorHex( 0xffffff, 1 );
Update: Thanks to HdN8 for the updated solution:
renderer.setClearColor( 0xffffff, 0);
Update #2: As pointed out by WestLangley in another, similar question - you must now use the below code when creating a new WebGLRenderer instance in conjunction with the setClearColor() function:
var renderer = new THREE.WebGLRenderer({ alpha: true });
Update #3: Mr.doob points out that since r78 you can alternatively use the code below to set your scene's background colour:
var scene = new THREE.Scene(); // initialising the scene
scene.background = new THREE.Color( 0xff0000 );
A full answer: (Tested with r71)
To set a background color use:
renderer.setClearColor( 0xffffff ); // white background - replace ffffff with any hex color
If you want a transparent background you will have to enable alpha in your renderer first:
renderer = new THREE.WebGLRenderer( { alpha: true } ); // init like this
renderer.setClearColor( 0xffffff, 0 ); // second param is opacity, 0 => transparent
View the docs for more info.
For transparency, this is also mandatory: renderer = new THREE.WebGLRenderer( { alpha: true } ) via Transparent background with three.js
In 2020 using r115 it works very good with this:
const renderer = new THREE.WebGLRenderer({ alpha: true });
const scene = new THREE.Scene();
scene.background = null;
I found that when I created a scene via the three.js editor, I not only had to use the correct answer's code (above), to set up the renderer with an alpha value and the clear color, I had to go into the app.json file and find the "Scene" Object's "background" attribute and set it to:
"background: null".
The export from Three.js editor had it originally set to "background": 0
Set renderer clear colour
With the below code
renderer.setClearColor( 0x000000, 1 );
I'd also like to add that if using the three.js editor don't forget to set the background colour to clear as well in the index.html.
background-color:#00000000

Changing enhancedGrid row color background

I'm trying to change the background color for a row in a enhancedGrid. This is driving me crazy, thank you in advance for your time.
First, I select the row with onRowClick event.
function onRowClickHandler(evt) {
selectedRow = evt.rowIndex;
selectedCode = dijit.byId("myGrid").getItem(evt.rowIndex).code;
}
I need that the background color changes only when acertain button is clicked.
dijit.byId("myGrid").getRowNode(selectedRow).style+="backgroungColor:red;");
or
dijit.byId("myGrid").getRowNode(selectedRow).customStyle+="backgroungColor:red;");
This doesn't work.
I also tried with onStyleRow but it doesn't work.
I've tried with
dojo.style(dijit.byId("myGrid").getRowNode(selectedRow), "backgroundColor", "#454545" )
But the style does not remain fixed.
Thanks!
Take a look at this answer
Though I think if you override onStyleRow instead of using dojo.connect you should have this at the bottom of your custom function:
dojox.grid.EnhancedGrid.prototype.onStyleRow.apply(this, arguments);

How to lighten or darken a Flex 4 image

Is there a way to darken or lighten an image or actually any display object on mouse over and then restore it back on mouse out? I would prefer to use filters if possible just because I am already applying a filter on mouse over and removing it on mouse out. I would then be able to add it to the filters list. If not that's fine. In my code I'm using a Flex 4 Spark Image component.
You should use ColorTransform for this. Below is shown how you can utilise this.
image.addEventListener(MouseEvent.MOUSE_OVER, checkTransform);
image.addEventListener(MouseEvent.MOUSE_OUT, checkTransform);
private function checkTransform(e:event):void
{
if(e.type == MouseEvent.MOUSE_OVER)
image.transform.colorTransform = new ColorTransform(0.5, 0.5, 0.5); //multiplies all RGB-values by 0.5
else
image.transform.colorTransform = new ColorTransform(1, 1, 1); //restores to default image
}
this should do the trick. For more information on ColorTransform: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/ColorTransform.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
The easiesy way to do is, create a colorfilter, and apply this colorfilter to the image on rollover and remove the filter on rollout.
For details visit :
http://cookbooks.adobe.com/post_Convert_images_to_grayscale_using_ActionScript_-12769.html
Thanks

Adding rollover effect to skinned button in Flex

Using Flex 3, I have a Button which is skinned using PNGs specified in a CSS style sheet.
Button.addextra {
downSkin : Embed( source="img/add-extra-icon.png" );
overSkin : Embed( source="img/add-extra-icon.png" );
upSkin : Embed( source="img/add-extra-icon.png" );
disabledSkin : Embed( source="img/add-extra-icon-disabled.png" );
}
My designer colleague would like to add a rollover effect of a hairline #999999 line outside the image. Is this possible (without creating a new overSkin png) using the standard Flex styles?
What about drawing lines with Graphics?
I believe you will need to change the overSkin, i think that would be the only way.

Resources