IT英语翻译!谢谢!(请不要用翻译工具翻译)
IT英语翻译!谢谢!(请不要用翻译工具翻译)
The top and right handles affect only themselves, which means that they do not use the
m_handles list. The center point of the shape is not affected; the horizontal direction is not
affected by the top handler nor is the vertical direction affected by the right handle.
Listings 7-30 and 7-31 show how the roles are handled. The listings look very similar; the
only difference is the direction in which they act.
Let’s look at the details of Listing 7-30; that is, the top handle. The listing starts with an if
clause that ensures that the shape will not be too small. If that’s the case, pass the current
position as the next position to the QGraphicsItem itemChange method.
If the handled shape is big enough, continue by limiting the movement to the direction
of the handle (you don’t allow horizontal movement for the top handle). Then you translate
the shape being handled so the center of the shape is the origo of the coordinate system. This
is a preparation for the scaling, in which you scale the shape according to the movement.
The shape is translated back into its original location, the switch statement is left, and the
QGraphicsItem itemChange method is given the event, but with the direction of limited
movement.
Printing
Qt handles printers with the QPrinter class, which represents a print job to a specific printer
and can be used as a paint device. This means that you can create a QPainter for painting onto
a page represented through QPrinter. The printer object is then used to create new pages and
tell the printer when the job is ready to be printed.
Take a look at some of the properties available from the class:
• colorMode: The printer prints in color or grayscale. Can be set to either QPrinter::Color
or QPrinter::GrayScale.
• orientation: The page can either be positioned as a landscape (QPrinter::Landscape)
or as a portrait (QPrinter::Portrait).
• outputFormat: The printer can print to the platform’s native printing system
(QPrinter::Native), a PDF document (QPrinter::PdfFormat), or a PostScript document
(QPrinter::PostScriptFormat). When printing to a file, which is necessary when creating
PDF and PostScript documents, you must set the file name for the document using
setOutputFileName.
• pageSize: The size of the paper according to different standards. Includes the paper
sizes A4 (QPrinter::A4) and Letter (QPrinter::Letter), but supports many more. Refer
to the Qt documentation for details.
Let’s continue with some actual printing.
顶部右边的把手只对它们自身有影响,也就是说它们不会是
使用中间一排的把手.外部形状的中心点是不会受到影响.
水平偏转也不会受到顶部或者说垂直方向也不会影响右把手.
7-30和7-31的列表显示了它是如何操作的,这些物品看起来
十分的相似,唯一的不同是它们的操作方向不同.
让我们来仔细看一下物品7-30,在顶端把手上,列表以条件从
句开始就可以保证它的形状不会太小.如果这是事实,那么把通
过这个位置当成是下一个位置的QGraphicsItem itemChange方法.
如果这个把手足够大,那就继续限制把手方向(你不需要让顶部
把手作水平运动),然后,你就可以通过改变把手形状而使中心
中心点作为坐标系的起点.
这也就为你通过运动来缩放比例作了准备.物体也就转变到了最
初的位置,开关表在左,QGraphicsItem itemChange方法在一定条
件下的运动就是决定事件.