Re: [Interest] sizeHint for delegates not wqorking
Ah, thanks a lot! That did indeed fix it. Cheers, frank On 3/07/18 11:56 PM, Francis Herne wrote: On Tuesday, 3 July 2018 03:11:42 BST Frank Rueter | OHUfx wrote: Hi all, I am having trouble controlling my table view’s column sizes. I thought implementing the delegate’s sizeHint was a way to do this but it won’t work for me. Can somebody please point out what I’m missing? You must also set an appropriate resize mode for the view. Adding `self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)` to MyView.__init__ should solve your problem. See http://doc.qt.io/qt-5/qheaderview.html#ResizeMode-enum -Francis ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Duration property of PropertyAnimation
Probably not the most helpful, but you could more easily fix this by doing a Behavior on the animation instead. But this is a reverse handling, the Transform will hold the Behavior which hold the NumberAnimation. The bahavior have an enabled property. http://doc.qt.io/qt-5/qml-qtquick-behavior.html Maybe this could help. From: Interest on behalf of Marco Trapanese Sent: July 3, 2018 2:51 PM To: interest@qt-project.org Subject: [Interest] Duration property of PropertyAnimation Hi to all, I'm working on a project that use Qt 5.9.2 on RPi3B+, with eglfs platform. Here a full working code: > import QtQuick 2.9 > import QtQuick.Window 2.3 > > Window { > visible: true > > property real _degree: 0 > property real _time: 50 > > Component.onCompleted: move() > > function move() > { > _degree += 360 / 12 > animStep.start() > } > > Image { > source: "file:///home/pi/resources/images/needle.png" > x: 300 > y: 400 > > transform: Rotation { > id: rotSpin > origin.x: 62 > origin.y: 194 > } > } > > SequentialAnimation { > id: animStep > NumberAnimation { target: rotSpin; property: "angle"; > easing.type: Easing.Linear; to: _degree; duration: _time; } > onStopped: move() > } > } The purpose of this code is to animate an image like a clock hand. Of course this is a simple example, my actual code is more complex. The approach is to animate the needle for 30 degrees (360 / 12) and then advance for other 30 degrees. This is because I will need to stop the animation when certain conditions are met (i.e. I cannot set the animation 'to' property to 360 * N) It works fine if the duration property is above about 45 ms. Below this threshold the animation doesn't speed up anymore. The docs say nothing about a minimum value. I'm aware the refresh rate of the monitor doesn't allow faster animation, but I would expect the animation would complete in the given time (duration) even without any intermediate frames. The problem here is instead it takes the same amount of time! I mean, even if I set duration = 10 ms, it take the same amount of time like when duration = 40 ms. Hence, I think it would complete a whole cycle in 120 ms, instead it takes something like 480 ms! Is there a way to force PropertyAnimation to honor the duration property even if it cannot draw intermediate frames? Best regards Marco ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Duration property of PropertyAnimation
Hi to all, I'm working on a project that use Qt 5.9.2 on RPi3B+, with eglfs platform. Here a full working code: import QtQuick 2.9 import QtQuick.Window 2.3 Window { visible: true property real _degree: 0 property real _time: 50 Component.onCompleted: move() function move() { _degree += 360 / 12 animStep.start() } Image { source: "file:///home/pi/resources/images/needle.png" x: 300 y: 400 transform: Rotation { id: rotSpin origin.x: 62 origin.y: 194 } } SequentialAnimation { id: animStep NumberAnimation { target: rotSpin; property: "angle"; easing.type: Easing.Linear; to: _degree; duration: _time; } onStopped: move() } } The purpose of this code is to animate an image like a clock hand. Of course this is a simple example, my actual code is more complex. The approach is to animate the needle for 30 degrees (360 / 12) and then advance for other 30 degrees. This is because I will need to stop the animation when certain conditions are met (i.e. I cannot set the animation 'to' property to 360 * N) It works fine if the duration property is above about 45 ms. Below this threshold the animation doesn't speed up anymore. The docs say nothing about a minimum value. I'm aware the refresh rate of the monitor doesn't allow faster animation, but I would expect the animation would complete in the given time (duration) even without any intermediate frames. The problem here is instead it takes the same amount of time! I mean, even if I set duration = 10 ms, it take the same amount of time like when duration = 40 ms. Hence, I think it would complete a whole cycle in 120 ms, instead it takes something like 480 ms! Is there a way to force PropertyAnimation to honor the duration property even if it cannot draw intermediate frames? Best regards Marco ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] sizeHint for delegates not wqorking
On Tuesday, 3 July 2018 03:11:42 BST Frank Rueter | OHUfx wrote: > Hi all, > > I am having trouble controlling my table view’s column sizes. > I thought implementing the delegate’s sizeHint was a way to do this but > it won’t work for me. > > Can somebody please point out what I’m missing? You must also set an appropriate resize mode for the view. Adding `self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)` to MyView.__init__ should solve your problem. See http://doc.qt.io/qt-5/qheaderview.html#ResizeMode-enum -Francis ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest