Setting radio button as group box title - qt

Is it possible to place radio button as group box header in qml. If yest can you give me some hint how can be done. I saw option to change title to check box but it doesn't feet my solution.

It's not currently possible to do this with GroupBox, as it doesn't offer a styling API. You have these options:
Use the checkable property, which gives you a CheckBox, not a RadioButton, as you know.
Use the private GroupBoxStyle type and then define your own checkbox component that is a RadioButton. This is private API though, which means it can change at any point.
Somehow place a non-interactive but visual item over the top of the CheckBox that is produced with the checkable property, and filter the events that would go to that checkbox. This is quite difficult, and I'm not sure if it would work.
Write your own GroupBox, using the code I linked to above as a starting point.

Ok so what I have done based on previous (i hope:)) things is:
style: GroupBoxStyle {
padding {
top: (control.title.length > 0 || control.checkable ? TextSingleton.implicitHeight : 0) + 5
left: 8
right: 8
bottom: 6
}
checkbox:Item {
implicitWidth: 18
implicitHeight: 18
BorderImage {
anchors.fill: parent
border.top: 6
border.bottom: 6
border.left: 6
border.right: 6
}
Rectangle {
width: Math.round(TextSingleton.implicitHeight)
height: width
gradient: Gradient {
GradientStop {color: "#eee" ; position: 0}
GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.4}
GradientStop {color: "#fff" ; position: 1}
}
border.color: control.activeFocus ? "#16c" : "gray"
antialiasing: true
radius: height/2
anchors.left: parent.left
anchors.leftMargin: 5
anchors.top: parent.top
anchors.topMargin: 2
Rectangle {
anchors.centerIn: parent
width: Math.round(parent.width * 0.5)
height: width
gradient: Gradient {
GradientStop {color: "#999" ; position: 0}
GradientStop {color: "#555" ; position: 1}
}
border.color: "#222"
antialiasing: true
radius: height/2
Behavior on opacity {NumberAnimation {duration: 80}}
opacity: control.checked ? control.enabled ? 1 : 0.5 : 0
}
}
BorderImage {
anchors.fill: parent
anchors.margins: -1
visible: control.activeFocus
border.left: 4
border.right: 4
border.top: 4
border.bottom: 4
opacity: 0
}
}
What I get is:
And I have one more question is there an options to be set to disable opacity on radio button and text
Maybe someone may review this solution and tell me if it is ok.
Update:
Additionaly if your add:
panel:Item{
anchors.fill: parent
Loader {
id: checkboxloader
anchors.left: parent.left
sourceComponent: control.checkable ? checkbox : null
anchors.verticalCenter: label.verticalCenter
width: item ? item.implicitWidth : 0
}
Rectangle {
anchors.fill: parent
anchors.topMargin: padding.top - 7
border.color: "gray";
radius: 7;
color: "transparent"
visible: !control.flat
z: -2
}
Rectangle {
anchors.top: parent.top
anchors.left: checkboxloader.right
anchors.margins: 4
width: label.width
height: label.height
color: parent.color
z: -1
}
Text {
id: label
anchors.top: parent.top
anchors.left: checkboxloader.right
anchors.margins: 4
text: control.title
color: textColor
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
opacity: 1
z: 0
}
}
Group box looks like:
This solution was done based on Mitch post

Related

Implementing a slider in QML with a VU-meter like image as a background

I am trying to create a slider that I can move up and down with my mouse. However, I want to use my own image as the background. I am currently trying to implement this with a OpacityMask. Basically, I am trying to make the opacity 0 from where the handle is to the right end of the slider.
I would ordinarily just move a rectangle that is same color as the background over it. However, I want whatever element is under the slider to be displayed when the slider is pulled back.
How can I create this behavior?
import QtQuick 2.7
import QtQuick.Templates 2.0 as T
import QtGraphicalEffects 1.12
import "."
T.Slider {
id: control
implicitWidth: 200
implicitHeight: 26
handle: Rectangle {
x: control.visualPosition * (control.width - width)
y: (control.height - height) / 2
width: 20
height: 15
radius: 5
color: control.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: "gray"
}
background: OpacityMask {
anchors.fill: sliderImage
source: sliderImage
maskSource: mask
}
Image{
id: sliderImage
source: "./Jarvis2/images/volume_barH.png"
height: 20
width: parent.width
visible: false
}
Item{
id: mask
anchors.fill: sliderImage
Rectangle{
id: outer
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: control.visualPosition*parent.width
color: "gray"
opacity: 1
visible: false
}
Rectangle {
id: inner
color: "transparent"
z: 1
opacity: 1
anchors.left: outer.right
anchors.right: parent.right
anchors.top: outer.top
anchors.bottom: outer.bottom
visible: false
}
}
}
The slider at 100%:
The slider at around 70%:
The slider at around 24%
I think you can omit the OpacityMask and simply use a clipping Item:
Slider {
id: slider
width: 100
height: 300
orientation: Qt.Vertical
background: Item {
id: background
Item {
clip: true
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: (1 - slider.visualPosition) * slider.height
Rectangle { //Your image goes here
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: background.height
gradient: Gradient {
GradientStop { position: 0; color: "blue" }
GradientStop { position: 1; color: "red" }
}
}
}
}
}
You might have to fiddle a bit with the height of the clipping Item since there is some padding involved.
If you nevertheless want to use OpacityMask (because you want a different shape), you should put them together in the background:
Slider {
id: slider
width: 100
height: 300
orientation: Qt.Vertical
background: Item {
id: background
Rectangle { //Your image goes here
id: image
anchors.fill: parent
visible: false
gradient: Gradient {
GradientStop { position: 0; color: "blue" }
GradientStop { position: 1; color: "red" }
}
}
OpacityMask {
anchors.fill: parent
source: image
maskSource: mask
}
Item {
id: mask
visible: false
anchors.fill: parent
Rectangle {
radius: 10
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: parent.height * slider.position
color: "white"
}
}
}
}

z ordering of elements qt qml

I'm struggling with an issue and I can't find a solution.
I am developing an embedded device (a graphic interface for an oven) with Qt.
I have the main page where I have a SwipeView with a grid inside to show n-tiles.
The tile is defined in another object.qml that I call in the main page and on each tile I have an image with 3 dots and when you click on it, a popup comes out that lets you edit the tile.
The problem is showing this popup because when I click on the three-dot-image the popup object shows underneath the tile and I can't seem to solve this problem.
I tried changing the z property but it doesn't work.
Anyway, I'm gonna attach some code and two images of the interface.
Thank you
MyPgRecipeGrid.qml this is my main page
import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
SwipeView {
id: view
property int numProgrammi : myVar.progCategoryRecipeGrid.count
currentIndex: 0
width:parent.width
height: parent.height*0.75
anchors.top: searchRect.bottom; anchors.topMargin: parent.height*0.025
Repeater {
id: gridRepeat
property int numgrid: ((Math.floor(view.numProgrammi/12)) + (((view.numProgrammi%12)==0) ? 0 : 1))
model: numgrid
delegate: Rectangle {
color: "transparent"
GridView {
id:grid
width: parent.width*0.95; height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
clip: false
property int numPage: index
cellWidth: 190; cellHeight: 180
interactive: false
model: 12 //Draws 12 tiles
delegate: Rectangle {
width: grid.cellWidth; height: grid.cellHeight
color: "transparent"
TileCategoryRecipeGrid {
property int indicelista: ((grid.numPage * 12)+index < myVar.progCategoryRecipeGrid.count) ? ((grid.numPage * 12 )+index) : 0
visible: ((grid.numPage*12)+index) < view.numProgrammi ? true : false
nomeTypCat: qsTr(myVar.progCategoryRecipeGrid.get(indexlist).nameCategory)
urlimageTypCat: myVar.progCategoryRecipeGrid.get(indexlist).urlCategoryImage
emptyTypCat: myVar.progCategoryRecipeGrid.get(indexlist).emptyCategory
userTypCat: myVar.progCategoryRecipeGrid.get(indexlist).userCategory
}
}
}
}
}
}
TileCategoryRecipeGrid.qml this is where I build the tile
import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
//Tile
Button{
id: tileCategoryRecipeGrid
width: 180; height: 172
property string myFont: myVar.medium
property string myFont2: myVar.fontTile
background: Rectangle {
anchors.fill: parent;
color: "transparent"; radius: 2
opacity: parent.down ? 0.80 : 1
clip: true
Image {
anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenterOffset: -10
source: image
}
}
}
Button{
id: btnPoints
width: 35; height: 35
anchors.right: parent.right; anchors.rightMargin: 3
anchors.top: parent.top; anchors.topMargin: 3
background: Rectangle {
id: threePoints
anchors.fill: parent;
color: "transparent";
opacity: parent.down ? 0.25 : 1
Image {
anchors.fill: parent
source: contextMenu.visible ? "qrc:/QmlContents/IMG/close_btn.png" : "qrc:/QmlContents/IMG/threepoints.png"
}
}
onClicked: {
contextMenu.visible == false ? contextMenu.visible = true : contextMenu.visible = false
indexLocationPopup = index
}
}
Text {
id: showCookingTime
anchors.left: parent.left; anchors.leftMargin: 42
anchors.top: parent.top; anchors.topMargin: 3
text: qsTr("00:20"); color: clrPaletta.white
font.family: myFont; font.pixelSize: 20
}
contentItem: Rectangle{
anchors.fill: parent; opacity: parent.down ? 0.80 : 1
color: "transparent"
Text{
color: clrPaletta.white; opacity: 0.50
text: qsTr("cooking type")
font.family: myFont ; font.pixelSize: 17
anchors.left: parent.left ; anchors.leftMargin: parent.width*0.05
anchors.bottom: parent.bottom; anchors.bottomMargin: parent.height*0.10
}
//Popup edit tile
ContextMenuEditTile {
id: contextMenu
visible: false
x: {
switch(indexLocationPopup) {
case 0: dp(parent.width*0.60); break
case 1: -dp(parent.width-parent.width*0.70); break
case 2: -dp(parent.width-parent.width*0.70); break
case 3: dp(parent.width*0.60); break
case 4: -dp(parent.width-parent.width*0.70); break
case 5: -dp(parent.width-parent.width*0.70); break
case 6: dp(parent.width*0.60); break
case 7: -dp(parent.width-parent.width*0.70); break
case 8: -dp(parent.width-parent.width*0.70); break
case 9: dp(parent.width*0.60); break
case 10: -dp(parent.width-parent.width*0.70); break
case 11: -dp(parent.width-parent.width*0.70); break
}
}
y: {
switch(indexLocationPopup) {
case 0: dp(parent.height-parent.height*0.75); break
case 1: dp(parent.height-parent.height*0.75); break
case 2: dp(parent.height-parent.height*0.75); break
case 3: dp(parent.height-parent.height*0.75); break
case 4: dp(parent.height-parent.height*0.75); break
case 5: dp(parent.height-parent.height*0.75); break
case 6: dp(parent.height-parent.height*0.75); break
case 7: dp(parent.height-parent.height*0.75); break
case 8: dp(parent.height-parent.height*0.75); break
case 9: -dp(parent.height+parent.height*0.30); break
case 10: -dp(parent.height+parent.height*0.30); break
case 11: -dp(parent.height+parent.height*0.30); break
}
}
z: ((indexLocationPopup >= 0) && (indexLocationPopup <= 11)) ? 99 : 0
}
}
}
ContextMenuEditTile.qml and this is my popup
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
Rectangle {
id:contextMenu
width: 245; height: 265
visible: false
radius: 2;
color: clrPaletta.tileMenuclr1
ListView {
id:listView
anchors.fill: parent; clip: true;
boundsBehavior: Flickable.StopAtBounds
model: ListModel{
id: model
ListElement{ name:qsTr("Accessories"); urlImage: "qrc:/QmlContents/IMG/accessories.png" }
ListElement{ name:qsTr("Copy"); urlImage: "qrc:/QmlContents/IMG/copy.png" }
ListElement{ name:qsTr("Rename"); urlImage: "qrc:/QmlContents/IMG/rename_folder.png" }
ListElement{ name:qsTr("Modify"); urlImage: "qrc:/QmlContents/IMG/move_icon.png" }
ListElement{ name:qsTr("Delete"); urlImage: "qrc:/QmlContents/IMG/delete_folder.png" }
}
delegate: Button{
id:buttonLista
width: parent.width; height: listView.height/5
contentItem: Rectangle {
anchors.fill: parent; color: "transparent"
opacity: this.down ? 0.80 : 1
Rectangle{
width: parent.width; height: 1;
color: clrPaletta.lineTileContxMenu
anchors.bottom: parent.bottom;
visible: model.index < 4 ? true : false
}
Text {
id:testoItem
text: qsTr(name)
font.capitalization: Font.Capitalize; font.family: myVar.fontTile
color: clrPaletta.black; font.pixelSize: 18
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left; anchors.leftMargin: 65
}
Image {
id:imageList
source: urlImage
anchors.left: parent.left; anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
}
}
}
}
}
Just have a Item { id: overlay } that is last in main.qml, this way it is guaranteed to be on top of the rest of the content, and show up your popup parented to the overlay.
It will be better to have at most one of those at a time and centered in the screen for better user experience. You could however map the particular tile position to the screen to have the popup appear relative to it.
It will also be nice if the popup has an underlay that fills the "empty" area, so clicking outside of the popup closes it.
This means you won't have to bother with any manual z ordering whatsoever. Besides, it would only work for close siblings and such, good luck achieving the desired results in your use case...
Here is a quick example how you could reuse a single popup menu and have it connected to an arbitrary item to access its functionality:
Window {
visible: true
width: 600
height: 300
GridView {
id: view
model: 6
anchors.fill: parent
cellWidth: 200
cellHeight: 150
delegate: Rectangle {
id: dlg
width: 200
height: 150
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
function foo() { return index }
MouseArea {
anchors.fill: parent
onClicked: menu.item = dlg // to open the menu for this item
}
}
}
Item { // the overlay
anchors.fill: parent
visible: menu.item
MouseArea {
anchors.fill: parent
onClicked: menu.item = null // close the menu
}
Rectangle {
color: "black"
anchors.fill: parent
opacity: .5
}
Rectangle {
color: "white"
anchors.fill: menu
anchors.margins: -10
}
Column {
id: menu
anchors.centerIn: parent
property Item item: null
Button {
text: "index"
onClicked: console.log(menu.item.foo())
}
Button {
text: "color"
onClicked: console.log(menu.item.color)
}
}
}
}
You could try to create your context menu dynamically with SwipeView component set as parent:
var comp = Qt.createComponent("ContextMenuEditTile.qml");
var contextMenu = comp.createObject(view);
With this solution you do not need to struggle around with z-index values. At least when you use asynchonous Loader component the z-index will not work at all.
After creating the context menu you have to set your x and y values accordingly:
contextMenu.x = (your big switch case)
contextMenu.y = (your big switch case)
contextMenu.visible = true;
Read that first : http://doc.qt.io/qt-5/qml-qtquick-item.html#z-prop
the Z property order sibling items.
The problem here is only hierarchy, try to change your root, use rect or other instead of swipeview and make your swipeview and your button its childrens.

