pos機(jī)刷卡的翻譯

 新聞資訊3  |   2023-09-09 10:21  |  投稿人:pos機(jī)之家

網(wǎng)上有很多關(guān)于pos機(jī)刷卡的翻譯,QGraphicsItem類官方文檔的中文翻譯的知識(shí),也有很多人為大家解答關(guān)于pos機(jī)刷卡的翻譯的問題,今天pos機(jī)之家(m.shineka.com)為大家整理了關(guān)于這方面的知識(shí),讓我們一起來看下吧!

本文目錄一覽:

1、pos機(jī)刷卡的翻譯

pos機(jī)刷卡的翻譯

Detailed Description

It provides a light-weight foundation for writing your own custom items. This includes defining the item's geometry, collision detection, its painting implementation and item interaction through its event handlers. QGraphicsItem is part of the Graphics View Framework

它為編寫你的自定義項(xiàng)目提供了一個(gè)輕量級(jí)的基礎(chǔ)。這包括定義項(xiàng)目的幾何形狀,碰撞檢測,它的繪畫實(shí)現(xiàn),和通過事件處理程序的項(xiàng)目交互。QGraphicsItem是圖形視圖框架的一部分。

For convenience, Qt provides a set of standard graphics items for the most common shapes.

常用形狀便利函數(shù):

QGraphicsEllipseItem provides an ellipse item橢圓項(xiàng)目QGraphicsLineItem provides a line item直線項(xiàng)目QGraphicsPathItem provides an arbitrary path item路徑項(xiàng)目QGraphicsPixmapItem provides a pixmap item pixmap項(xiàng)目QGraphicsPolygonItem provides a polygon item多邊形項(xiàng)目QGraphicsRectItem provides a rectangular item矩形項(xiàng)目QGraphicsSimpleTextItem provides a simple text label item簡單文本項(xiàng)目QGraphicsTextItem provides an advanced text browser item文本項(xiàng)目

All of an item's geometric information is based on its local coordinate system. The item's position, pos(), is the only function that does not operate in local coordinates, as it returns a position in parent coordinates. The Graphics View Coordinate System describes the coordinate system in detail.

項(xiàng)目的所有幾何信息都基于其局部坐標(biāo)系統(tǒng)。項(xiàng)目的位置pos()是唯一不在局部坐標(biāo)中操作的函數(shù),因?yàn)樗祷馗笇ο笞鴺?biāo)中的位置。圖形視圖坐標(biāo)系統(tǒng)詳細(xì)描述了坐標(biāo)系統(tǒng)。

You can set whether an item should be visible (i.e., drawn, and accepting events), by calling setVisible(). Hiding an item will also hide its children. Similarly, you can enable or disable an item by calling setEnabled(). If you disable an item, all its children will also be disabled. By default, items are both visible and enabled. To toggle whether an item is selected or not, first enable selection by setting the ItemIsSelectable flag, and then call setSelected(). Normally, selection is toggled by the scene, as a result of user interaction.

setVisible()設(shè)置一個(gè)項(xiàng)目的可見性(例如,繪制和接受事件)。隱藏一個(gè)項(xiàng)目也會(huì)隱藏它的子項(xiàng)目。類似地,調(diào)用setEnabled()來使能一個(gè)項(xiàng)。如果你禁用一個(gè)項(xiàng)目,它的所有子項(xiàng)目也將被禁用。默認(rèn)情況下,項(xiàng)目既可見又啟用。要切換項(xiàng)目的選中狀態(tài),先設(shè)置ItemIsSelectable標(biāo)志,再調(diào)用setSelected()。通常,選中狀態(tài)切換是由場景負(fù)責(zé),它是用戶交互產(chǎn)生的結(jié)果。

To write your own graphics item, you first create a subclass of QGraphicsItem, and then start by implementing its two pure virtual public functions: boundingRect(), which returns an estimate of the area painted by the item, and paint(), which implements the actual painting.

要編寫自定義圖形項(xiàng),首先要?jiǎng)?chuàng)建QGraphicsItem的一個(gè)派生類,然后重寫它的兩個(gè)純虛函數(shù):一是boundingRect(),它返回項(xiàng)繪制區(qū)域的邊界矩形,二是paint(),它具體完成繪制的工作。

For example:

