Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
853 Topics 3.3k Posts
  • PySideQwt revival

    10
    0 Votes
    10 Posts
    5k Views
    R

    http://www.pyqtgraph.org/
    pyqtgraph is a good alternative!

  • 0 Votes
    1 Posts
    806 Views
    No one has replied
  • 0 Votes
    5 Posts
    2k Views
    S

    Ahh, I didn't know about QLocalServer. I had originally looked at using python's socket library, but I didn't think about checking out Qt's. If it transparently handles signal/slots that might be the easiest approach. I'll give it a shot. Thanks!

    Edit: Okay, it looks like it doesn't handle signal/slots in the way I thought you meant. It doesn't transparently send them over the network. There does appear to be a third party library for that (QxtRPCPeer), but it doesn't have python bindings. I guess I'm stuck either going without a child GUI process or reimplementing the functionality provided by multiprocessing.Pipe.

  • DrawPixmapFragments in PySide

    1
    0 Votes
    1 Posts
    851 Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • PySide with Qt 5

    2
    0 Votes
    2 Posts
    13k Views
    R

    look at here
    http://lists.qt-project.org/pipermail/pyside/2013-November/001676.html

  • QTreeList Widget custom selection

    2
    0 Votes
    2 Posts
    3k Views
    jazzycamelJ

    The following is a simple attempt at what I think you want. This will allow the user to select multiple child items which have the same parent (top level item) but will only allow parents to be selected individually. It works by connecting to the "QTreeWidget":http://qt-project.org/doc/qt-4.8/qtreewidget.html itemSelectionChanged signal and inspecting newly selected indexes and comparing there relationship (if any) to the to the previously selected indexes, selecting and deselecting as appropriate:

    @
    from PyQt4.QtGui import *
    from PyQt4.QtCore import *

    class TreeWidget(QTreeWidget):
    diff=staticmethod(lambda l1,l2: filter(lambda x: x not in l1, l2))

    def __init__(self, parent=None, **kwargs): QTreeWidget.__init__( self, parent, selectionMode=QTreeWidget.ExtendedSelection, itemSelectionChanged=self._itemSelectionChanged, **kwargs) self._selected=[] @pyqtSlot() def _itemSelectionChanged(self): si=self.selectedIndexes() added=TreeWidget.diff(self._selected, si) block=self.blockSignals(True) self.selectionModel().clearSelection() for add in added: if add.parent().isValid(): # Must be a child item as it has a valid parent for index in self._selected: parent=add.parent() if (not index.parent().isValid()) or (index.parent()!=parent) or index==parent: try: si.remove(index) except ValueError: pass else: # Invalid parent therefore it is a toplevel (parent) item for index in self._selected: try: si.remove(index) except ValueError: pass for i in si: self.selectionModel().select(i, QItemSelectionModel.Select) self._selected=si self.blockSignals(block)

    class Widget(QWidget):
    def init(self, parent=None, **kwargs):
    QWidget.init(self, parent, **kwargs)

    l=QVBoxLayout(self) self._tree=TreeWidget(self, columnCount=1) l.addWidget(self._tree) for i in xrange(3): pItem=QTreeWidgetItem(self._tree, ['Parent {0}'.format(i)]) self._tree.addTopLevelItem(pItem) for j in xrange(3): cItem=QTreeWidgetItem(pItem, ['Child {0}.{1}'.format(i,j)]) pItem.addChild(cItem)

    if name=="main":
    from sys import argv, exit

    a=QApplication(argv) w=Widget() w.show() w.raise_() exit(a.exec_())

    @

    Hope this helps ;o)

  • 0 Votes
    2 Posts
    1k Views
    M

    Problem SOLVED. Make sure that you install prerequisites libphonon-dev!

  • How can I bind a functor WITH a receiver?

    2
    0 Votes
    2 Posts
    812 Views
    T

    I read source code, and I think there is a way if I can modify Qt header files.
    But is there any solution without header files modified?

    I use this feature for my Lua-binding project at : https://github.com/tdzl2003/luaqt

  • 0 Votes
    2 Posts
    1k Views
    R

    Hello people, my first question: is a good solution the creation of the QList class like a wrapper of the Python list?

    @class QList:
    def init(self):
    self.l = []

    def append(self, e): self.l.append(e) def at(self, i): return self.l[i] def prepend(self, e): self.l.insert(0, e) def size(self): return len(self.l)

    @

  • Is deleteLater() necessary in PyQt/PySide ?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • PyQt connect works on Windows but not on Linux

    1
    0 Votes
    1 Posts
    848 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    R

    I found it. @__STDC__@ should be #defined as "1", not empty.
    I posted a bug report at https://bugreports.qt-project.org/browse/PYSIDE-206 .

  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    K

    Closed for duplication

  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    Great !

    You're welcome !

    Please also update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • 0 Votes
    2 Posts
    2k Views
    A

    If I use this in the C library's .pro:

    @TARGET = main_AutroKeeper_Qt_PlainC # LIB
    TEMPLATE = lib # LIB
    CONFIG += staticlib # LIB@

    and in the lib header file:
    @#ifdef __cplusplus
    extern "C" {
    #endif

    extern void main_AutroKeeper_Qt_PlainC (void);

    #ifdef __cplusplus
    }
    #endif@

    and this in the C++ system's .pro that would use the lib above:

    @INCLUDEPATH += D:...\build-autrokeeper_Qt_plainC-AutroKeeper-Debug\debug
    DEPENDPATH += D:...\build-autrokeeper_Qt_plainC-AutroKeeper-Debug\debug

    LIBS += -LD:...\build-autrokeeper_Qt_plainC-AutroKeeper-Debug\debug -lmain_AutroKeeper_Qt_PlainC

    TEMPLATE = app@

    then C++ compiles and links and runs my C library.

    This included help from "http://stackoverflow.com/questions/10870145/qt-creator-using-external-libraries-within-my-own-library" plus a collegue.

    Obs no end '' in the paths to dirs.

    Was this ok?

    Now Q3 and QTimer are left. Since I have posted these questions, I feel obliged to tell if I solve it here? Is this etiquette here?

  • Load .UI files in PySide

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

    The following example should do what you want:

    @
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *

    class Dialog(QDialog):
    def init(self, parent=None, **kwargs):
    QDialog.init(self, parent, **kwargs)

    l=QVBoxLayout(self) l.addWidget(QLabel("Waiting...", self)) l.addWidget(QProgressBar(self, minimum=0, maximum=0))

    class MainWin(QDialog):
    def init(self, parent=None, **kwargs):
    QDialog.init(self, parent, **kwargs)

    l=QVBoxLayout(self) l.addWidget(QLabel("Ready!", self))

    class WasteCPUTime(QObject):
    finished=pyqtSignal()

    @pyqtSlot() def waste(self): self._timer=self.startTimer(10000) def timerEvent(self, event): self.finished.emit()

    if name=="main":
    from sys import argv, exit

    a=QApplication(argv) d=Dialog() d.show() m=MainWin() w=WasteCPUTime() t=QThread(started=w.waste) w.finished.connect(t.quit) t.finished.connect(m.show) t.finished.connect(d.hide) w.moveToThread(t) t.start() exit(a.exec_())

    @

    Generally speaking, its better to create an object with the functionality you require and move it to a QThread than it is to sub-class QThread directly. Also, this example uses signals and slots to communicate between threads rather than referencing the objects directly which I think is the cause of your issues.

    Also, you may want to look at "QSplashScreen":http://pyqt.sourceforge.net/Docs/PyQt4/qsplashscreen.html.

    Hope this helps ;o)