qt5/qml: how to implement advanced/addon/details switch? [duplicate]

I want to create an animated accordion-like element that expands on click. Here's how it should work.
When the user clicks one of the red rectangles, the green rectangle which is the actual content, should expand. I want this expansion to be animated. The height of the contents of the green rectangles could be different for each red header.
I have been able to implement the click-to-expand behavior, but there's no animation. Here is the code I currently have.
AccordionElement.qml
import QtQuick 2.5
import QtQuick.Layouts 1.1
ColumnLayout {
id: rootElement
property string title: ""
property bool isOpen: false
default property alias accordionContent: contentPlaceholder.data
anchors.left: parent.left; anchors.right: parent.right
// Header element
Rectangle {
id: accordionHeader
color: "red"
anchors.left: parent.left; anchors.right: parent.right
height: 50
MouseArea {
anchors.fill: parent
Text {
text: rootElement.title
anchors.centerIn: parent
}
cursorShape: Qt.PointingHandCursor
onClicked: {
rootElement.isOpen = !rootElement.isOpen
}
}
}
// This will get filled with the content
ColumnLayout {
id: contentPlaceholder
visible: rootElement.isOpen
anchors.left: parent.left; anchors.right: parent.right
}
}
And this is how it is used from the parent element:
Accordion.qml
ColumnLayout {
Layout.margins: 5
visible: true
AccordionElement {
title: "Title1"
accordionContent: Rectangle {
anchors.left: parent.left; anchors.right: parent.right
height: 20
color: "green"
}
}
AccordionElement {
title: "Title2"
accordionContent: Rectangle {
anchors.left: parent.left; anchors.right: parent.right
height: 50
color: "green"
}
}
AccordionElement {
title: "Title3"
accordionContent: Rectangle {
anchors.left: parent.left; anchors.right: parent.right
height: 30
color: "green"
}
}
// Vertical spacer to keep the rectangles in upper part of column
Item {
Layout.fillHeight: true
}
}
This produces the following result (when all rectangles are expanded):
Ideally I would like the green rectangles to roll out of the red rectangles (like paper out of a printer). But I am stuck on how to do this. I have tried several approaches using the height property, and I got the green rectangle to disappear but the white space remains under the red rectangle.
Any help would be appreciated. Is there an approach I'm missing?
Here is a quick and simple example:
// AccItem.qml
Column {
default property alias item: ld.sourceComponent
Rectangle {
width: 200
height: 50
color: "red"
MouseArea {
anchors.fill: parent
onClicked: info.show = !info.show
}
}
Rectangle {
id: info
width: 200
height: show ? ld.height : 0
property bool show : false
color: "green"
clip: true
Loader {
id: ld
y: info.height - height
anchors.horizontalCenter: info.horizontalCenter
}
Behavior on height {
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
}
}
}
// Acc.qml
Column {
spacing: 5
AccItem {
Rectangle {
width: 50
height: 50
radius: 50
color: "blue"
anchors.centerIn: parent
}
}
AccItem {
Rectangle {
width: 100
height: 100
radius: 50
color: "yellow"
anchors.centerIn: parent
}
}
AccItem {
Rectangle {
width: 75
height: 75
radius: 50
color: "cyan"
anchors.centerIn: parent
}
}
}
You are needlessly over-complicating it with the anchors and the layouts. It doesn't seem the problem calls for any of those.
Update: I slightly refined the implementation, compared to the initial one the content would actually slide out of the header as paper out of printer rather than simply being unveiled, and also removed the source of a false positive binding loop warning.

