Registered Member
|
I've been over de QtScript API a million times and I keep getting this error:
The function which generates this error is:
I can't get this to work and I can't find a single QtScript example on the internet (or Google is screwing with me). On a side note: I saw someone in PyQt4 using socket.connect to add signal handlers to the socket. I get errors that the connect function does not exists for a QTcpSocket and according to the most recent docs there is indeed no such function. Is it still possible to trap these events in QtScript? |
Registered Member
|
I figured out on my own how to parse XML using the API but the network connections are still an issue:
The qt.script import doesn't seem to do anything but I tried it because I wanted to do this:
Whatever I pass to the function it keeps throwing an error that the prototype is incorrect. The string and QHostAddress didn't seem to matter so I'm concluding that it must be the port parameter. But it seems that every number in QtScript is of the wrong type (I guess its a 32-bit integer)... So despite the claims that you can even open TCP connections from within Amarok - how do you actually do it? |
KDE Developer
|
.toUInt16() isn't a javascript method of integer that I'm familiar with. Adding exception handling catchers to your javascript is sometimes needed to figure out whats going on.
That said, I was poking at this code in the Amarok Script Console and I see your problem. I'll look into this issue.
Amarok Developer
|
Registered Member
|
As an alternative, it seems that the API can be modified for Amarok QtScript correct? How about making each function with a 16-bit int use a 32-bit constructor for QtScript? You could wrap it around the original one and even throw an exception when for example a unsigned short gets a 1.234.678 value assigned to it...
A direct solution would be even cooler but I sort of exhausted my keyword collection on Google and found nobody with this problem (or the solution) |
KDE Developer
|
Well it appears to me like a Qt bindings wrapper bug. I'm going to prepare a bug report and link it here.
Amarok Developer
|
KDE Developer
|
Bug submitted at:
http://code.google.com/p/qtscriptgenera ... d=29&can=1 Thanks for posting sample code and such, makes writing the bug report really easy. Hooopfully we're doing something wrong and it can be worked around. If its a bug then you'd have to wait until Amarok 2.0.2 at the earliest for a fix.
Last edited by Anonymous on Thu Jan 29, 2009 2:54 pm, edited 1 time in total.
Amarok Developer
|
Registered Member
|
I learned the hard way that figuring out whats wrong with my code is best handled by providing a snippet which blows up
Even if it is a bug I don't mind running SVN again, just upgraded last week to stable anyway |
Registered Member
|
The ticket has been updated to fixed. I was hoping on a workaround but I suppose this means fixed in SVN... How long will it take to propagate the fix into the Amarok SVN?
|
KDE Developer
|
Not long, just have to copy it over.
Amarok Developer
|
KDE Developer
|
Commited.
Edit: oh yea, thanks for pointing out that Kent fixed it. I hadn't noticed.
Last edited by Anonymous on Wed Feb 04, 2009 1:09 am, edited 1 time in total.
Amarok Developer
|
Registered Member
|
I have experienced the same problem, except that the proposed port.toUInt16()
code gives me a "not defined" error. If you have gotten this to work, please share a complete code snippet of how you did it. Here's my code that fails:
Thanks a lot for any help you give. |
Administrator
|
You are working differently to the original code sample.
Try changing it as below.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
I get this error:
ReferenceError QScriptValue is not defined. |
Administrator
|
Interestingly it worked for the OP. Unfortunately I do not know much about Javascript / QtScript so I do not know why this error is occurring. Have you tried removing the toUInt16() part?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Update: it still does not work in the latest stable builds... I wonder if the fix ever was committed to the release branch
|
Registered users: Bing [Bot], gfielding, Google [Bot], markhm, Sogou [Bot], Yahoo [Bot]