Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
853 Topics 3.3k Posts
  • 0 Votes
    2 Posts
    913 Views
    SGaistS

    Hi,

    QSignalMapper might be what you are looking for.

  • 0 Votes
    4 Posts
    4k Views
    ?

    Hello,

    It was an other problem that causes this problem. So, I solved and now it works.

    Thanks .

  • 0 Votes
    8 Posts
    3k Views
    ?

    Final solution, it works very well. Thanks to @SGaist and @VRonin :

    def activate_launch_button(self): model = self.scenarios.model() model.itemChanged.connect(self.check_configure) def check_configure(self,item): model = self.scenarios.model() index = model.indexFromItem(item) if index.data(QtCore.Qt.CheckStateRole) != index.data(QtCore.Qt.UserRole + QtCore.Qt.CheckStateRole): if index.data(QtCore.Qt.CheckStateRole)!= QtCore.Qt.Unchecked : self.count_check+=1 model.setData(index,index.data(QtCore.Qt.CheckStateRole),QtCore.Qt.UserRole + QtCore.Qt.CheckStateRole) else : self.count_check-=1 model.setData(index,index.data(QtCore.Qt.CheckStateRole),QtCore.Qt.UserRole + QtCore.Qt.CheckStateRole) print self.count_check self.launch_btn.setEnabled(self.count_check>0)
  • 1 Votes
    1 Posts
    489 Views
    No one has replied
  • Import error : cannot import name OptionsTRANUSDialog

    Moved Unsolved
    7
    0 Votes
    7 Posts
    3k Views
    ?

    For more information, here is the error that I get : Couldn't load plugin OptionsTRANUS due to an error when calling its classFactory() method

    ImportError: cannot import name OptionsTRANUSDialog Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 333, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS__init__.py", line 34, in classFactory from .Options_TRANUS import OptionsTRANUS File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\Options_TRANUS.py", line 30, in from .OptionsTRANUS_project import OptionsTRANUSProject File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\OptionsTRANUS_project.py", line 24, in from .Options_TRANUS_dialog import OptionsTRANUSDialog File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\Options_TRANUS_dialog.py", line 29, in from .launch_tranus_dialog import LaunchTRANUSDialog File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 7, in from .Options_TRANUS_dialog import OptionsTRANUSDialog ImportError: cannot import name OptionsTRANUSDialog

    Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] QGIS version: 2.18.3 Las Palmas, 77b8c3d

    Python Path: C:/OSGEO4~1/apps/qgis/./python C:/Users/emna/.qgis2/python C:/Users/emna/.qgis2/python/plugins C:/OSGEO4~1/apps/qgis/./python/plugins C:\OSGEO4~1\apps\Python27\lib\site-packages\setuptools-0.9.8-py2.7.egg C:\OSGEO4~1\bin\python27.zip C:\OSGEO4~1\apps\Python27\DLLs C:\OSGEO4~1\apps\Python27\lib C:\OSGEO4~1\apps\Python27\lib\plat-win C:\OSGEO4~1\apps\Python27\lib\lib-tk C:\OSGEO4~1\bin C:\OSGEO4~1\apps\Python27 C:\OSGEO4~1\apps\Python27\lib\site-packages C:\OSGEO4~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg C:\OSGEO4~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg C:\OSGEO4~1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg C:/Users/emna/.qgis2//python

  • Qt 5.8 + python3

    Unsolved
    10
    0 Votes
    10 Posts
    6k Views
    SGaistS

    I've took a look at the official project on SourceForge so we may have something different currently.

  • 0 Votes
    2 Posts
    879 Views
    L

    For the record, the bug is in PySide. I moved to PyQt and except a few differences, the code is the same. No crash at all.
    Sad.

  • PyQt - Good practice for Qt object references

    Unsolved
    2
    0 Votes
    2 Posts
    700 Views
    SGaistS

    Hi,

    First version, you don't want to call find each and every time you want to do something with an internal object.

    By the way, why not use super rather than call the base class __init__ ?

  • PyQt5 blurpicker example

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    A

    Thank you! I didnt noticed that. I did correct this mistakes, but still getting the same error:( and empty window :/

  • How to move class method out of gui modul

    Moved Unsolved
    35
    0 Votes
    35 Posts
    10k Views
    C

    Thanks for this useffull link.

  • Which you suggest PySide or PyQt? + Why?

    Moved Unsolved
    2
    0 Votes
    2 Posts
    868 Views
    SGaistS

    Hi,

    No special suggestions, the goal of both is to provide a complete set of bindings for the Qt modules.

    PySide2 information can be found here. If you need to start right now with Qt 5 and python, PyQt might be the current best option.

    I haven't tested Python for mobile application so I can't comment on that however there might be catches with the mobile platform development rules about using an interpreter that you should check.

  • Extreme confusion over Qthread and avoiding subclassing

    Unsolved
    2
    0 Votes
    2 Posts
    584 Views
    SGaistS

    Hi and welcome to devnet,

    Yes, do_work will be called in your thread.

    For such a use case, it's a bit overkill, QtConcurrent::run would likely be simpler and cleaner.

  • app.setStyleSheet performance

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi,

    Putting your stylesheet at the application level (especially if the one your wrote) means that each and every widget might be customised which requires changing the style used to draw the widget. So you should be careful with what you put in your stylesheet.

  • What is this means? my code is running and working well

    Moved Solved
    14
    0 Votes
    14 Posts
    3k Views
    A

    @SGaist

    DATE_RECEIVED = self.date_received.text()

    i stop passing self.date_received.text() to DATE_RECEIVED and i do it in all of my variable

  • PyQt5 Events

    Unsolved
    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • QWidget touch event

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    the_T

    What does " i have problem with touch events" mean in your case?

    ps: And please use code tags when posting code

    import foo from bar def foobar(): print("this is more readable")

    is much easier to read than

    import foo from bar

    def foobar():
    print("this is not readable")

    ;)

  • Getting Started - downloading Designer

    Moved Unsolved
    2
    0 Votes
    2 Posts
    807 Views
    SGaistS

    Hi and welcome to devnet,

    I'd recommend brining this to the PyQt forum. They'll be best to answer packaging related questions.

    Just in case, I saw the pyqt5-tools package that might be interest.

    Hope it helps

  • How to organize custom diagraming project with PyQt5?

    Moved Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    P

    @jsulm PyQt does indeed deploy to iOS. Acceptance is another issue. But aside from this, my question is really regarding best use of the Qt API for my project.

  • QSql refresh()?

    Moved Solved
    18
    0 Votes
    18 Posts
    5k Views
    the_T

    Model is the QSqlQueryModel of your QTableView

  • What's wrong with my code?

    Moved Unsolved
    19
    0 Votes
    19 Posts
    6k Views
    the_T

    @Gelo said in Whats wrong with my code!:

    self.query = QSqlQuery() self.query.prepare("SELECT username FROM users WHERE username = '%s' and password = '%s'"%(USERNAME,str(PASSWORD))) self.query.addBindValue(USERNAME) self.query.addBindValue(PASSWORD)

    I just wonder this works... did you read http://pyqt.sourceforge.net/Docs/PyQt4/qsqlquery.html for how to use prepare statement and binding values?

    To bind values to a prepared statement you need placeholders.
    According to the examples on http://pyqt.sourceforge.net/Docs/PyQt4/qsqlquery.html it should be done like this:

    Named binding using named placeholders:

    QSqlQuery query; query.prepare("INSERT INTO person (id, forename, surname) " "VALUES (:id, :forename, :surname)"); query.bindValue(":id", 1001); query.bindValue(":forename", "Bart"); query.bindValue(":surname", "Simpson"); query.exec();

    Positional binding using named placeholders:

    QSqlQuery query; query.prepare("INSERT INTO person (id, forename, surname) " "VALUES (:id, :forename, :surname)"); query.bindValue(0, 1001); query.bindValue(1, "Bart"); query.bindValue(2, "Simpson"); query.exec();

    Binding values using positional placeholders (version 1):

    QSqlQuery query; query.prepare("INSERT INTO person (id, forename, surname) " "VALUES (?, ?, ?)"); query.bindValue(0, 1001); query.bindValue(1, "Bart"); query.bindValue(2, "Simpson"); query.exec();

    Binding values using positional placeholders (version 2):

    QSqlQuery query; query.prepare("INSERT INTO person (id, forename, surname) " "VALUES (?, ?, ?)"); query.addBindValue(1001); query.addBindValue("Bart"); query.addBindValue("Simpson"); query.exec();