QML - Opacity of stacked elements

I have two items that are stacked. Both items have a semi-transparent background. The circle now shows the the rounded rect below.
Is there any way I can hide the part of the long rounded rect that overlaps with the circle? Maybe changing the parent, that the background of the circle is pulled from the ancestor higher up, and therefore ignoring the rect immediately below it?
Here is the code:
Item
{
id: choice1
width: 300
height: 100
Rectangle
{
id: choiceLabel1
width: 0
height: parent.height / 1.5
radius: parent.height * 0.5
color: "#88808080"
anchors
{
verticalCenter: choice1.verticalCenter
left: choice1.left
leftMargin: choiceIcon1.width / 2
}
border
{
width: 2
color: "red"
}
}
Rectangle
{
id: choiceIcon1
width: choice1.height
height: choice1.height
radius: width * 0.5
color: "#88808080"
anchors
{
verticalCenter: choice1.verticalCenter
left: choice1.left
}
border
{
width: 2
color: "red"
}
}
}
A solution, albeit a bit hacky would be to implement your own QML MultiRectangle component, which allow to set an opacity and draw a border around a bunch of QML Rectangle
MultiRectangle.qml
import QtQuick 2.0
Item
{
id: root
layer.enabled: true
property int borderWidth: 2
property color borderColor
Component
{
id: rectangle
Rectangle{}
}
Component.onCompleted:{
var temp = children.length
for(var i=0; i<temp; i++)
rectangle.createObject(this,
{
"z":-100,
"anchors.centerIn": children[i],
"color": borderColor,
"width": children[i].width+borderWidth*2,
"height": children[i].height+borderWidth*2,
"radius": Math.max((children[i].height+borderWidth*2)
/children[i].height*children[i].radius,
(children[i].height+borderWidth*2)
/children[i].height*children[i].radius)
})
}
}
This will dynamically create a pseudo border behind the rectangles added to a MultiRectangle item.
Example
import QtQuick 2.5
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Window {
id: root
visible: true
height: 200
width: 400
RadialGradient {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "white"}
GradientStop { position: 0.3; color: "#444"}
GradientStop { position: 1; color: "white"}
}
}
MultiRectangle {
anchors.centerIn: parent
width: 300
height: 100
borderWidth: 2
borderColor: "red"
opacity: 0.5
Rectangle {
color: "cyan"
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: parent.borderWidth
height: parent.height - 2 * parent.borderWidth
width: height
radius: height / 2
}
Rectangle {
color: "cyan"
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: parent.borderWidth
anchors.top: parent.top
height: 10
width: height
radius: height / 2
}
Rectangle {
color: "cyan"
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenterOffset: 30
anchors.margins: parent.borderWidth
anchors.top: parent.top
height: 30
width: height
radius: height / 2
}
Rectangle {
color: "cyan"
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 50
height: parent.height * 0.6
anchors.right: parent.right
anchors.margins: parent.borderWidth
radius: height / 2
}
}
}
Result
Note that since layer.enabled is set to true, clip is also set to true. Therefore, the border of child items too close to the MultiRectangle bounds will be clipped.

