I'm designing a GUI in Qt and I need to use a form to save an image. The user would be able to save a file in any location (a simple save form that we see under Save as...). How can make a save-as form in Qt?
thanks!
You can do, for example, the following:
QImage image(128, 128);
image.fill(Qt::red); // A red rectangle.
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Image File"),
QString(),
tr("Images (*.png)"));
if (!fileName.isEmpty())
{
image.save(fileName);
}
Related
I have drawn an image in the Obeo Designer. And I can export the image through right-click the image and click the "Export as a Diagram". Now I want to export the diagrams through java code instead of interacting with the Obeo Designer because my program will generate some .aird files during the runtime and I want to turn these .aird files into diagrams in the form of JPG or JPEG automatically. Is there any way to implement the idea?
You could call:
org.eclipse.sirius.ui.business.api.dialect.DialectUIManager.INSTANCE.export(representation,
session, filePath, exportFormat,progressMonitor);
where exportFormat can be for example:
ExportFormat exportFormat = new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG);
I amtry to display a costum Image in jsTree. I build the tree from a database via AJAX-Call. To build it up I use c# eg:
var s = "<li data-jstree='{'icon':'fa fa-check'}'> Konfiguration"
then I send "s" as JsonFile to on the Ajax call.
Can some on explain to me how I must format the string that I can display the image. Also I would pref to display an image out of my image-folder.
Thanks a lot for any suggest.
I have designed a document in Libre Office Draw, and now need to personalize it by filling certain controls (mainly labels) with names read from a text file.
Reading from a text file was trivial, but am facing difficulties in obtaining a reference to a control placed in a Libre Office Draw document; all the functions mentioned were related to controls placed on a dialog, and did not seem applicable in this case.
This might be the first lead into reaching my goal:
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
But then, how to find a control placed on 'document' named, say, "MyLabel1"? Once the label is filled, the document would need to be exported to PDF.
Thanks a lot!
To export a LO Draw document to PDF from Basic you can use the following code.
Sub ExportToPDF
sURL = convertToURL("d:\temp\lo_draw.pdf")
dim mFileType(0)
mFileType(0) = createUnoStruct("com.sun.star.beans.PropertyValue")
mFileType(0).Name = "FilterName"
mFileType(0).Value = "draw_pdf_Export"
thisComponent.storeToURL(sURL, mFileType())
End Sub
To figure out how to get access to the "labels" please provide a sample LO Draw document.
How can I Load an image.Jpg using Centura?
then display it in Centura and be able to load this image as a logo in the qrp reports?
For loading the image into a centura image control by setting its property as shown in the below image.
In addition to this you can also load the image pragmatically using any of the below mentioned Sal functions,
1.SalPicSetImage
bOk = SalPicSetImage ( hWndPict, strImageBytes, nType )
Inserts the contents of a string to a picture object. The third parameter is a constant.
Parameters
hWndPict Window handle. The handle (or name) of a picture.
strImageBytes String. String buffer which stores the image bytes.
nType Number. The format of the picture contents:.Example for jpg - PIC_ImageTypJPEG
2.SalPicSetFile
bOk = SalPicSetFile ( hWndPict, strFileName )
Inserts a file's contents into a picture.
Parameters
hWndPict Window Handle. The handle (or name) of a picture.
strFileName String. The name of the file whose contents are to be inserted into hWndPict.
Steps for passing an image into Qrp
1.Declare an Object in the qrp file, as shown in the below image
2.Assign the above mentioned object to Qrp picture as shown the image below,
3.Set the above mentioned object in the output list.(in centura application)
4.Assign centura image contents into a longstring variable and set it in Input list.(In centura application)
For copying centura image contents into string variable you can use SalPicGetString().
I would like to know is there any way to remove pdf,xls in save button option files of type different formats so that i dont want to generate reports in pdf singlesheet-xls.
Generally the default save button files of type option comes with all the formats -pdf,singlesheet xls,embedded images,jrxml,multiplesheet xls,csv and other formats.
what i want is to disable pdf and singlesheet xls.is there any way to disable certain formats in ireport
This example removes all save options apart from Single sheet XLS and PDF:
JRViewer viewer = ... ;//your viewer
JRSaveContributor[] contrbs = viewer.getSaveContributors();
for (JRSaveContributor saveContributor : contrbs)
{
if (!(saveContributor instanceof net.sf.jasperreports.view.save.JRSingleSheetXlsSaveContributor
|| saveContributor instanceof net.sf.jasperreports.view.save.JRPdfSaveContributor))
viewer.removeSaveContributor(saveContributor);
}