Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
867 Topics 3.4k Posts
  • 0 Votes
    2 Posts
    1k Views
    jazzycamelJ
    Try decorating the slot as follows: @ ... @QtCore.Slot def method(self): print("Signal received") ... @ Hope this helps ;o)
  • PySide - Interacting with SQLite through Qt vs. native Python?

    2
    0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi, It really all depends on how you are going to use the database. If you are planning to use Qt's Model/View paradigm then using the QtSql module would be the logical choice. However you could also implement your own model using python's sql. You should start by looking at your requirements. Then if both qualifies, just try each to see which one fits your needs better. Hope it helps
  • Qt/TCL bindings

    2
    0 Votes
    2 Posts
    3k Views
    SGaistS
    Hi and welcome to devnet, The bindings are not provided by the Qt project. You should rather try to contact the libraries authors.
  • 0 Votes
    1 Posts
    4k Views
    No one has replied
  • 0 Votes
    3 Posts
    6k Views
    I
    Thanks Dheerendra, A solution was proposed "here":http://stackoverflow.com/questions/25744109/pyqt-qtableview-header-how-to-add-top-right-small-button-to-hide-show-column-wi/25752676?noredirect=1#comment40275860_25752676.
  • [PyQt] How can I access QTableModel by primary key index

    2
    0 Votes
    2 Posts
    1k Views
    I
    Many thanks to David Cortesi hwo sent me the following Email: is there a way to have instead: self.myQTableModel.setData( self.myQTableModel.index(primaryKeyIndex, col), value) QAbstractTableModel is extremely abstract! It offers no relational functions, only index() and parent(). It is up to you to make the table model real by adding code. The documentation says you must implement rowCount, columnCount, and data(), and also setData if you want it to be modifiable. But you may implement other functions. In your situation I would implement a method pkRow(keyvalue) which returns the row number that corresponds to a given primary key value. Then your statement becomes, self.myModel.setData( self.myModel.index( self.myModel.pkRow(keyvalue), col ), value_for_col) To save keystrokes, you could write a pkIndex(keyvalue, col) method (built on top of pkRow). Then: self.myModel.setData( self.myModel.pkIndex(keyvalue,col), value_for_col) You pkRow method could perhaps cache the recent keyvalues it has seen, to save time. Note there is also a class QSqlRelationalTableModel, but it does not have any key-dependent methods either. But if your real data is simple SQL table perhaps you should use that.
  • QtDesigner module in PySide

    3
    0 Votes
    3 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, Best thing to do is ask the PySide developers on their making-list, you'll probably get a quicker answer there
  • How to access to a qml object from javascript

    4
    0 Votes
    4 Posts
    3k Views
    p3c0P
    Hi, Your first way is correct @ button.text = "toto" @ you can avoid the onTextChanged handler if you solely want to assign the text, @ function init(parent) { var button = Qt.createQmlObject('import QtQuick 2.2; CustomButton {width:100; height:100}', parent, "dynamicSnippet1"); button.mytext = "toto" } Item { property string mytext Button { id:button width: 100 height: 62 x : 100 y : 100 text: mytext } } @ Notice above that mytext is binded to text property of Button. bq. Can I avoid the property and use something like button.button.text = "toto" to acces directly to the text of my button ? You can't access it using id.id, but another non recommended way to do this to get the exact child using children as, @ button.children[0].text = "Sometext" @ Since we can guess the exact child number by merely seeing the QML file we are able to do the above; but it is not recommended.
  • 0 Votes
    2 Posts
    2k Views
    S
    Hi, still got no solution for this and trying to work around this problems in all my HSM-related code. Quite annoying. Anyhow, I unearthed some further info on the topic. Unfortunatly this make the issue even more mysterious. I found out that adding a SIGNAL() around the string in line 21 of the previous posting makes the problem disappear. Well it makes the message disappear. I then constructed some code that would help testing whether or not the state switch really occurred: @ from PySide import QtCore, QtGui import sys class MyMainWindow(QtGui.QMainWindow): test_signal1 = QtCore.Signal() test_signal2 = QtCore.Signal(int) test_signal3 = QtCore.Signal(str) def init(self,parent=None): super(MyMainWindow,self) .init(parent) QtCore.QTimer.singleShot( 1000,self.setupHsm) QtCore.QTimer.singleShot( 3000,self.sendSignal) QtCore.QTimer.singleShot( 1500,self.printConf) QtCore.QTimer.singleShot( 3500,self.printConf) def setupHsm(self): self.state_machine = QtCore .QStateMachine() self.one_state = QtCore .QState(self.state_machine) self.state_machine .setInitialState( self.one_state) self.other_state = QtCore .QState(self.state_machine) self.one_state.addTransition(self, "test_signal1()" ,self.other_state) self.one_state.addTransition(self, "test_signal2(int)" ,self.other_state) self.one_state.addTransition(self, QtCore.SIGNAL("test_signal3(str)") ,self.other_state) self.state_machine.start() print self.state_machine.configuration() def printConf(self): print self.state_machine.configuration() def sendSignal(self): self.test_signal3.emit("bla") print self.state_machine.configuration() if name == "main": app = QtGui.QApplication(sys.argv) myapp = MyMainWindow() myapp.show() sys.exit(app.exec_()) @ What I get is this: @ set([]) set([<PySide.QtCore.QState object at 0xa15454c>]) set([<PySide.QtCore.QState object at 0xa15454c>]) set([<PySide.QtCore.QState object at 0xa15454c>]) @ First thing I noted was the empty configuration directly after the start of the HSM (printed in line 39). That's why I introduced a method that prints the configuration and is called half a second alter. This gives a reasonable output. Apparently I need to return to the EventQueue after starting the HSM. However after emitting test_signal3 the configuration remains unchanged. Even after returning to the EventQueue (again using a QTimer::singleShot). On the other hand when emitting test_signal2 (istead of 3) in line 45, the change in the state can be observed. @ set([<PySide.QtCore.QState object at 0x8a1154c>]) set([<PySide.QtCore.QState object at 0x8a1156c>]) set([<PySide.QtCore.QState object at 0x8a1156c>]) @ Can anyone help. Or at least test whether the above code yields similar results? Thanks
  • Running C code from QT

    3
    0 Votes
    3 Posts
    2k Views
    R
    Sorry for the long delay in responding. I had totally forgotten creating this thread until two days back. Gave it a try as you suggested and succeeded with minor hiccups. Thank you. :)
  • Problems linking QMacCocoaViewContainer

    4
    0 Votes
    4 Posts
    2k Views
    crystalideaC
    [quote author="PysCowboy" date="1373363229"]QMacCocoaViewContainer is now unfortunately a part of the external QtMacExtras module. http://qt.gitorious.org/qt/qtmacextras [/quote] This is not true, it's a part of QtWidgets
  • Installation problem

    3
    0 Votes
    3 Posts
    3k Views
    L
    Need to run with sudo on some machines, but not others based on privileges of target directories.
  • 0 Votes
    4 Posts
    4k Views
    S
    Thanks! That's what I as looking for! [quote author="elveatles" date="1406940916"]Here's an example in case that's what you were looking for. self.someButton is a QPushButton, and self.someObject is the object with the onClick method that will be called when the signal is emitted. @ self.someButton.clicked.connect(self.someObject.onClick) @[/quote]
  • PyQt5 Class Properties Go Missing When Using QThreadPool

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [SOLVED] Qt functions from a DLL

    3
    0 Votes
    3 Posts
    2k Views
    S
    Thanks! that worked!
  • Using wrapped Qt segfaults on Linux with only a basic example

    1
    0 Votes
    1 Posts
    970 Views
    No one has replied
  • 0 Votes
    6 Posts
    2k Views
    D
    [quote author="SGaist" date="1406317872"]That might be something to talk about with the pyside devs[/quote] I'll share my findings with the list. Cheers!
  • [SOLVED][PyQt4] , moving from pyside, subclass problem

    2
    0 Votes
    2 Posts
    1k Views
    Y
    missing update of lib still pointing on pyside (RESOLVED)
  • PySide 1.2.2 fails to build on Qt4 (Framework), OSX 10.9.4

    2
    0 Votes
    2 Posts
    1k Views
    S
    Hi, Just an update, I wrote a quick bash script that created symbolic links for each: @/Library/Frameworks/Qt<module>.framework/Headers@ folder in a custom location: @/myApps/Qt-4.8.6/include@ And PySide compiled fine with CMake. Well, I have provided that path using the @-DALTERNATIVE_QT_INCLUDE_DIR@ flag. However still curios to hear about this? How is that the CMake for PySide is not able to work with the framework based Qt? Thanks.
  • Pyside / OSX (Mavericks) -- Very slow app startup

    10
    0 Votes
    10 Posts
    4k Views
    SGaistS
    The link has been update You should contact the original author of this wiki entry to see if he can help you directly