国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

QML Flickable

2019-11-08 02:07:27
字體:
供稿:網(wǎng)友

提供一個(gè)較小的視窗,顯示一個(gè)較大的內(nèi)容,內(nèi)容可在這個(gè)小視窗中進(jìn)行拖動. Flickable width: height: 指明可供瀏覽的視窗大小 contentWidth: contentHeight: 指明了內(nèi)容的大小

由于一個(gè)實(shí)現(xiàn)的細(xì)節(jié),放置在Flickable里面的項(xiàng)不能用id來anchor,而用parent代替 Flickable提供一個(gè)較小的視窗來顯示一個(gè)較大的內(nèi)容給用戶,并且用戶可以對改內(nèi)容進(jìn)行拖拽和輕拂。

接下來為大家說明一下Flickable 的一些常用屬性

contentX : real contentY : real 這個(gè)屬性返回內(nèi)容被輕拂時(shí),x,y方向(相對視窗左上角那個(gè)點(diǎn))的位移。 例如,如果你把圖片垂直挪動100像素點(diǎn),則contentY的值將變?yōu)?00


flicking : bool flickingHorizontally : bool flickingVertically : bool 這三個(gè)為只讀屬性,返回當(dāng)前視窗下,內(nèi)容是否被輕拂(輕彈),如果有,flicking返回true, 如果是沿豎直方向?qū)?nèi)容操作,則 flickingVertically 返回true, flickingHorizontally 返回false 如果是沿水平方向?qū)?nèi)容操作,則 flickingHorizontally 返回true, flickingVertically 返回false


horizontalVelocity : real verticalVelocity : real

這兩個(gè)是只讀屬性,放回當(dāng)前視窗下,內(nèi)容被輕拂(輕彈)時(shí),x,y方向的速度,單位是秒每像素點(diǎn)


maximumFlickVelocity : real 這個(gè)屬性可以限定當(dāng)前視窗下,內(nèi)容被輕拂的最大速度,由實(shí)現(xiàn)平臺限定默認(rèn)值


moving : bool movingHorizontally : bool movingVertically : bool 這三個(gè)為只讀屬性,返回當(dāng)前視窗下,內(nèi)容是否被拖動,如果有, moving 返回true, 如果是沿豎直方向?qū)?nèi)容操作,則 movingVertically 返回true, movingHorizontally 返回false 如果是沿水平方向?qū)?nèi)容操作,則 movingHorizontally 返回true, movingVertically 返回false


用來做滾動條的 visibleArea.heightRatio : real visibleArea.widthRatio : real visibleArea.xPosition : real visibleArea.yPosition : real 這四個(gè)為只讀屬性 這些屬性描述的是當(dāng)前視窗下,內(nèi)容的區(qū)域的位置和大小 visibleArea.heightRatio = height / contenHeight 比例 visibleArea.widthRatio = width / contentWidth 比例 visibleArea.xPosition = visibleArea.yPosition =

還是看個(gè)實(shí)例吧

[javascript] view plain copy 在CODE上查看代碼片派生到我的代碼片

Rectangle { width: 200; height: 200 Flickable { id: flickable ... } Rectangle { id: scrollbar anchors.right: flickable.right y: flickable.visibleArea.yPosition * flickable.height width: 10 height: flickable.visibleArea.heightRatio * flickable.height color: "black" } }

atXBeginning : bool atXEnd : bool atYBeginning : bool atYEnd : bool 這些屬性都為真,如果視窗的內(nèi)容剛好與視窗大小相符 These PRoperties are true if the flickable view is positioned at the beginning, or end respecively.


flickDeceleration : real 讓輕拂或拖動的速率減慢


flickableDirection : enumeration 這個(gè)屬性決定當(dāng)前視窗的內(nèi)容可以被操作的方向 This property determines which directions the view can be flicked.

Flickable.AutoFlickDirection (default) - 自動確定 Flickable.HorizontalFlick - 只允許水平操作 Flickable.VerticalFlick - 只允許垂直操作 Flickable.HorizontalAndVerticalFlick - 運(yùn)行水平和垂直方向的操作


pressDelay : int

