å®éãSailfishã®ã¡ãã¥ãŒã®ã¡ã€ã³ãã¥ãŒã¯ã¡ãã¥ãŒã§ãç»é¢ã®äžéšã«è¡šç€ºãããŸãã ãã©ãããã©ãŒã èªäœã§ã¯ããžã§ã¹ãã£ãšãã®å©ããåããã¯ã€ãã¯ã³ã³ãããŒã«ã«éç¹ã眮ãããŠããããããžã§ã¹ãã£ã䜿çšããŠãã®ã¡ââãã¥ãŒã衚瀺ããŸããæã§äžããäžã«ã¹ã¯ã€ãããŸãã 次ã®ããã«ãªããŸããã¢ããªã±ãŒã·ã§ã³ã®ç»é¢ã§ã¡ãã¥ãŒã䜿çšã§ããå Žåãç»é¢ã®äžéšã«ã©ã€ãããŒã衚瀺ãããŸãã
ãã«ãµã€ãºã®ã¹ã¯ãªãŒã³ã·ã§ãã
ãã«ãµã€ãºã®ã¹ã¯ãªãŒã³ã·ã§ããã§ããããã®ã¹ããªããã¯ã»ãšãã©èå¥ã§ããŸããããå®éã®ããã€ã¹ã§ã¯é¡èã§ãã æ¯èŒã®ããã«ã以äžã¯åãç»é¢ã®ã¹ã¯ãªãŒã³ã·ã§ããã§ãããã¡ãã¥ãŒããªããããã«å¿ããŠããŒããããŸããã
ãã«ãµã€ãºã®ã¹ã¯ãªãŒã³ã·ã§ãã
ç»é¢ããã«ããŠã³ãããšããŸãã«ã¡ãã¥ãŒã衚瀺ãããŸãïŒ
SailfishOSã®ã¡ãã¥ãŒãšå¯Ÿè©±ããèå³æ·±ãæ©èœã¯ãã¡ãã¥ãŒé ç®ãéžæãã2ã€ã®æ¹æ³ãããããšã§ãã äžã®ã¹ã¯ãªãŒã³ã·ã§ããã®ããã«ãã¡ãã¥ãŒãå®å šã«è¡šç€ºããããŸã§äžã«ã¹ã¯ã€ãããã ãã§ãã ãã®åŸãç»é¢ã«æ®ããç®çã®ã¡ãã¥ãŒé ç®ãç°¡åã«ç¢ºèªã§ããŸãã ãããŠãããªãã¯ãããæåŸãŸã§åŒãäžããããšã¯ã§ããŸããããããŠãã¡ãã¥ãŒã衚瀺ããããšã以äžã®ã¹ã¯ãªãŒã³ã·ã§ããã®ããã«ããã®ã¢ã€ãã ã匷調衚瀺ãããŸãïŒ
ãã®æç¹ã§ç»é¢ããæãé¢ããšã匷調衚瀺ãããã¡ãã¥ãŒé ç®ãéžæãããŸãã
ãã«ããŠã³ã¡ãã¥ãŒ
Sailfishã§ãã®ãããªã¡ãã¥ãŒãå®è£ ããã®ã¯éåžžã«ç°¡åã§ãã ãã®ãããSailfish Silicaã«ã¯PullDownMenuã³ã³ããŒãã³ããååšããŸãã ãã ãããã®ã³ã³ããŒãã³ãã«ã¯ã䜿çšãéå§ããåã«ç¥ã£ãŠããå¿ èŠãããå€ãã®æ©èœããããŸãã
ãŸããã¡ãã¥ãŒèªäœã¯ã¹ã¯ã€ããžã§ã¹ãã£ã䜿çšããŠåŒã³åºãããããã PullDownMenuã¯ãã®ãžã§ã¹ãã£ãèš±å¯ããã³ã³ããå ã§ã®ã¿äœ¿çšã§ããŸãã Sailfish Silicaã§ã¯ããããã®ã³ã³ããã¯æ¬¡ã®ãšããã§ãã
- SilicaFlickableã¯ãã³ã³ãã³ããç»é¢ã®ãã¬ãŒã ã«å®å
šã«åãŸããªãå Žåã«ç»é¢ãã¹ã¯ããŒã«ã§ããæãåºæ¬çãªã³ã³ããã§ãã ãã®ã³ã³ããŒãã³ãã¯æšæºã®QML Flickableã³ã³ããŒãã³ããç¶æ¿ããã¢ããªã±ãŒã·ã§ã³ããŒãžã§ã¡ãã¥ãŒãå¿
èŠãªãšãã«äœ¿çšããå¿
èŠããããŸããã次ã®ã³ã³ããã¯ã©ããé©åã§ã¯ãããŸããã
- SilicaListView - ListViewã®æšæºQMLã³ã³ããŒãã³ããç¶æ¿ããèŠçŽ ã®ãªã¹ãã衚瀺ããã³ã³ããŒãã³ãã
- SilicaGridView-åã®ã³ã³ããŒãã³ããšåæ§ã«ãèŠçŽ ã®ãªã¹ãã衚瀺ããããã«äœ¿çšãããŸãããåçŽãªã¹ãã®åœ¢åŒã§ã¯ãªããã°ãªããã®åœ¢åŒã§è¡šç€ºãããŸãã GridViewã®æšæºQMLã³ã³ããŒãã³ããç¶æ¿ããŸã ã
- SilicaWebView -Webã³ã³ãã³ãã衚瀺ããããã®ã³ã³ããŒãã³ãã¯ã WebViewã®æšæºQMLã³ã³ããŒãã³ããç¶æ¿ããŸãã
第äºã«ã PullDownMenuã®ã³ã³ãã³ãã¯ã MenuItemãMenuLabelãªã©ã®ã³ã³ããŒãã³ãã§ããå¿ èŠããããŸãïŒå®éã«ã¯ããã§ã¯ãããŸããã以äžã®ããã¹ããåç §ïŒã 1ã€ç®ã¯ã€ã³ã¿ã©ã¯ãã£ããªã¡ãã¥ãŒé ç®ã§ã次ã®å€ãã®ããããã£ããããŸãã
- ããã¹ã -çŽæ¥ã¡ãã¥ãŒé ç®ã®ããã¹ãã
- color-åã®ããããã£ã§å®çŸ©ãããããã¹ãã®è²ã
- horizoâântalAlignment-ã¡ãã¥ãŒé ç®ããã¹ãã®æ°Žå¹³æ¹åã®é 眮ã Text.AlignLeft ã Text.AlignRight ã Text.AlignHCenter ïŒããã©ã«ãã§äœ¿çšïŒãŸãã¯Text.AlignJustifyã®ããããã®å€ã«ãªããŸãã
- down-ã¡ãã¥ãŒé ç®ãéžæããããšãããã®ããããã£ã®å€ã¯trueã§ãã
ãããã®ããããã£ã«å ããŠã MenuItemã«ã¯ããªãå€ãã®ãã©ã³ãã¿ã€ãããããã£ãå«ãŸããŠããŸãã ã¡ãã¥ãŒé ç®ã®ãã©ã³ããèšå®ããããïŒ ããã¥ã¡ã³ãã§ãããã«ã€ããŠèªãããšãã§ããŸã ïŒããã³onClickedïŒïŒã·ã°ãã«ãã³ãã©ã¯ããã®ã¡ãã¥ãŒé ç®ãéžæããããšãã«å®è¡ããªããã°ãªããªãã¢ã¯ã·ã§ã³ãå®çŸ©ããŸãã
MenuLabelã¯ãããã¹ãã衚瀺ããã ãã§æŒãããšãã§ããªãéçãªã¡ãã¥ãŒé ç®ã§ãã ãã®ãããªã¢ã€ãã ã¯ãããšãã°ãã¡ãã¥ãŒã¿ã€ãã«ãšããŠããŸãã¯ã€ã³ã¿ã©ã¯ãã£ãã¡ãã¥ãŒã¢ã€ãã éã®ã»ãã¬ãŒã¿ãšããŠäœ¿çšãããŸãã åœç¶ã MenuLabelã«ã¯PullDownMenuãããå°ãªãããããã£ãå«ãŸããŠããŸãã
- text-ã¡ãã¥ãŒé ç®ã®ããã¹ãã
- color-åã®ããããã£ã§å®çŸ©ãããããã¹ãã®è²ã
- verticalOffset-åçŽã€ã³ãã³ãã
UPDïŒãã¡ããã PullDownMenuã®ã³ã³ãã³ãã¯ããã®èšäºã§èª¬æããä»ã®ã¡ãã¥ãŒãšåæ§ã«ã MenuItemãMenuLabelã ãã§ãªããã©ã®ã³ã³ããŒãã³ãã§ãããŸããŸããã ãã ããä»ã®ã³ã³ããŒãã³ãã䜿çšããå Žåãéçºè ã¯å¯Ÿè©±ããžãã¯å šäœãèªåã§å®è£ ããå¿ èŠããããŸãã ãããŠããã®ãããªã¡ãã¥ãŒã¯ãã¯ããã€ãã£ãã«èŠããªãã®ã§ããŸããªå Žåã«ã®ã¿ãã®ãããªæ©äŒã䜿çšãã䟡å€ããããŸãã æšæºçãªç¶æ³ã§ã¯ã MenuItemãšMenuLabelã§ååãªã®ã§ããã®èšäºã§ã¯ã¡ãã¥ãŒå ã®ä»ã®ã³ã³ããŒãã³ãã®äœ¿çšã¯èæ ®ãããŸããã
PullDownMenuã䜿çšããæå°éã®ãµã³ãã«ããŒãžã¯æ¬¡ã®ããã«ãªããŸãã
Page { id: page SilicaFlickable { anchors.fill: parent contentHeight: column.height PullDownMenu { MenuItem { text: qsTr(" 3") onClicked: console.log(" ") } MenuLabel { text: qsTr("") } MenuItem { text: qsTr(" 2") onClicked: console.log(" ") } MenuItem { text: qsTr(" 1") onClicked: console.log(" ") } MenuLabel { text: qsTr(" ") } } Column { id: column width: page.width spacing: Theme.paddingLarge PageHeader { title: qsTr(" ") } Label { text: ", !" width: page.width horizontalAlignment: Text.AlignHCenter font.pixelSize: Theme.fontSizeExtraLarge } } } }
ã¡ãã¥ãŒèªäœã¯æ¬¡ã®ããã«ãªããŸãã
PullDownMenuå ã®ã¡ãã¥ãŒé ç®ã¯ãã¹ã¯ã€ããžã§ã¹ãã£ã§ç»é¢ã«è¡šç€ºãããé åºã§ã¯ãªããã¡ãã¥ãŒèªäœã«äžããäžã«è¡šç€ºãããé åºã§æ±ºå®ãããããšã«æ³šæããŠãã ããã ãã®æ©èœã¯ãæåã¯çããèŠãããããããŸããã ããã«ãäžèšã®äŸã¯æ å ±æäŸã®ã¿ãç®çãšããŠããŸãããå®éã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸãå€ãã®ã¡ãã¥ãŒé ç®ãç¹ã«MenuLabelã³ã³ããŒãã³ãã䜿çšããªãã§ãã ããã
PullDownMenuããããã£
PullDownMenuã«ã¯ããã®å€èŠ³ãšåäœãã«ã¹ã¿ãã€ãºã§ããå€æ°ã®ããããã£ãå«ãŸããŠããŸãã ããšãã°ã次ã®ããããã£ã䜿çšããŠã³ã³ããŒãã³ãã®ããã£ã³ã°ãèšå®ã§ããŸãã
- éé -ã¡ãã¥ãŒã®äžç«¯ãšããŒãžã³ã³ãã³ãã®äžç«¯ãšã®éã®è·é¢ã ããã©ã«ãã§ã¯ããã®å€ã¯ãŒãã§ãã
- topMargin-ã¡ãã¥ãŒã®äžç«¯ïŒãããç»é¢ã®ã¿ãããšåãïŒãšæäžäœã®ã¡ãã¥ãŒé ç®ã®äžç«¯ã®éã®è·é¢ã ããã©ã«ãã§ã¯ããã®å€ã¯Theme.itemSizeSmallã§ãã
- bottomMargin-äžçªäžã®ã¡ãã¥ãŒé ç®ã®äžç«¯ãšã¡ãã¥ãŒèªäœã®äžç«¯ã®éã®è·é¢ã
æåŸã®ããããã£ïŒ bottomMargin ïŒã®èå³æ·±ãæ©èœã¯ãã¡ãã¥ãŒã®å 容ã«å¿ããŠããã©ã«ãå€ãå€åããããšã§ãã æäœã®ã¡ãã¥ãŒé ç®ãMenuLabelã®å Žåãããããã£å€ã¯0ã§ãããã以å€ã®å Žåãããããã£å€ã¯MenuLabelã³ã³ããŒãã³ãã®é«ããšçãããªããŸãã 以äžã®äŸã§éãã確èªã§ããŸãã
|
|
ã¹ã¯ãªãŒã³ã·ã§ããã«èŠãããããã«ããã®æ©èœã䜿çšãããšãã¿ã€ãã«ã®æç¡ã«é¢ä¿ãªããåžžã«åãã¡ãã¥ãŒã®é«ãã䜿çšã§ãããããããŸããŸãªã¿ã€ãã®ã¡ãã¥ãŒã䜿çšããéã®ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãç¯çŽã§ããŸãã
寞æ³ã«å ããŠã次ã®ããããã£ã䜿çšããŠPullDownMenuã®ä»ã®å€èŠ³ãã©ã¡ãŒã¿ãŒãå€æŽããããšãã§ããŸãã
- background-ã¡ãã¥ãŒã®èæ¯ãšããŠäœ¿çšãããã³ã³ããŒãã³ãã説æã§ããŸãã
- backgroundColor-ã¡ãã¥ãŒã®èæ¯è²ã ã·ã¹ãã èªäœãæå®ãããè²ã«ã°ã©ããŒã·ã§ã³ãé©çšããããšã¯æ³šç®ã«å€ããŸãã
- highlightColor-éžæãããã¡ãã¥ãŒé ç®ã®ãã€ã©ã€ãè²ãããã³ã¡ãã¥ãŒèªäœãéãããããšãã«ç»é¢ã®äžéšã«è¡šç€ºãããã¡ãã¥ãŒã€ã³ãžã±ãŒã¿ãŒã
- menuIndicator-ã¡ãã¥ãŒèªäœãéãããããšãã«ç»é¢ã®äžéšã«è¡šç€ºãããã¡ãã¥ãŒã®ã€ã³ãžã±ãŒã¿ãŒãšããŠäœ¿çšãããã³ã³ããŒãã³ããèšè¿°ããããšãã§ããŸãã
ã¡ãã¥ãŒã®è²ãäžèšã®äŸãã次ã®ããã«å€æŽã§ããŸãã
backgroundColor: "red" highlightColor: "green"
次ã«ã次ã®åœ¢åŒã®ã¡ãã¥ãŒãååŸããŸãã
ãã¡ããæãããã§ããããããã®ããããã£ãã©ã®ããã«æ©èœãããã瀺ããŠããŸãã ãŸãã èæ¯ãšmenuIndicatorã®å©ããåããŠãããšãã°ãç»åãèæ¯ããã³ã¡ãã¥ãŒã€ã³ãžã±ãŒã¿ãŒãšããŠèšå®ã§ããŸãã
äžèšã®ããããã£ã¯ãã¢ããªã±ãŒã·ã§ã³å šäœã®ããã«ãããšãã°äŒç€Ÿã®è²ã§ã¡ãã¥ãŒãå®è¡ããå Žåã«åœ¹ç«ã¡ãŸãã ãããã®ããããã£ã«å ããŠã PullDownMenuã³ã³ããŒãã³ãã«ã¯ãã¡ãã¥ãŒã®ã¹ããŒã¿ã¹ãååŸããããåäœãç°¡åã«å€æŽãããã§ããããããã£ãå«ãŸããŠããŸãã
- active-ã¡ãã¥ãŒãå®å šã«ãŸãã¯éšåçã«ç»é¢ã«è¡šç€ºãããŠããå Žåã«å€ãtrueã«ãªãè«çåã®ããããã£ã
- busyã¯ããŒã«åã®ããããã£ã§ããããŸãã å€ãtrueã«èšå®ãããŠããå Žå ãç»é¢äžéšã®ã¡ãã¥ãŒã€ã³ãžã±ãŒã¿ãŒããèåããå§ããŸãã ãã®å Žåãã¡ãã¥ãŒèªäœã¯åŒãç¶ã䜿çšå¯èœã§ãã ãã®ããããã£ã¯ãäœããã®ããã»ã¹ããŸã é²è¡äžã§ããããšããŠãŒã¶ãŒã«ç€ºãããå Žåã«äœ¿çšãããšäŸ¿å©ã§ãã
- flickable-ãã®ããããã£ã䜿çšãããšãã¡ãã¥ãŒãã¢ã¯ãã£ãã«ããããªãã¯å¯èœãªã³ã³ããŒãã³ããæå®ã§ããŸãã ã€ãŸã PullDownMenuãã³ã³ããå ã«é 眮ãã代ããã«ããã®ã³ã³ããã«ãã®ããããã£ã®å€ãæå®ããã ãã§æžã¿ãŸãã
- quickSelect-ã¡ãã¥ãŒã®ã¯ã€ãã¯éžææ©èœãæå¹ã«ã§ããè«çã¿ã€ãã®ããããã£ã ãã®æ©èœã¯ãã¢ã€ãã ã1ã€ã ãã®ã¡ãã¥ãŒã§ã®ã¿æ©èœããŸãã ãã®æ©èœãæå¹ã«ãããšãã¡ãã¥ãŒã®ã¹ã¯ããŒã«ïŒæåŸãŸã§å«ãïŒã§ããã®å¯äžã®ã¢ã€ãã ãèªåçã«éžæãããŸãã
æåŸã«ã PullDownMenuã«ã¯2ã€ã®ã¡ãœãããå«ãŸããŠããŸãã ã¡ãã¥ãŒé ç®ãéžæãããšããã®ã¡ãã¥ãŒã¯éããããçµäºã¢ãã¡ãŒã·ã§ã³ãåçãããŸãã ãã®ã¢ãã¡ãŒã·ã§ã³ã¯ãããšãã°ãåžæããã¡ãã¥ãŒé ç®ã®onClickedïŒïŒãã³ãã©ãŒã§åŒã³åºãå Žåã cancelBounceBackïŒïŒã¡ãœããã䜿çšããŠãã£ã³ã»ã«ã§ããŸãã ããã¯ãã¡ãã¥ãŒãéãããšã¡ãã¥ãŒé ç®ã«å²ãåœãŠãããã¢ã¯ã·ã§ã³ã®å®è¡ã劚ããããããšããŸããªå Žåã«åœ¹ç«ã¡ãŸãã
closeïŒïŒã¡ãœããã䜿çšãããšãã¡ãã¥ãŒãæåã§éããããšãã§ããŸãã åæã«ããã®ã¡ãœããã®åŒæ°ãšããŠtrueãæå®ãããšãã¢ãã¡ãŒã·ã§ã³ãªãã§ã¡ãã¥ãŒãããã«éããŸãã ããšãã°ã次ã®ã³ãŒãã§ã¯ãã¡ãã¥ãŒé ç®ãã¡ãã¥ãŒé ç®2ããéžæãããšãã¡ãã¥ãŒã¯ã¢ãã¡ãŒã·ã§ã³ãªãã§éããŸãã
PullDownMenu { id: menu MenuItem { text: qsTr(" 2") onClicked: menu.close(true) } MenuItem { text: qsTr(" 1") onClicked: console.log(" ") } }
ãã·ã¥ãã
å¥ã®ã¿ã€ãã®ã¡ãã¥ãŒ-PushUpMenu-ã¯åãPullDownMenuã§ã ãå¯äžã®éãã¯ããã®ã¡ãã¥ãŒãç»é¢ã®äžéšããã§ã¯ãªãäžéšãã衚瀺ããããããäžããäžãžã®ãžã§ã¹ãã£ãŒã§ã¹ã¯ã€ããã¢ã¯ãã£ãã«ãªãããšã§ãã PushUpMenuã¯PullDownMenuãšåãããã«èŠãããã®ããããã£ãšã¡ãœããã¯ãã¹ãŠPullDownMenuã®ããããã£ãšã¡ãœããã«äŒŒãŠããããããã®èšäºã§åå¥ã«èšåããå¿ èŠã¯ãããŸããã
ãã ãã PushUpMenu ïŒããã³PullDownMenu ïŒã¯ã¹ã¯ã€ããžã§ã¹ãã£ãŒãèš±å¯ããã³ã³ãããŒå ã«ããå¿ èŠãããããããã®ãããªã¡ãã¥ãŒã®ã¢ã¯ãã£ãåã¯ãã³ã³ãããŒã®ãã¹ãŠã®ã³ã³ãã³ããæåŸãŸã§ã¹ã¯ããŒã«ãããåŸã«ã®ã¿çºçããããšã«æ³šæããŠãã ããã ã€ãŸãããªã¹ãããŒãžã«PushUpMenuãé 眮ãããšããŠãŒã¶ãŒããªã¹ãå šäœãæåŸãŸã§ã¹ã¯ããŒã«ããåŸã«ã®ã¿ããã®ã¡ãã¥ãŒãã¢ã¯ãã£ãã«ãªããŸãã
ã³ãŒãã§ã¯ããã®ãããªäŸã¯æ¬¡ã®ããã«ãªããŸãã
Page { id: page SilicaListView { PushUpMenu { MenuItem { text: qsTr(" 3") onClicked: console.log(" ") } MenuItem { text: qsTr(" 2") onClicked: console.log(" ") } MenuItem { text: qsTr(" 1") onClicked: console.log(" ") } MenuLabel { text: qsTr(" ") } } id: listView model: 20 anchors.fill: parent header: PageHeader { title: " " } delegate: BackgroundItem { id: delegate Label { x: Theme.paddingLarge text: " #" + index anchors.verticalCenter: parent.verticalCenter color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor } } VerticalScrollDecorator {} } }
ãã®çµæããªã¹ãå šäœãæåŸãŸã§ã¹ã¯ããŒã«ããå Žåã«ã®ã¿ã¡ãã¥ãŒã«ã¢ã¯ã»ã¹ã§ããŸãã
|
|
ContextMenu
ãã®èšäºã§èª¬æããSailfishOSã®æåŸã®ã¡ãã¥ãŒã¿ã€ãã¯ãã³ã³ããã¹ãã¡ãã¥ãŒã§ãã ContextMenuã³ã³ããŒãã³ãã䜿çšããŠå®è£ ãããä»»æã®ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹èŠçŽ ã«é¢é£ä»ããããšãã§ãããããã¢ããã¡ãã¥ãŒã§ãã ãã®ãããªã¡ãã¥ãŒã®ã³ã³ãã³ãã¯ã MenuItemã³ã³ããŒãã³ããšMenuLabelã³ã³ããŒãã³ãã䜿çšããŠã PushUpMenuããã³PullDownMenuãšåãæ¹æ³ã§èª¬æãããŸãã
ã»ãšãã©ã®å Žåããã®ãããªã¡ãã¥ãŒã¯ãªã¹ãã¢ã€ãã ã®ã³ã³ããã¹ãã¡ãã¥ãŒãå®è£ ããããã«äœ¿çšãããŸãã ãã®ããããªã¹ãããªã²ãŒããèšè¿°ããããã«äœ¿çšãããListItemã³ã³ããŒãã³ãã«ã¯ãç¹å¥ãªã¡ãã¥ãŒããããã£ããããŸãã ãããã£ãŠãæåŸã®äŸã®ãªã¹ãé ç®ã«ã³ã³ããã¹ãã¡ãã¥ãŒãè¿œå ã§ããŸãã ãããè¡ãã«ã¯ãããªã²ãŒãããããã«å€æŽããŠListItemãä»ããŠå®è£ ããã¡ãã¥ãŒèªäœãè¿œå ããå¿ èŠããããŸãã
delegate: ListItem { id: delegate Label { id: label x: Theme.paddingLarge text: " #" + index anchors.verticalCenter: parent.verticalCenter color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor } menu: ContextMenu { MenuLabel { text: " " } MenuItem { text: " " onClicked: label.font.bold = !label.font.bold } MenuItem { text: " " onClicked: label.font.italic = !label.font.italic } } }
ãªã¹ãã¢ã€ãã ãé·ã¿ãããããšããã®äžã«ã³ã³ããã¹ãã¡ãã¥ãŒã衚瀺ãããŸãã
ãã®ã¡ãã¥ãŒããã¢ã€ãã ãéžæãããšããªã¹ãã¢ã€ãã ã®ããã¹ãã¹ã¿ã€ã«ãå€æŽãããŸãã
|
|
ã¡ãã¥ãŒé ç®ã®ãããããéžæããããåã«ãã®ã¡ãã¥ãŒã®å€åŽãã¿ãããããšãã³ã³ããã¹ãã¡ãã¥ãŒãéããŸãã ãã ãã ListItemã³ã³ããŒãã³ãã«ã¯hideMenuïŒïŒããã³showMenuïŒïŒã¡ãœãããå«ãŸããŠãããã³ã³ããã¹ãã¡ãã¥ãŒãæåã§é衚瀺ãŸãã¯è¡šç€ºã§ããŸãã æåŸã®ã¡ãœããã¯ãã¡ãã¥ãŒã«é©çšãããContextMenuã³ã³ããŒãã³ãã®ããããã£ã®ãªã¹ãããã©ã¡ãŒã¿ãŒãšããŠæž¡ãããšãã§ããŸãïŒ ContextMenuã³ã³ããŒãã³ãã®ããããã£ã«ã€ããŠã¯åŸã»ã©èª¬æããŸãïŒã ããã«ã ListItemã³ã³ããŒãã³ãã®showMenuOnPressAndHoldããããã£ãfalseã«èšå®ããããšã«ããããªã¹ãã¢ã€ãã ã®ã³ã³ããã¹ãã¡ãã¥ãŒã®æšæºåäœãå€æŽã§ããŸã ã ãã®å ŽåãèŠçŽ ãé·æŒãããŠãã³ã³ããã¹ãã¡ãã¥ãŒã¯è¡šç€ºãããŸããã æåŸã«ãã³ã³ããã¹ãã¡ãã¥ãŒã衚瀺ãããã©ããã¯ã ListItemã³ã³ããŒãã³ãã®menuOpenããããã£ã䜿çšããŠå¯èœã§ãã
ã³ã³ããã¹ãã¡ãã¥ãŒãéåžžã®ã€ã³ã¿ãŒãã§ã€ã¹èŠçŽ ã«é¢é£ä»ããããšã«ããããªã¹ãã®å€åŽã«è¡šç€ºããããšãã§ããŸãã ãã®ããã ContextMenuã³ã³ããŒãã³ãã«ã¯showïŒïŒã¡ãœããããããŸãããã®ã¡ãœããã«ã¯ãã¡ãã¥ãŒã衚瀺ããããã®èŠçŽ ãåŒæ°ãšããŠæž¡ãããŸãã ãã®å Žåãã¡ãã¥ãŒã¯ãã®èŠçŽ ã®äžã®å¢çç·ã«ã¢ã¿ããããã衚瀺ããããšäžåãã«è¡šç€ºãããŸãã ãã®ãããªã¡ãã¥ãŒã䜿çšããæå°éã®äŸã¯æ¬¡ã®ãšããã§ãã
Page { id: page SilicaFlickable { id: flickab anchors.fill: parent contentHeight: column.height Column { id: column width: page.width spacing: Theme.paddingLarge PageHeader { title: qsTr(" ") } Button { id: button text: " " width: page.width onClicked: contextMenu.show(label) } Label { id: label height: page.height / 2 text: " " verticalAlignment: Text.AlignBottom } } ContextMenu { id: contextMenu MenuLabel { text: " " } MenuItem { text: qsTr(" 1") onClicked: console.log(" ") } } } }
ãã®ããŒãžã¯æ¬¡ã®ããã«ãªããŸãã
ãããŠããã¿ã³ãã¯ãªãã¯ãããšãã¡ãã¥ãŒã¯ç¢æã®äžç«¯ãé¢ããŸãïŒ
ããã§ãç¢æã®é«ãã誀ã£ãŠå€§ãããããŠããªãããšã«æ³šæããŠãã ããïŒããŒãžã®ååïŒã å®éã«ã¯ãã³ã³ããã¹ãã¡ãã¥ãŒã¯showïŒïŒã¡ãœããã§æå®ãããã³ã³ããŒãã³ãå ã«æ£ç¢ºã«è¡šç€ºãããã¡ãã¥ãŒããã®èŠçŽ ããã倧ããå Žåã¯ãåã«åãåãããŸãã ãã®æ©èœã瀺ãããã«ãäžèšã®äŸã§ã¯ãç¢æã®é«ããéåžžã«èšå®ãããã¿ã³ãšç¢æã®éã«çœãé·æ¹åœ¢ãé 眮ã§ããŸãã
Button { id: button text: " " width: page.width onClicked: contextMenu.show(label) } Rectangle { color: "white" height: page.height / 2 width: parent.width } Label { id: label text: " " }
次ã«ãããŒãžã¯æ¬¡ã®ããã«ãªããŸãã
ãããŠãã¡ãã¥ãŒã¯éãããšãã«åããŸãïŒ
UPDïŒæ°äººã芳å¯ããŠããããã«ãäžèšã®äŸã¯å®å šã«æåããŠããããã§ã¯ãããŸããã å®éã®ãããžã§ã¯ãã§ã¯ãã³ã³ããã¹ãã¡ãã¥ãŒãåç §ããèŠçŽ ããã倧ããå Žåãã¡ãã¥ãŒãéããŠãããã©ããã«å¿ããŠèŠçŽ ã®ãµã€ãºãå€æŽãã䟡å€ããããŸãã ãã®å Žåãäžèšã®ãµã³ãã«ã³ãŒãã¯ã Labelã³ã³ããŒãã³ãã®é«ããã¡ãã¥ãŒã«å¿ããŠå€æŽããå¿ èŠããããŸãã
Label { id: label text: " " height: contentHeight + (contextMenu.visible ? contextMenu.height : 0) }
次ã«ãããŒãžèªäœã¯æ¬¡ã®ããã«ãªããŸãã
ãããŠãã¡ãã¥ãŒãã¿ã³ãã¯ãªãã¯ãããšãç¢æãèŠèŠçã«äžããçµäºããŸãã
hideïŒïŒã¡ãœããã䜿çšããŠã³ã³ããã¹ãã¡ãã¥ãŒãéãã ã¢ã¯ãã£ãããããã£ã䜿çšããŠéããŠãããã©ããã確èªã§ããŸãã ããã«ã ContextMenuã³ã³ããŒãã³ãã«ã¯closeOnActivationããããã£ãå«ãŸããŠããã ãã®ããããã£ã䜿çšããŠãã¢ã€ãã ãéžæãããšãã«ã¡ãã¥ãŒãéãããã©ãããèšå®ã§ããŸãã ãŸãã hasContentããããã£ã¯ãã¡ãã¥ãŒã«ã³ã³ãã³ãããããã©ããã確èªããã®ã«åœ¹ç«ã¡ãŸãã ãã®ããããã£ã¯ã·ã¹ãã èªäœã«ãã£ãŠäœ¿çšãããŸããhasContentå€ãfalseã®å Žåã showïŒïŒã¡ãœãããåŒã³åºãããå Žåã§ãã¡ãã¥ãŒã¯è¡šç€ºãããŸããã
æåŸã«ã ContextMenuã«ã¯ãã¡ãã¥ãŒé ç®ãéžæããããã³ã«åŒã³åºãããonActivatedïŒïŒã·ã°ãã«ãã³ãã©ãå«ãŸããŠããŸãã ãã³ãã©ãŒåŒæ°ã¯ãéžæãããã¡ãã¥ãŒé ç®ã®ã€ã³ããã¯ã¹ã§ãã
ããã ãã§ã ãã®èšäºã§ã¯ãSailfishOSã®3ã€ã®äž»èŠãªæšæºã¿ã€ãã®ã¡ãã¥ãŒã«ã€ããŠèª¬æãããããã®å®è£ æ¹æ³ãšåã¿ã€ãã®æ©èœã«ã€ããŠèª¬æããŸããã
æçš¿è ïŒDenis Laure
UPDïŒèšäºã®ããã¹ããæŽæ°ãããéä¿¡ããããã¹ãŠã®ã³ã¡ã³ããèæ ®ãããŸããã ã³ã¡ã³ããã³ã¡ã³ããéã£ãŠãããã¿ããªã«æè¬ããŸãã