I have changed to qml instead of pure python gui definition. Now I use this qml file, and it seems to work as expected:
@import QtQuick 1.0
import QtWebKit 1.0
import com.nokia.meego 1.0
Start with the tutorials and the examples. You need to learn the basic building blocks of such an application (and in general, the core Qt technologies). The main classes you're looking for are QLineEdit, QPlainTextEdit, QProcess.
I just installed the following Debian packages:
$ cd /usr/share/doc/libqtscript4-doc/examples
$ qs_eval CollidingMice.js
It looks just like the c++ one.
After trawling the web like you guys have, it's surprising that this isn't mentioned more prominently as a Qt resource.
What's up with that?
Never mind i solved it myself any ways thanks. Actually i had to generate ".qm" file for ".ts" then i have to replace "zh_CN.ts" with "zh_CN.qm" then everything worked great.
@ translator.load("zh_CN.qm") @
The reason why it probably crashes on Windows 7, is that the Python interpreter loses the reference to image data, and frees the memory.
For instance, in "PIL ImageQt.py":http://www.java2s.com/Open-Source/Python/GUI/Python-Image-Library/Imaging-1.1.7/PIL/ImageQt.py.htm the image data reference is separately stored into a class member variable:
# must keep a reference, or Qt will crash!
self.__data = data or im.tostring()
Once I did this in my conversion function/class, the conversion method works flawlessly on Windows 7. The reason why QPixmap doesn't save the data reference correctly to prevent automatic garbage collection (I guess) is a bit beyond me.
I think I did find a partial solution.
the nokia N900 has QtMobility 1.0.2 officially installed with the PR1.3 update. Through the pachages libqtm-11-dev or libqtm-12-dev is it possible to install the QtMobility 1.1 or 1.2. These libraries are installed in parallel to the official one, that's why the official python-qtmobility package is linked to the 1.0.2 version.
In maemo extras-devel I found another package:
these are the python libraries linked to the non official QtMobility 1.1 and as well can be installed in parallel to the official one. Infact the have been saved in:
I did create a symbolic link to these libraries in the officialfolder in which python is looking for:
ln -s /opt/qtm11/lib/python2.5/site-packages/QtMobility/ ./QtMobility11@
In these way I can access the QtMObility 1.1 from python:
@[sbox-FREMANTLE_X86: ~] > run-standalone.sh python2.5
Python 2.5.4 (r254:67916, May 17 2010, 21:11:14)
[GCC 4.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from QtMobility11 import Location
print dir (Location)
['QGeoAddress', 'QGeoAreaMonitor', 'QGeoBoundingArea', 'QGeoBoundingBox',
'QGeoBoundingCircle', 'QGeoCoordinate', 'QGeoManeuver', 'QGeoMapCircleObject',
'QGeoMapData', 'QGeoMapGroupObject', 'QGeoMapObject', 'QGeoMapObjectInfo',
'QLandmarkRemoveRequest', 'QLandmarkSaveRequest', 'QLandmarkSortOrder',
'QLandmarkUnionFilter', 'QNmeaPositionInfoSource', '_Cpp_Api', 'doc', 'file', 'name']@
As you can see there is now access to all the Location classes from QtMobility 1.1
Hope this can help in case you encounter similar trouble, and hope somewhen also a package for the 1.2 version appears... unfortunately I'm not able to do it myself :)
Thanks for the tip! It did solve the issue with the RuntimeError, but unfortunately I still don't see the button in the QML scene :(
If I discover how to make it work I will post it...
Thanks, Renato! The previous version works.
I'm really enjoying experimenting with PySide by the way. I've been waiting a long time for this and it is exceeding my expectations. Awesome work, guys!
This answer may be a little help but I hope it helps someone nevertheless.
In ImageWidget.loadImage, you create anim as a local variable. That means it's going to be garbage collected at the end of th call : as soon as the call is over, the animation is deleted, and won't have any effect.
There is two ways to solve the problem :
Define anim as an object attribute (@self.anim = …@)
Set anim as a child of the current object, so that it keeps a reference to anim and prevent the garbage collection (@anim = QtCore.QPropertyAnimation(pixmap, "opacity", self)@)
The problem was this line in dummgentest-project.txt.in
@output-directory = /tmp/output@
on windows this is likely going to fail. How about ./tmp-output?
I had to use a debugger to trace to see what files generatorrunner was opening.
The tests all pass on Visual Studio Pro 2005 x64
Thanks for the help,
I shared this recipe on my blog, with a QSingleApplication class for PySide that allows you to be sure your program will be started only once.
In addition to start the application only once, we can send the arguments of the later calls of your program to the first (and only remaining) instance.
Well the main code of the mock up example is there:
The main class it is using is there:
However, the error is raised almost never...
I even could not get the error after trying the mock up example more than 50 times.
Maybe I already fixed the error.
It used to appear sometimes only.
I'm not sure this mock-up is very meaningful, but maybe some people might find some huge mistakes in the main class.
This is very crappy coding by the way, this is my first PySide program and it was rapidly coded...
Oh yeah I didn't notice I have to "accept" the drag first, thanks ;)
If it helps anyone who was also wondering how to do a drag an drop in PySide, here is my working code:
def dropEvent(self, event):
def dragEnterEvent(self, event):
m = event.mimeData()
self.dropFile = m.urls().toLocalFile()
I never worked with native Cocoa/XIB files, so I cannot comment on this one. I would dig deeper into the alien widgets topic, though. Maybe "QMacCocoaViewContainer":http://doc.qt.nokia.com/latest/qmaccocoaviewcontainer.html can be of help for you here. It contains an example for including a NSSearchField into a Qt widget.
Hi Mifik! Congratulations - did not work for me. When installing one of the other packages, I receive a message "Python version 2.5 required". So you also installed Python 2.5?
I downloaded and installed Python 2.7.1 from http://python.org/download/. Which version did you use?
I think this is solution of your problem:
from PySide.QtGui import *
ImportError: /usr/local/lib/python2.7/site-packages/PySide/QtGui.so: Undefined symbol "_ZN9QGtkStyle11qt_metacastEPKc"
The current solution is to rebuild py-gui after changing your /etc/make.conf to include:
QT4_OPTIONS += QGTKSTYLE
The (partial) solution was this:
This ensures that individual items handle their own events, it seems that before the group was capturing them.
I still have a problem in that my GraphicsView overrides the mouseMoveEvent, and when enabled, no events get propagated to scene items.
Woops, I found the reason by myself...
@class myClass(anotherLib.originalClass, QtCore.QObject):
Adding the QObject parent class and calling it during the init
[quote author="pmcfrack" date="1300306178"]I know this is a rather old post, however, this is the exact problem I am trying to work around. Here is a link to my question: http://developer.qt.nokia.com/forums/viewthread/4402/#26159
Does anyone have a work around for this?
Perhaps you should start responding in that thread then again? It is not like you did not get any reactions there...