class SimpleItem : public QGraphicsItem

{

public:

QRectF boundingRect() const override

{

qreal penwidth="360px",height="auto" />

1;

return QRectF(-10 - penwidth="360px",height="auto" />

2, -10 - penwidth="360px",height="auto" />

2,

20 + penwidth="360px",height="auto" />

20 + penwidth="360px",height="auto" />

}

void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,

QWidget *widget) override

{

painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);

}

};

The boundingRect() function has many different purposes. QGraphicsScene bases its item index on boundingRect(), and QGraphicsView uses it both for culling invisible items, and for determining the area that needs to be recomposed when drawing overlapping items. In addition, QGraphicsItem's collision detection mechanisms use boundingRect() to provide an efficient cut-off. The fine grained collision algorithm in collidesWithItem() is based on calling shape(), which returns an accurate outline of the item's shape as a QPainterPath.

boundingRect()函數(shù)有許多不同的用途,QGraphicsScene的項(xiàng)目索引基于它,QGraphicsView使用它來剔除不可見的項(xiàng)目,以及在繪制重疊項(xiàng)目時(shí)確定需要重新組合的區(qū)域。此外,QGraphicsItem的碰撞檢測機(jī)制使用boundingRect()來提供一個(gè)有效的截止。collidesWithItem()中的細(xì)粒度碰撞算法基于調(diào)用shape(),它以QPainterPath的形式返回項(xiàng)目形狀的精確輪廓。

QGraphicsScene expects all items boundingRect() and shape() to remain unchanged unless it is notified. If you want to change an item's geometry in any way, you must first call prepareGeometryChange() to allow QGraphicsScene to update its bookkeeping.

QGraphicsScene希望所有項(xiàng)目的boundingRect()和shape()保持不變,除非它被通知。如果你想以任何方式改變一個(gè)項(xiàng)目的幾何形狀,你必須首先調(diào)用prepareGeometryChange()來允許QGraphicsScene更新它的簿記。

Collision detection can be done in two ways:

Reimplement shape() to return an accurate shape for your item, and rely on the default implementation of collidesWithItem() to do shape-shape intersection. This can be rather expensive if the shapes are complex.Reimplement collidesWithItem() to provide your own custom item and shape collision algorithm.

碰撞檢測可以通過兩種方式完成:

1. 重寫shape()方法,為你的項(xiàng)目返回一個(gè)精確的形狀,并依賴collidesWithItem()的默認(rèn)實(shí)現(xiàn)來實(shí)現(xiàn)shape-shape交叉。如果形狀很復(fù)雜,這可能是相當(dāng)昂貴的。

2. 重新實(shí)現(xiàn)collidesWithItem()來提供你自定義項(xiàng)目和形狀碰撞算法。

The contains() function can be called to determine whether the item contains a point or not. This function can also be reimplemented by the item. The default behavior of contains() is based on calling shape().

可以調(diào)用contains()函數(shù)來確定項(xiàng)目是否包含一個(gè)點(diǎn)。這個(gè)函數(shù)也可以由項(xiàng)目重新實(shí)現(xiàn)。contains()的默認(rèn)行為是基于調(diào)用shape()。

