PDA

View Full Version : qtimeline doesn't run



Nfrancisj
27th March 2016, 09:15
hi all,

Firstly I'd like to apologize for the screenshot, rather than pasting the code. Internet went down, so I'm post from my phone.

I'm creating a image sequence player. I've loaded the image files into an array, where I then set the value of a slider to change the index which is sent to a qlable via pixmap.

I've created a timeline, where I set the seconds and range, and I hookup the timeline frame value, to the slider tick position.
And I print the value of the timeline...for debug

As you can see in the code, I call the function that creates and starts the timeline, but nothing happens. The print displays -0.0.

What am I missing?

Thanks All,



11814

anda_skoa
27th March 2016, 13:45
Are you sure that the problem is the timeline not running?
I.e. have you verfied that the connect line is actually valid syntax?

I am not a PythonQt user but both the (int) in the signal name and the () at the slot look wrong to me.

Btw, load into QImage, then scale, then convert into QPixmap.

QPixmap::load() needs to load into QImage and then convert to QPixmap. QPixmap::scaled() needs to convert to QImage, scale and convert back.
Two unecessary conversions.

Cheers,
_

Nfrancisj
28th March 2016, 05:12
I am not a PythonQt user but both the (int) in the signal name and the () at the slot look wrong to me.
_

I got the syntax from the docs here.
http://srinikom.github.io/pyside-docs/PySide/QtCore/QTimeLine.html#PySide.QtCore.PySide.QtCore.QTimeLi ne.frameChanged


I'll double check the syntax again when I'm in the office.

Thanks again for answering the call :)

anda_skoa
28th March 2016, 10:12
I got the syntax from the docs here.
http://srinikom.github.io/pyside-docs/PySide/QtCore/QTimeLine.html#PySide.QtCore.PySide.QtCore.QTimeLi ne.frameChanged

That must lead to a different page for me than it does for you, I don't see any connect example there.

Cheers,
_

Nfrancisj
28th March 2016, 10:38
hmm...im not sure why it leads somewhere else...but here is a screenshot.

11832

anda_skoa
28th March 2016, 10:49
I see, still not what you have.
You have parentheses at the signal and parentheses at the slot.
The example has brackets at the signal and nothing at the slot.

Cheers,
_

Nfrancisj
28th March 2016, 11:18
ill check on your last post regarding [int], but here is how i got it to work

i have to capture the value of 'currentframe' inside a function.
it feels like a messy workaround. In Qt framework, do SIGNALS broadcast a specific value?
for example, timeline.frameChanged, what does this signal send? is it the frame that it changed to, or just a true/false signal?
The setup below is me assuming its not an actual value that the slider can read. maybe thats why the (int)was there?



so it works by running the dummyFunc when the SINAL frame changed is emitted. that function gets the current frame of timeline and sets it to the slider.

ideas why the example code (in the screenshot) doesnt work for my case?




def dummyFunc():
self.horizontalSlider.setValue(self.timeline.curre ntFrame())

self.timeline = QtCore.QTimeLine(5000)
self.timeline.setFrameRange(0,100)
self.timeline.frameChanged.connect(dummyFunc)


self.pushButton.clicked.connect(self.timeline.star t)

Added after 14 minutes:

this works. i tried it with and without the [int]. both works.



self.timeline = QtCore.QTimeLine(5000)
self.timeline.setFrameRange(0,100)
self.timeline.frameChanged.connect(self.horizontal Slider.setValue)

self.pushButton.clicked.connect(self.timeline.star t)

thanks again
cheers!

anda_skoa
28th March 2016, 11:38
In Qt framework, do SIGNALS broadcast a specific value?

Those that have arguments do.



for example, timeline.frameChanged, what does this signal send?

The new frame number, the value "currentFrame" changed to.


frame is the current frame number.


Cheers,
_