Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
865 Topics 3.4k Posts
  • PySide: Enabled QGraphicsView object doesn't take QMouseDoubleClickEvent

    Unsolved
    1
    0 Votes
    1 Posts
    539 Views
    No one has replied
  • Close or hide window ? Which the best ?

    Moved Unsolved python
    3
    0 Votes
    3 Posts
    4k Views
    ?
    Hello @Wieland, In my case, I am integrating my interface as a plugin in QGIS. So, when closing all the windows and launching from QGIS, the main window is displayed. I don't really know If I need to destroy in this case. Thanks for your reply.
  • 0 Votes
    8 Posts
    5k Views
    SGaistS
    Tricky one ! Thanks for sharing :)
  • PySide2 is stable like PyQt5?

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, Well, the best thing to do IMHO is to run a test/benchmark to see it it fills your need.
  • PySide2 Windows build error

    Unsolved
    5
    0 Votes
    5 Posts
    3k Views
    N
    I tried your suggestion. No change.
  • PyQTGraph - X axis updating with minutes

    Unsolved
    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • PyQT5- Question mark button

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, Take a look at the QWhatsThis class.
  • Implementing QThread into code

    Moved Solved python
    5
    0 Votes
    5 Posts
    2k Views
    C
    Problem solved with mooving to PyQtGraph. Thanks for help. Vlado import pyqtgraph as pg OUT_Buffer_Time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26] # 26 spominskih mest OUT_Buffer_Zg = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # 26 spominskih mest OUT_Buffer_Sp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # 26 spominskih mest def simple_graph(): H = pg.plot(OUT_Buffer_Time, OUT_Buffer_Zg, pen='b') H.plot(OUT_Buffer_Time, OUT_Buffer_Zg, pen=(255, 0, 0)) H.plot(OUT_Buffer_Time, OUT_Buffer_Sp, pen=(0, 255, 200))
  • When relaunching plugin I don't get the main window I get the pop up window

    Moved Unsolved python
    3
    0 Votes
    3 Posts
    1k Views
    ?
    Hello @mrjj : In my main window, I call to launch my pop-up window : def show(self): self.project.load() if self.project.tranus_project: self.tranus_folder.setText(self.project.tranus_project.path) self.activate_launch_button() self.launch_options_TRANUS() super(OptionsTRANUSDialog, self).show() ...... def launch_options_TRANUS(self): self.get_checked_list() if self.checked_list != [] : dialog = launch_tranus_dialog.LaunchTRANUSDialog(self.checked_list,self.folder,self.tranus_binaries,parent=self) dialog.show() result = dialog.exec_() self.reinitialise_checked_list() The class of my pop-up window is defined as : class LaunchTRANUSDialog(QtGui.QDialog, FORM_CLASS): def __init__(self,checked_list,project_directory,tranus_bin_path,parent=None): """Constructor.""" super(LaunchTRANUSDialog, self).__init__(parent) self.setupUi(self) self.project = parent.project self.proj = QgsProject.instance() self.tranus_bin_path = tranus_bin_path self.project_directory = project_directory self.project = parent.project self.checked_list = checked_list self.is_all_checked = False self.tabs = self.findChild(QtGui.QTabWidget, 'tabWidget') self.proj = QgsProject.instance() #control actions self.tabs.blockSignals(True) self.tabs.currentChanged.connect(self.onChange) self.tabs.blockSignals(False) def show(self): self.put_tabs() super(LaunchTRANUSDialog, self).show()
  • PyQT - Make integers and dates in QTableWidget properly sortable

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, Do you mean that you want to sort your QTableWidget by the date string ?
  • Strange errors with an access violation

    Solved
    11
    0 Votes
    11 Posts
    9k Views
    A
    On the way to work it came to my mind that I use the pointer and probably do not create the object. In work I use C# and forget that i must create object ;] Hehe now everything work fine. Thanks for help ;]
  • 0 Votes
    9 Posts
    4k Views
    ?
    Hello again, Finally, I found a solution : putting actions when creating tabs. Here is my code : def add_new_tab(self,index,text): new_tab = InterfaceTemplateDialog() self.tabs.addTab(new_tab,text) self.tabs.setTabText(index,text) new_tab.generate_btn.clicked.connect(self.launch) new_tab.run_tranus_btn.clicked.connect(self.run_tranus) new_tab.check_all_btn.clicked.connect(self.check_all) def onChange(self): index = self.tabs.currentIndex() tab_title = self.tabs.tabText(index) tab = self.tabs.currentWidget() if tab_title != "All checked scenarios": scenario = tab_title.split('-')[1] else : scenario ="ALL" return [tab,scenario] def run_tranus(self): tab = self.onChange()[0] scenario = self.onChange()[1] tab.console.append("Beginning of execution of basic TRANUS programs for scenario "+scenario) tab.console.append("Executing loop TRANUS for "+ `tab.spin_box.value()` +" iterations")
  • How to control actions on tabs (tabwidget) having the same content ?

    Moved Unsolved python
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, QSignalMapper might be what you are looking for.
  • TypeError: __init__() takes at least 2 arguments (2 given)

    Moved Solved python
    4
    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
    4k 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)
  • Trying to bind to a service of a third party java library through JNI in QT

    Unsolved
    1
    1 Votes
    1 Posts
    547 Views
    No one has replied
  • Import error : cannot import name OptionsTRANUSDialog

    Moved Unsolved python
    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
    7k Views
    SGaistS
    I've took a look at the official project on SourceForge so we may have something different currently.
  • 0 Votes
    2 Posts
    993 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
    789 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__ ?