qml textedit with slider

Does anyone know how to create a textEdit that can wrap using a slider?
i tried to do it but i got a problem with binding loop...
code:
Flickable
{
id: flick
anchors.fill:parent
contentWidth: edit.paintedWidth
contentHeight: edit.paintedHeight
clip: true
interactive :false
contentY: slider.y
function ensureVisible(r)
{
if (contentY >= r.y)
contentY = r.y;
else if (contentY+height <= r.y+r.height)
contentY = r.y+r.height-height;
}
TextEdit
{
id: edit
width: flick.width*0.9
height: flick.height
focus: true
wrapMode: TextEdit.Wrap
onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
text: defaultText
color: textColor
font.family: fontFamily
font.pointSize: fontSize
font.bold: bold
font.italic: italic
font.overline: overline
font.underline: underline
horizontalAlignment: alignment
selectByMouse:true
}
}
Rectangle
{
id: container
height: multiLineEdit.height
width:multiLineEdit.width*0.1
anchors.right:multiLineEdit.right
anchors.top:multiLineEdit.top
radius: 4
opacity: 0.7
smooth: true
gradient: Gradient {
GradientStop { position: 0.0; color: "gray" }
GradientStop { position: 1.0; color: "white" }
}
Rectangle {
id: slider
property int value: Math.round(container.y*100/(slider.width-container.width))
property int tmpVal: 0
x: 1
y: flick.visibleArea.yPosition * flick.height//1
width: parent.width
//The height will change according to the flickable area (the text area)
height: (flick.visibleArea.heightRatio > 1) ? (container.height) :(flick.visibleArea.heightRatio*container.height)
radius: 2
smooth: true
color:"black"
MouseArea {
anchors.fill: parent
drag.target: parent; drag.axis: Drag.YAxis
drag.minimumY: 0; drag.maximumY: container.height - slider.height
}
}
}
in this way i create a textEdit and a slier at the right side of the textEditBox. the slider is now move according to the text, but it(the slider) doe's not control the textEdit box... how i can add this action? (in my way it bring a binding loop)
Maybe you could grab keyboard button press event with a custom slot if key event match left and right arrow i.e.
Please take a look here: link for QWidget::grabKeyboard()

Resources