Items can contain other items, and also be contained by other items. All items can have a parent item and a list of children. Unless the item has no parent, its position is in parent coordinates (i.e., the parent's local coordinates). Parent items propagate both their position and their transformation to all children.

項(xiàng)可以包含其他項(xiàng),也可以被其他項(xiàng)包含。所有項(xiàng)都可以有一個(gè)父項(xiàng)和一個(gè)子項(xiàng)列表。除非項(xiàng)目沒有父項(xiàng),否則它的位置在父項(xiàng)的坐標(biāo)中(即父項(xiàng)的局部坐標(biāo))。父項(xiàng)將它們的位置和變換傳播給所有子項(xiàng)。

Transformations

QGraphicsItem supports projective transformations in addition to its base position, pos(). There are several ways to change an item's transformation. For simple transformations, you can call either of the convenience functions setRotation() or setScale(), or you can pass any transformation matrix to setTransform(). For advanced transformation control you also have the option of setting several combined transformations by calling setTransformations().

QGraphicsItem除了支持它的基礎(chǔ)位置pos()外,還支持投影變換。有幾種方法可以更改項(xiàng)的變換。對于簡單的轉(zhuǎn)換,你可以調(diào)用便利函數(shù)setRotation()或setScale(),或者你可以將任何轉(zhuǎn)換矩陣傳給setTransform()。對于高級(jí)變換控制,可調(diào)用setTransformations()來設(shè)置多個(gè)組合變換。

Item transformations accumulate from parent to child, so if both a parent and child item are rotated 90 degrees, the child's total transformation will be 180 degrees. Similarly, if the item's parent is scaled to 2x its original size, its children will also be twice as large. An item's transformation does not affect its own local geometry; all geometry functions (e.g., contains(), update(), and all the mapping functions) still operate in local coordinates. For convenience, QGraphicsItem provides the functions sceneTransform(), which returns the item's total transformation matrix (including its position and all parents' positions and transformations), and scenePos(), which returns its position in scene coordinates. To reset an item's matrix, call resetTransform().

項(xiàng)目轉(zhuǎn)換從父項(xiàng)目到子項(xiàng)目累積,因此如果父項(xiàng)和子項(xiàng)都旋轉(zhuǎn)90度,子項(xiàng)的總轉(zhuǎn)換將為180度。類似地,如果項(xiàng)的父項(xiàng)被縮放到其原始大小的2倍,子項(xiàng)也將是原大小的2倍。項(xiàng)目的變換不會(huì)影響它自己的局部幾何形狀;所有幾何函數(shù)(例如contains()、update()和所有映射函數(shù))仍然在局部坐標(biāo)中操作。為了方便起見,QGraphicsItem提供了sceneTransform()函數(shù),它返回項(xiàng)目的總變換矩陣(包括它的位置和所有父元素的位置和變換),以及scenePos()函數(shù),返回它在場景坐標(biāo)系中的位置。要重置項(xiàng)目的矩陣,調(diào)用resetTransform()。

Certain transformation operations produce a different outcome depending on the order in which they are applied. For example, if you scale an transform, and then rotate it, you may get a different result than if the transform was rotated first. However, the order you set the transformation properties on QGraphicsItem does not affect the resulting transformation; QGraphicsItem always applies the properties in a fixed, defined order:

The item's base transform is applied (transform())The item's transformations list is applied in order (transformations())The item is rotated relative to its transform origin point (rotation(), transformOriginPoint())The item is scaled relative to its transform origin point (scale(), transformOriginPoint())

某些變換操作根據(jù)應(yīng)用它們的順序產(chǎn)生不同的結(jié)果。例如,如果你縮放一個(gè)變換,然后旋轉(zhuǎn)它,你可能會(huì)得到與先旋轉(zhuǎn)變換不同的結(jié)果。但是,你在QGraphicsItem上設(shè)置變換屬性的順序不會(huì)影響產(chǎn)生的變換;QGraphicsItem總是以固定的、定義好的順序應(yīng)用屬性:

l 項(xiàng)目的基本變換被應(yīng)用(transform())

l 項(xiàng)目的變換列表按順序被應(yīng)用 (transformations())

l 項(xiàng)目相對于其變換原點(diǎn)被旋轉(zhuǎn)(rotation(), transformOriginPoint())

l 項(xiàng)目相對于其變換原點(diǎn)被縮放(scale(), transformOriginPoint())

Painting

The paint() function is called by QGraphicsView to paint the item's contents. The item has no background or default fill of its own; whatever is behind the item will shine through all areas that are not explicitly painted in this function. You can call update() to schedule a repaint, optionally passing the rectangle that needs a repaint. Depending on whether or not the item is visible in a view, the item may or may not be repainted; there is no equivalent to QWidget::repaint() in QGraphicsItem.

QGraphicsView調(diào)用paint()函數(shù)來繪制項(xiàng)目的內(nèi)容。該項(xiàng)目沒有自己的背景或默認(rèn)填充;無論項(xiàng)目背后是什么,都會(huì)在所有未明確繪制的區(qū)域中發(fā)光。你可以調(diào)用update()來安排重繪,可以選擇傳遞需要重繪的矩形。根據(jù)項(xiàng)目在視圖中是否可見,項(xiàng)目可以重繪或不重繪;在QGraphicsItem中沒有與QWidget::repaint()等價(jià)的方法。

Items are painted by the view, starting with the parent items and then drawing children, in ascending stacking order. You can set an item's stacking order by calling setZValue(), and test it by calling zValue(), where items with low z-values are painted before items with high z-values. Stacking order applies to sibling items; parents are always drawn before their children.

項(xiàng)目由視圖繪制,從父項(xiàng)目開始,然后按堆升序繪制子項(xiàng)目。你可以通過調(diào)用setZValue()來設(shè)置項(xiàng)目的堆序,并通過調(diào)用zValue()來測試它,其中低z值的項(xiàng)目先于高z值的項(xiàng)目繪制。堆序適用于兄弟項(xiàng);父總是先于孩繪制。

Sorting

All items are drawn in a defined, stable order, and this same order decides which items will receive mouse input first when you click on the scene. Normally you don't have to worry about sorting, as the items follow a "natural order", following the logical structure of the scene.

所有的項(xiàng)目都是按照一個(gè)確定的、穩(wěn)定的順序繪制的,并且當(dāng)你點(diǎn)擊場景時(shí),同樣的順序決定了哪些項(xiàng)目將首先接受鼠標(biāo)輸入。通常情況下,你不必?fù)?dān)心排序,因?yàn)轫?xiàng)目遵循“自然順序”,遵循場景的邏輯結(jié)構(gòu)。