這個(gè)屬性設(shè)置一個(gè)毫秒來延遲一個(gè)按鈕到達(dá)視窗內(nèi)的子項(xiàng) This property holds the time to delay (ms) delivering a press to children of the Flickable. 這可能是有用的,反應(yīng)前的新聞一閃的行動有著不良的影響。 This can be useful where reacting to a press before a flicking action has undesirable effects. 這可能是有用的,因?yàn)樵陧憫?yīng)一個(gè)按鈕之前,一個(gè)輕拂動作會導(dǎo)致不良的效果


interactive : bool 這個(gè)屬性描述用戶能否與當(dāng)前視窗進(jìn)行交互。當(dāng)視窗不能進(jìn)行交互(屬性值為false),用戶不能拖或者輕彈視窗內(nèi)容 通常,這個(gè)屬性的值為真


boundsBehavior : enumeration 這個(gè)屬性記錄了當(dāng)前視窗內(nèi)容的大小超過了視窗的邊界還是輕拂時(shí)越過視窗邊界。 這使得邊界實(shí)現(xiàn)羽化和柔和 boundsBehavior 可能是下面其中一個(gè)

Flickable.StopAtBounds - 內(nèi)容不能被拖出視窗邊界,輕拂時(shí)內(nèi)容也不會超出視窗邊界 Flickable.DragOverBounds - 內(nèi)容能被拖出視窗邊界,輕拂時(shí)內(nèi)容也不會超出視窗邊界 Flickable.DragAndOvershootBounds (default) - 內(nèi)容能被拖出視窗邊界,輕拂時(shí)內(nèi)容會超出視窗邊界


contentItem : Item

交互項(xiàng)被包含進(jìn)視窗,能被操作移動 交互項(xiàng)被聲明為視窗的子,被自動添加到視窗的contentItem屬性中去

Items created dynamically need to be explicitly parented to the contentItem:

[Javascript] view plain copy 在CODE上查看代碼片派生到我的代碼片

Flickable { id: myFlickable function addItem(file) { var component = Qt.createComponent(file) component.createObject(myFlickable.contentItem); } }

信號處理器

onFlickEnded 當(dāng)視窗內(nèi)容被輕拂后停止,觸發(fā) This handler is called when the view stops moving due to a flick.


onFlickStarted 當(dāng)視窗內(nèi)容剛被被輕拂時(shí),觸發(fā)

This handler is called when the view is flicked.

A flick starts from the point that the mouse or touch is released, while still in motion. onFlickStarted


onMovementEnded 當(dāng)視窗內(nèi)容停止移動時(shí),觸發(fā) This handler is called when the view stops moving due to user interaction. 如果是輕拂,則這個(gè)信號處理器將在 輕拂之后停止滑動 被觸發(fā) If a flick was generated, this handler will be triggered once the flick stops. 如果不是輕拂,當(dāng)用戶停止拖拽時(shí)被觸發(fā) If a flick was not generated, the handler will be triggered when the user stops dragging - i.e. a mouse or touch release.


onMovementStarted 視窗內(nèi)容剛被操作時(shí)觸發(fā) This handler is called when the view begins moving due to user interaction.


This documentation is under development and is subject to change.

方法文檔

Flickable::resizeContent ( real width, real height, QPointF center ) 用于重置視窗內(nèi)容尺寸

重置視窗內(nèi)容尺寸會導(dǎo)致內(nèi)容超過視窗的邊界,使用returnToBounds() 函數(shù)可以修復(fù)內(nèi)容的邊界到一個(gè)合法的范圍


Flickable::returnToBounds () 使用returnToBounds() 函數(shù)可以修復(fù)內(nèi)容的邊界到一個(gè)合法的范圍


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄱阳县| 达孜县| 永靖县| 治县。| 高青县| 营山县| 山丹县| 屏南县| 湄潭县| 巴楚县| 元朗区| 禄劝| 星座| 扶风县| 仁寿县| 山西省| 临城县| 洱源县| 景东| 开阳县| 噶尔县| 赣榆县| 米易县| 施秉县| 绥阳县| 贺州市| 彭山县| 吉安县| 阜新市| 兴和县| 海淀区| 开封县| 鹤峰县| 广水市| 苏尼特左旗| 姚安县| 南充市| 湖北省| 雅江县| 抚州市| 深泽县|