1

Topic: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Already there is also it invariably: resizable dialogue with QGraphicsView on it and button "Press", on Qt 4.8.2. For QGraphicsView a basis of the deduced information is created QGraphicsScene. On this scene (scene _) it is superimposed as a substrate for all - one QPixmap. And further are added in proper places (NB! Without coming for boundaries QPixmap!!!) Also QGraphicsTextItem'. Further on button click the Press we cause dialogue of a choice of the printer, we receive the printer (printer _) and further  in it all scene: QPainter painter; painter.begin (printer _); scene_. render (&painter); painter.end (); like as in essence all works, but... That it is necessary to attach and correct, i.e. - AS it is necessary that it looked and worked: QGraphicsView initially at discovery of all dialogue should be in the sizes sheet 5 on dialogue center. In other words a copy of the upper half of the sheet A4 taken in book orientation. It is no more and not less. Exactly and a point. I.e. if to open dialogue, to take a sheet A4, to cut off on top a half from it and to put to the screen - that the sizes of white cloth QGraphicsView on dialogue and this half of sheet should coincide. Scroll bars should appear only if dialogue  so that the sizes of white cloth QGraphicsView become less than this half of a sheet A4. QPixmap loads in itself a picture which attributes set its sizes NOT LESS than this half of a sheet A4. BUT can and to be such that the picture becomes more. For example, it is a situation when the picture is taken from the scanner working at 600/800dpi. Then even small, apparently, the picture at the press 1:1 quits  more than we would expect to see. Thereby at loading in QGraphicsScene it QPixmap it is necessary to guarantee that it will be pressed, if it is necessary, and fills exactly all surface sew QGraphicsView which sizes, I remind -  are equal to sheet 5. The start picture was is taken in sizes 794px*560px (dpi=96) that guarantees display in 1:1 for sheet 5 on our old monitors. BUT the most part of the necessary pictures go from the scanner working at 600/800dpi. I.e. it is more than pixels, the sizes more. It is necessary to press. Proportions of pictures are equal to proportions of sheet 5. On printer QGraphicsScene should leave as - considering that it is the upper half of a sheet A4. I.e. it is necessary as that to adjust the upper output area on the press. And before the press dialogue of print preview of the press should open. Well and a global question - AS it ? What functions, working methods in Qt help to reach the required purpose?

2

Re: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Hello, D_Tony, you wrote: D_T>... D_T> Well and a global question - AS it ? What functions, working methods in Qt help D_T> to reach the required purpose? You leaking  wrote it to us? What answer you expect? The ready code which for you does all? I did not see any question on a subject.

3

Re: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Hello, SaZ, you wrote: SaZ> Hello, D_Tony, you wrote: D_T>>... D_T>> Well and a global question - AS it ? What functions, working methods in Qt help D_T>> to reach the required purpose? SaZ> you leaking  wrote it to us? What answer you expect? The ready code which for you does all? SaZ> I did not see any question on a subject. I only for you will chew the first question. "QGraphicsView initially at discovery of all dialogue should be in the sizes sheet 5 on dialogue center." In docks on this class there is no decision for "to set output area on certain standard ISO to the sizes". The nearest similar function setSceneRect (). But its usage (const QRectF and rect) does not allow to squeeze there the size 5 sheet. I.e. transformation of numbers the magic is necessary? For I know only actual size in mm. This sheet. How I in QRectF will translate it? Once again - the output area should coincide precisely on the monitor with 5 a leaf. And what manuals Qt help me with it? I.e. the answer, yes, should contain a code piece in an ideal. For I not about the theory set a question, and about actual application Qt of a class. The answer actual means also it is expected. With the code. The it is more, if any conversions which are not present in Qt to library are suddenly really necessary and they should be encoded most. If I about them not in course - mean therefore here and I ask answers.

4

Re: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Hello, D_Tony, you wrote: D_T>... It is A lot of letters not on a subject. I correctly understood, what it is necessary for you  millimeters in dpi the screen? If yes, here dock. Well and not to forget about device pixel ratio which can differ from 1. A proportion master? And generally Qt-shnaja the scene initially not was is designed for the press. But it is possible  with  scenes in the printer.

5

Re: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Hello, SaZ, you wrote: SaZ> Hello, D_Tony, you wrote: D_T>>... SaZ> it is A lot of letters not on a subject. I correctly understood, what it is necessary for you  millimeters in dpi the screen? SaZ> if yes, here dock. Well and not to forget about device pixel ratio which can differ from 1. A proportion master? SaZ> and generally Qt-shnaja the scene initially not was is designed for the press. But it is possible  with  scenes in the printer. Each letter and a phrase on a subject. Simply it is necessary to understand all of them entirely. Without a lift-off of a letter from a letter. Since the very first post. At me Qt 4.8 about what I also wrote in the first post. You offer me to dock on 5 Qt There is no not "a mm in dpi" it is necessary  - and understand what what calls of functions I can to set output area and  at QGraphicsView is equal in the size of sheet 5. If who knows exact algorithm of such action - I ask to unsubscribe. The same and with QPixmap, loaded in QGraphicsScene - I want to understand - what sequences of calls and what functions  that QPixmap the view pane boots in QGraphicsScene with . exactly in sheet 5 since the scene is enclosed in QGraphicsView, and  which should equal to the size 5 sheet. . if any operation on picture compression is necessary, it  (only in case of its sizes, big than 5- sheet, it is finite) - that here is how it to define and how  as a result? On what basis of the properties, what objects? On the printer at me to go the scene. I even already showed the code. I.e. in essence ALL works, but not on the full parameters . And here for the printer it is necessary to understand - as it to adjust that the press would go in the upper area of a sheet A4. Now there is a press on all sheet. I.e. there is an autoscaling. And controlled action - the press only in the upper part of a sheet A4 is necessary.

6

Re: QGraphicsView + QGraphicsScene + QPixmap + QPrinter

Hello, D_Tony, you wrote: D_T> That it is necessary to attach and correct, i.e. - AS it is necessary that it looked and worked: D_T> QGraphicsView initially at discovery of all dialogue should be D_T> in the sizes sheet 5 on dialogue center. Approximately so://QGraphicsView *view; QSize a5 (148, 210); QRect screen = qApp-> desktop ()-> availableGeometry (); QSize newSize (view-> physicalDpiX () *a5.width ()/25.4, view-> physicalDpiY () *a5.height ()/25.4); QPoint topLeft ((screen.width () - newSize.width ())/2, (screen.height () - newSize.height ())/2); QRect newRect (topLeft.x (), topLeft.y (), newSize.width (), newSize.height ()); view-> setGeometry (newRect); It is made concerning the screen, and concerning dialogue, I think, you can make.