Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
853 Topics 3.3k Posts
  • 0 Votes
    1 Posts
    827 Views
    No one has replied
  • Preparing query for QSqlQUeryModel

    10
    0 Votes
    10 Posts
    6k Views
    S

    yes!!

  • 0 Votes
    6 Posts
    4k Views
    N

    Well that is why its not clear to me.
    One thing that the user can do to avoid the problem is to click on a node but not move the mouse.
    So no dragging (mouseMoveEvent) messages get sent - this seems to clear up the cache and subsequent mouse dragging does not incorrectly reposition the element at 0,0. So it seems mouse tracking is key to the fault. I agree it looks like bug in QT but it seems to me this bug must have been found by now if it really was a bug in QT. I think QtGui.QGraphicsItem is extensively used in QT apps. So I am reluctant to raise a bug report when it is more likely that my understanding of how QT works is flawed and incomplete.

    I have tried overriding the mouse drag event and stuffing a good position in there manually - but I have not succeeded at such a draconian method as keeping my own position and trying to determine when the new pos suddenly moves close to 0 (not exactly 0 mind - which would be easy - but 0 + the mouse delta).
    @
    def mouseMoveEvent(self,event):
    print event.pos(), event.scenePos(), event.screenPos()
    QtGui.QGraphicsItem.mouseMoveEvent(self, event)@

    The other area - but I can't see how it should affect it - would be to remove all weakrefs and see if there is some collision here with the mouse dragging behaviour. But I have not done this.
    Thanks for looking.

  • Pain and insanity: Unicode filenames and Qt

    4
    0 Votes
    4 Posts
    4k Views
    T

    Lots of fixes in that area have gone into Qt4.8, are you using that (or newer) ?

    It might also be good to check what the encoding is of the file on your filesystem. If you use Windows, it likely is not utf8. If you use Linux, its a 50% chance being utf8 or some other encoding.

  • 0 Votes
    2 Posts
    1k Views
    B

    Subclass QWindow. Reimplement an event handler such as FocusInEvent(event.). In your reimplementation, call the super handler, and also do your print.

    There may be a better event to snoop on. Probably the FocusInEvent() (receive the focus of keyboard events) comes after the window is painted, but I'm just guessing.

  • 0 Votes
    2 Posts
    3k Views
    S

    Did you try the implementation provided "here":http://qt-project.org/forums/viewthread/23852/ as both the posts are same.

  • Integration of PyQt/PySide issue

    2
    0 Votes
    2 Posts
    2k Views
    I

    The problem was due to mismatch of Qt libs versions.
    After that we solved issues with incompatibility of libs that are coming along with Salome (sip) and those that were installed
    in the system.

    But we still have some issues: We cannot pack commercial PyQt with VendorID in the hidden library.
    If i get it right, there is a mention of this possibility in the oficial document "VendorID - Signing Python Interpreters and Modules"
    (p.3.1 Creating Restricted Extension Modules).

    To figure out how Vedor ID works i created foo.py script that contained couple of functions,
    1 class and also foomodule.c file (identical to the one in example Reference Guide 3.1 Creating Restricted Extension Modules)

    After that we tried to create a library with the help of commands:

    @> python ~/VendorID-1.0.0/sib/sib.py -u foo.py@

    the folder build_foo is created with files makefile, main.c, frozen.c in it

    @> make@

    And we got the next message in the terminal:
    @gcc -pthread -Xlinker -export-dynamic main.o foo.o frozen.o -o foo -lpthread -ldl -lutil -lm -L/usr/local/lib -lpython2.6
    /usr/local/lib/libpython2.6.a(dynload_shlib.o): In function
    _PyImport_GetDynLoadFunc': /home/modeller/Python-2.6.6/Python/dynload_shlib.c:94: undefined reference to dlsym'
    /home/modeller/Python-2.6.6/Python/dynload_shlib.c:130: undefined reference to dlopen' /home/modeller/Python-2.6.6/Python/dynload_shlib.c:141: undefined reference to dlsym'
    /home/modeller/Python-2.6.6/Python/dynload_shlib.c:133: undefined reference to dlerror' ... /home/modeller/Python-2.6.6/Objects/floatobject.c:972: undefined reference to pow'
    /usr/local/lib/libpython2.6.a(longobject.o): In function
    PyLong_FromString': /home/modeller/Python-2.6.6/Objects/longobject.c:1610: undefined reference to log'
    /home/modeller/Python-2.6.6/Objects/longobject.c:1610: undefined reference to `log'
    collect2: executing lt finished with return code 1
    make: *** [foo] Error 1@

    The issue with PySide still remains: PySide is referring to a lib that has to be located in the system folder /usr/lib/i386-linux-gnu/libpyside-python2.7.so, while in our case all paths should be relative.

  • Can anyone make a PyQt bindings of VLC-Qt ?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Ubuntu: Failed update of PySide

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    5 Posts
    8k Views
    jazzycamelJ

    I am aware of the existence of QGesture, QGestureRecognizer etc., the example (and my Python port) probably predates this framework, I did create it sometime ago and only refreshed it in response to your original request for an example.

    In response to your subsequent request I have created an example with almost equivalent functionality using the newer methods. As before, it can be found on my blog "here":http://www.gulon.co.uk/2013/01/14/pyqt4-mouse-gestures-part-deux/.

  • C++ updating data to QML

    5
    0 Votes
    5 Posts
    7k Views
    W

    Do N3Roaster said. From "http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-exposecppattributes.html":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-exposecppattributes.html

    For maximum interoperability with QML, any property that is writable should have an associated NOTIFY signal that is emitted whenever the property value has changed.

  • QML/C++ bindings

    5
    0 Votes
    5 Posts
    7k Views
    W

    thanks, that was it!

  • PySide translations work just partially

    2
    0 Votes
    2 Posts
    2k Views
    J

    Yay! I finally managed to find the reason for the problem. Using a python multi-line text without indentation confuses the Qt translation system so that the following translations won't work. E.g.
    @

    def some_method(self):
    self.tr('This text gets translated correctly')

    def get_info(self):
    info_text = """<h1> My Program v. 1.0 </h1>
    <br>
    <br>
    This multi-line text is not meant to be translated, but it breaks the translations from the following tr() calls.
    """
    return info_text

    def another_method(self):
    self.tr('This text is not translated anymore because of the mutli-line text in method get_info.')
    @

    Should I add this issue to PySide bug tracker? (I don't have bug tracker account yet).

  • 0 Votes
    4 Posts
    3k Views
    P

    @redstoneleo,

    Post you solution if its solved. So it may help others.

  • List/TreeWidget vs. List/TreeView?

    2
    0 Votes
    2 Posts
    8k Views
    H

    Views works on model, widget versions works on inserted items.

    Read "Model View programming":http://qt-project.org/doc/qt-4.8/model-view-programming.html

  • Installing pyside and python 3.x

    2
    0 Votes
    2 Posts
    4k Views
    3

    Ok, so ... I finally got it to work. I ended up using
    @brew install pyside@

    Although there were a few things I still had to link up to make it work, overall it was not too painful. But now that I have it up and running I cant wait to try things out. :)

  • PyQT : are sprites available ?

    2
    0 Votes
    2 Posts
    2k Views
    D

    You could take a look at the Graphics View examples provided with PyQt to see if there's anything that looks like it might be useful.

  • 0 Votes
    3 Posts
    5k Views
    A

    This worked great! Thanks so much.

  • QtJambi: update Widget from a test

    2
    0 Votes
    2 Posts
    2k Views
    D

    call QApplication.processEvents(); before going to sleep() that should get you what you want, but it is not a good idea to ever wait/sleep during the startup sequence. This being the point between calling initialize() and exec().

    You want to call exec() as soon as possible to perform all other behaviour in response to eventing. So this means setting up the first state but never calling Thread.sleep() but using eventing instead.

    One way to do this maybe to make use of QObject.startTimer(int) to get a callback to the method QObject#timerEvent(QTimerEvent). So you subclass QObject and implement the @Override method and this replaces the Thread.sleep() usage with no need to ever call it.

    There are other Qt ways such as using a QTimer object and connecting the slot to a callback method of your choice that cycled through the states and changes UI, sets up QTimer for the next (or stops it) and immediately returns.

  • Memory Management in Qt/C++

    8
    0 Votes
    8 Posts
    4k Views
    G

    [quote author="Gerolf" date="1355228848"]e.g. in Main, you can create the widgets on the stack.
    If you have top level QObjects elsewhere where the stack is not possible, use smart pointers like shared pointers or others.[/quote]

    Hi Gerolf,

    Will you please give me some example related this to study because everything which is related to memory leak is going over my head. So it would be nice to have some example to go through and then decide how to about memory leaks.