An item's children are stacked on top of the parent, and sibling items are stacked by insertion order (i.e., in the same order that they were either added to the scene, or added to the same parent). If you add item A, and then B, then B will be on top of A. If you then add C, the items' stacking order will be A, then B, then C.

一個(gè)項(xiàng)目的子項(xiàng)目堆疊在父項(xiàng)目之上,而同級(jí)項(xiàng)目則按插入順序堆疊(即,按照它們被添加到場景或添加到同一個(gè)父項(xiàng)目的順序)。如果你添加項(xiàng)目A,然后添加項(xiàng)目B,那么項(xiàng)目B將在項(xiàng)目A之上。如果然后你添加物品C,物品的堆序?qū)⑹茿,然后是B,然后是C。

This example shows the stacking order of all limbs of the robot from the Drag and Drop Robot example. The torso is the root item (all other items are children or descendants of the torso), so it is drawn first. Next, the head is drawn, as it is the first item in the torso's list of children. Then the upper left arm is drawn. As the lower arm is a child of the upper arm, the lower arm is then drawn, followed by the upper arm's next sibling, which is the upper right arm, and so on.

這個(gè)示例顯示了機(jī)器人所有肢體的堆序(拖放機(jī)器人示例)。軀干是根項(xiàng)目(所有其他項(xiàng)目都是軀干的子項(xiàng)目或后代項(xiàng)目),所以它是首先繪制的。接下來,畫出頭部,因?yàn)樗擒|干的子列表中第一項(xiàng)。然后繪制左上方的手臂。由于小臂是上臂的子臂,于是繪制小臂,然后是上臂的下一個(gè)兄弟,也就是右上方的手臂,以此類推。

For advanced users, there are ways to alter how your items are sorted:

You can call setZValue() on an item to explicitly stack it on top of, or under, other sibling items. The default Z value for an item is 0. Items with the same Z value are stacked by insertion order.You can call stackBefore() to reorder the list of children. This will directly modify the insertion order.You can set the ItemStacksBehindParent flag to stack a child item behind its parent.

對于高級(jí)用戶,有一些方法可以改變條目的排序方式:

l 你可以對一個(gè)條目調(diào)用setZValue()來顯式地將它堆疊在其他同級(jí)條目之上或之下。項(xiàng)目的默認(rèn)Z值是0。具有相同Z值的項(xiàng)將按插入順序堆疊。

l 你可以調(diào)用stackBefore()來重新排列子列表。這將直接修改插入順序。

l 你可以設(shè)置ItemStacksBehindParent標(biāo)志來將子項(xiàng)目堆疊在其父項(xiàng)目之后。

The stacking order of two sibling items also counts for each item's children and descendant items. So if one item is on top of another, then all its children will also be on top of all the other item's children as well.

