I implement the ability to print reports in my project. Reports are presented as HTML content. I use for print QWebEnginePage. I need high resolution print output for reports:
QPrinter printer = new QPrinter(QPrinter::HighResolution);
But when printing with the "print" function, print fails, with message in debug:
QImage: out of memory, returning null image
When printing with ScreenResolution, everything is fine, but the result is poor quality.
Version Qt - 5.10.1
Probably you are indeed running out of memory.
Try to convert your web page into something that renders better, e.g. PDF and print the PDF instead.
Related
Hello I'm trying to build a function grapher on the terminal in c++. I want that every time a new function is added the output will be cleared and the new frame will take its place.
I've tried to do system("clear") but I don't want all the terminal to be cleared and only the output stream. I've also thought about printing '\b' a lot of times but that seems inefficient.
I would also like to know how to delete 1 line.
You may try to work with console code.
Console code about cursor
There are two solution.
Here is some C style code, just to demonstate the idea easier, you may convert it into C++ style.
Clear content
//Clear content after (x,y)
printf("\033[%d,%dH\033[J",y,x);
//x the column number,y the row number
Overwrite the content
//Goto (x,y) then print the next frame, it should overwrite the old content
printf("\033[%d,%dH",y,x);
...
//your code to output the next frame
If personal information is included in the requested print using C++ language, cancel the current print and print again after receiving approval from the server.
※This event is raised when the user directly outputs an open file.
(In other words, if the user directly requests printing of an open file in the same way as ctrl+p, printing will be requested for the open file because the dll I created works.)
Approval is at EndDoc, the point at which the print is almost finished.
The problematic part is how to print again.
I was using the implementation to request a print again as shown below.
[refer to variable]
RequestDevModeW -> When printing is requested for the first time, the information is saved and used for reprint. (Saved when calling DocumentPropertiesW API.)
RequestDOCInfoW -> When printing is requested for the first time, the information is saved and used for reprint. (This is a structure stored in StartDocW when requesting a print for the first time.)
nPageCnt -> The number of startpage <-> Endpage is stored when the first print request is made.
[Code]
//... skip ...//
hReprintDC = CreateDCW(NULL, wszPrintName, NULL, &RequestDevModeW);
if (hReprintDC)
{
RequestDOCInfoW.lpszDocName = (LPCWSTR)wszDocName;
StartDocW(hReprintDC, &RequestDOCInfoW);
for (int nPage = 0; nPage < nPageCnt; ++nPage)
{
StartPage(hReprintDC);
EndPage(hReprintDC);
}
EndDoc(hReprintDC);
DeleteDC(hReprintDC);
g_hRePrintDC = NULL;
}
//... skip ...//
However, the code above is causing an error when displaying textbox in some documents (excel, word).
So I used the ShellExecuteEX API.
It prints very well, but I can't get the print attributes to work.
What I mean by print properties is that you have no control over these details, such as printing specific pages.
I'm curious about how to make a detailed request for a print using C++ code.
In addition, the print dialog should be output as it is with the existing specifications without being displayed.
I'm trying to create an application which uses camera API, based on an example from Qt.
Problem:
Following call to check if video capture is supported returns false.
camera->isCaptureModeSupported(QCamera::CaptureVideo) //returns false.
If I try to ignore it and start recording - recording does not start and I get no error messages ( Also, QMediaRecorder::errorString() and QCamera::errorString() return empty strings ).
Image from camera correctly showed in QCameraViewFinder.
It basically is a known bug in windows.
https://bugreports.qt.io/browse/QTBUG-30541
https://doc-snapshots.qt.io/qt5-5.5/qtmultimedia-windows.html
It should work in other platforms, though.
This is driving me up the wall..
I've got a very simple SDL2 program.
It has a array of 3 SDL_Texture pointers.
These textures are filled as follows:
SDL_Texture *myarray[15];
SDL_Surface *surface;
for(int i=0;i<3;i++)
{
char filename[] = "X.bmp";
filename[0] = i + '0';
surface = SDL_LoadBMP(filename);
myarray[i] = SDL_CreateTextureFromSurface(myrenderer,surface);
SDL_FreeSurface(surface);
}
This works, no errors.
In the main loop (which is just a standard event loop waiting for SDL_QUIT, keystrokes and a user-event which a SDL_Timer puts in the event queue every second) I just do (for the timer triggered event):
idx = (idx+1) % 3; // idx is global var initially 0.
SDL_RenderClear(myrenderer);
SDL_RenderCopy(myrenderer, myarray[idx], NULL, NULL);
SDL_RendererPresent(myrenderer);
This works fine for 0.bmp and 1.bmp, but the 3rd image (2.bmp) simply shows as a black field.
This is structural.
If I alternate the first 2 images they are both fine.
If I alternate the 2nd and 3rd image the 3rd image doesn't show.
If I use more than 3 images then 3 and upwards show as black.
Loading order doesn't matter. It starts going wrong with the 3rd image loaded from disk.
All images are properly formatted BMP's.
I even saved 2.bmp back to disk under a different name by using SDL_SaveBMP() after it was loaded to make sure it got loaded in memory OK. The new file is bit for bit identical to the original.
This program, without modifications and the same bmp files, works fine on OSX (XCode5) and Windows (VC++ 2012 Express).
The problem only shows on the Raspberry PI.
I have placed explicit error checks on every call that can leave a result/error-code (not shown in the samples above for brevity) but all of them show "no error".
I have used the latest stable source set of www.libsdl.org and compiled as instructed (configure, make, make install, etc.).
Anybody got any idea what could be going on ?
P.S.
Keyboard input doesn't seem to work either on my PI, but I haven't delved into that yet.
Answering myself as I finally figured it out myself...
I finally went back to the README-raspberrypi.txt that came with the SDL2 sources.
I didn't read it carefully enough the first time around...
Problem 1: I'am running on a FULL-HD display. The PI's default GPU memory is 64MB which is not enough for large displays and double-buffering. As suggested in the README I increased this to 128MB and this solved the black image problem.
Problem 2: Text input wasn't working because my user-account was not in the input group. I had added the default "pi" account to the input group initially, but when I later started using another account I forgot to add that user to the group.
In short: Caught by my own (too) quick skimming of the documentation.
I am fetching the call-logs, appending them on information note using:
CAknInformationNote* note = new (ELeave) CAknInformationNote;
note->ExecuteLD(callLogs);
I perfectly run on emulator (show all call-logs on note) but nothing shows up when run on the actual device (a Nokia N73). Any ideas?
i think you should use some kind of file logging(you can even use RFile) and see till what point your application executing.i am assuming you dont see a crash/panic on hardware.i doubt if you are able to get the call logs properly first on device.