How to attach png files to qwtplot - qt

Is it possible to use png files in QwtPlot? Normally i can use svg files in my plots with QwtPlotSvgitem class but i could not succeed with these png files. Please give me a clue about that.
Regards

Probably there are several ways to do this. You don't specify what kind of image you want to draw (and where).
You might create a QwtPlotMarker (Qwt docs) with a custom QwtSymbol (Qwt docs). You can try QwtSymbol::setPixmap(). A QPixmap can be created by calling its constructor with the file name of the *.png image (Qt docs).

Related

Symfony / CKEditor / Elfinder : is it possible to convert automatically uploaded image png to jpg?

From Symfony 5, I installed and configured the CKEditor buundle and attach it to the Elfinder bundle.
All works perfectly. Now, for increase the users experiences, I would like convert automatically any png file updated via elfinder to jpg file (for save disk space usage ;) )
Despite my researches, I can't find if there is a CKEditor and/or Elfinder way for upload image.
Nothing in the documentation. I also look the result of the php bin/console config:dump-reference fm_elfinder command, but I don't find anything about a conversion...
Does that mean there isn't a quick/provided way for do what I'm looking for ?
Thanks for any help :)
Are you sure that it will increase the users experiences to convert their png to a jpg image? I don't think so, you will loose a lot of functionalities of png (transparency, color protection, etc.). Do not forget that png image can be compressed too!
If you are sure that, in your case, it will increase the users experience, this bundle does natively not do it. You'll have to code. I saw two solutions:
Solution1: FMElFinderBundle comes with a plugin to resize image. You could perhaps have a look on it to create a new specification which will transform png into jpeg instead of resize it.
Solution2: FMElFinderBundle use the FileSystem Symfony component to store image. This bundle allows developers to change this component (If you want to replace it by an Amazon service as example). You could create your own component by overriding the Symfony filesystem. Just replace the dumpfile or the copy methods. If file is a png, you call the gd2 library to convert it.

Generate PDF file in JavaFX

I would like to generate PDF file in JavaFX. For example I would like to print the scene in PDF file. Is this possible without external library?
No, it is not possible without an external library. I do as ItachiUchiha suggests: convert the AnchorPane into an image via snapshot and then print out the image I created.

Qt how to access resources

Qt Creator give the possibility to attach some resource to the project.
I created in the project directory a folder called: Images. inside i have the file splash1.jpg
I created then the Resources file and attached the file as shown in the following figure:
Which is now the correct way to access from code such a file?
I tryed
QPixmap pixmap( "Images/splash1.jpg" );
QPixmap pixmap( "./Images/splash1.jpg" );
but none of them worked.
if i put just ./Images/splash1.jpg work at least if i compile by hand with qmake and make because has the correct path at runtime but no way to make it work within qt creator
Any idea??
Cheers,
Qt5 resources explains all you need. You have to put the colon before the path in the source tree. You also have placed a prefix, so :/Images/Images/splash1.jpg. This will give you a path.
If you need a URL, then use the qrc: scheme.
The correct way to load with Qt resources is: :/Images/Images/splash1.jpg.
What you could also do, is assign an alias to the resource. This way you don't need the .jpg: :/Images/splash
You can use ":/prefix/name of your image".

How to pass variables to FXG files in Flex

I made a drawing in Illustrator and exported it as FXG file to be used in my Flex App which is working fine. But now I want to change some settings inside FXG programatically, namely changing color inside the FXG file. How do I do that?
If you are using a .fxg file you won't be able access anything inside of the file since the compiler optimizes it. You can almost think of it as an image file that can scale. Sounds like you might want to be using MXML Graphics, see this post for an explanation of the difference: http://help.adobe.com/en_US/flex/using/WS145DAB0B-A958-423f-8A01-12B679BA0CC7.html

Flex embed dynamically

In one project, I have several similar applications, they just differ slightly here and there. Like some of the contained icons/images. To help organizing, I see myself [Embed]ing icons in a style like below, however the use of variables in the [Embed] metatag doesn't work.
The below code is contained in a custom component, so I easily should be able to set different icons per application including the component. How do I get around this problem?
public var iconBase:String = "/icons/red/";
[Embed(iconBase + "play.png")] [Bindable] public var icon_play:Class;
[Embed(iconBase + "stop.png")] [Bindable] public var icon_stop:Class;
This should answer your question: Embedding sources dynamically.
Metadata is pre-processed by the compiler, so you can't have any variables in there.
Hope that helps,
Lance
You have quite a few options:
Write a quick code generator to
build the appropriate source files.
Load the icons at runtime, that
way you could change the paths.
Use symlinks to change where the
icon files are retrieved from.
Make an icon library or module and
either load them at compile time or
at runtime.
I think I would just load the images at runtime and change the base path.
One option is to use the ResourceManager and put embed statements in resources files. Different apps could define different resource bundles.
u could use
btn.setStyle(“icon”,iconSymbol);
it can help

Resources