兩個(gè)兄弟項(xiàng)目的堆疊順序也可以計(jì)算每個(gè)項(xiàng)目的子項(xiàng)目和后代項(xiàng)目。因此,如果一個(gè)項(xiàng)目在另一個(gè)項(xiàng)目之上,那么它的所有子項(xiàng)目也將在另一個(gè)項(xiàng)目的所有子項(xiàng)目之上。

Events

QGraphicsItem receives events from QGraphicsScene through the virtual function sceneEvent(). This function distributes the most common events to a set of convenience event handlers:

contextMenuEvent() handles context menu eventsfocusInEvent() and focusOutEvent() handle focus in and out eventshoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles hover enter, move and leave eventsinputMethodEvent() handles input events, for accessibility supportkeyPressEvent() and keyReleaseEvent() handle key press and release eventsmousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and mouseDoubleClickEvent() handles mouse press, move, release, click and doubleclick events

QGraphicsItem通過虛擬函數(shù)sceneEvent(),從QGraphicsScene接收事件。這個(gè)函數(shù)將最常見的事件分配給一組便利事件處理程序:

contextMenuEvent()處理上下文菜單事件focusInEvent()和focusOuteevent()處理焦點(diǎn)進(jìn)入和離開事件hoverEnterEvent()、hoverMoveEvent()和hoverLeaveEvent()處理懸停進(jìn)入、移動(dòng)和離開事件inputMethodEvent()處理輸入事件,以獲得可訪問性支持keyPressEvent()和keyReleaseEvent()處理按鍵按下和釋放事件mousePresseEvent (), mouseMoveEvent (), mouseReleaseEvent(),和mouseDoubleClickEvent()處理鼠標(biāo)按壓,移動(dòng),釋放,點(diǎn)擊和雙擊事件。

You can filter events for any other item by installing event filters. This functionality is separate from Qt's regular event filters (see QObject::installEventFilter()), which only work on subclasses of QObject. After installing your item as an event filter for another item by calling installSceneEventFilter(), the filtered events will be received by the virtual function sceneEventFilter(). You can remove item event filters by calling removeSceneEventFilter().

你可以安裝事件過濾器,過濾任何其他項(xiàng)目的事件。這個(gè)功能與Qt的常規(guī)事件過濾器是分開的(參見QObject::installEventFilter()),后者只在QObject的子類上工作。通過調(diào)用installSceneEventFilter()將你的項(xiàng)目安裝為另一個(gè)項(xiàng)目的事件過濾器后,被過濾的事件將由虛擬函數(shù)sceneEventFilter()接收。你可以通過調(diào)用removeSceneEventFilter()來刪除項(xiàng)目事件過濾器。

Custom Data

Sometimes it's useful to register custom data with an item, be it a custom item, or a standard item. You can call setData() on any item to store data in it using a key-value pair (the key being an integer, and the value is a QVariant). To get custom data from an item, call data(). This functionality is completely untouched by Qt itself; it is provided for the user's convenience.

有時(shí),將自定義數(shù)據(jù)注冊到一個(gè)項(xiàng)(無論是自定義項(xiàng)還是標(biāo)準(zhǔn)項(xiàng))是很有用的??梢詫θ魏雾?xiàng)調(diào)用setData(),使用鍵值對(鍵是整數(shù),值是QVariant)在其中存儲(chǔ)數(shù)據(jù)。要從項(xiàng)目中獲取自定義數(shù)據(jù),調(diào)用data()。Qt本身完全沒有觸及這個(gè)功能;它是為用戶方便而提供的。

至此,圖形視圖框架的三部分都翻譯完成。

以上就是關(guān)于pos機(jī)刷卡的翻譯,QGraphicsItem類官方文檔的中文翻譯的知識(shí),后面我們會(huì)繼續(xù)為大家整理關(guān)于pos機(jī)刷卡的翻譯的知識(shí),希望能夠幫助到大家!

轉(zhuǎn)發(fā)請帶上網(wǎng)址:http://m.shineka.com/newstwo/110397.html

你可能會(huì)喜歡:

版權(quán)聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻(xiàn),該文觀點(diǎn)僅代表作者本人。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如發(fā)現(xiàn)本站有涉嫌抄襲侵權(quán)/違法違規(guī)的內(nèi)容, 請發(fā)送郵件至 babsan@163.com 舉報(bào),一經(jīng)查實(shí),本站將立刻刪除。