Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qt for python
    Log in to post

    • UNSOLVED How to create custom widget plugin for Qt Designer with Qt for Python?
      Qt for Python • qt for python pyside2 • • StarterKit  

      3
      0
      Votes
      3
      Posts
      25
      Views

      @JonB said in How to create custom widget plugin for Qt Designer with Qt for Python?: You may have your own good reasons for wanting to use Python, but I don't know what you are implying here. A C++ solution would indeed work, and allow custom widget design for use in Designer, across all these platforms. Ok, I see that I put it in unclear way. I meant to say I already have several different widgets created with python and don't wish to re-write them in C++. I agree with you that I may re-create it with C++ and it will work but I really don't wish to do it. Thanks for the link to stackoverflow, I'll take a look there. Promotion works good but it's not so comfortable to fine-tune placement of different parts in UI - this is why I'm looking for other possible options.
    • UNSOLVED Switching PySide2 to PyQt5 in Qt Creator
      Qt for Python • python qt for python pyside2 • • hendry33  

      2
      0
      Votes
      2
      Posts
      22
      Views

      It depends on how you create your project/file. If you create a project of the type Application "Qt for Python", you will end up with a main.py where PySide2 is imported and I could not find the template file in the Qt installation files. If you simply create a new file of the type Python | Python Class you will be offered to choose between PyQt5 and Pyside2. The template file is in your Qt installation folder: Qt\Tools\QtCreator\share\qtcreator\templates\wizards\classes\python. Sorry, QtCreator is great but not perfect for Python yet from what I can tell :-/
    • UNSOLVED Qt -platform webgl support in pyqt
      Qt for Python • qt for python • • McTob  

      10
      0
      Votes
      10
      Posts
      69
      Views

      Looks like this problem goes deeper than a simple pyqt issue. I have posted my issue on SO: https://stackoverflow.com/questions/66222702/how-to-get-webgl-support-in-pyqt5 And reported as a bug on qt jira: https://bugreports.qt.io/browse/QTBUG-91162 With additional informations related to javascript logs.
    • UNSOLVED Python and android problem with deploy
      Qt for Python • python qt for python • • Maklo  

      3
      0
      Votes
      3
      Posts
      49
      Views

      Well thanks you
    • UNSOLVED get rid of a button
      Qt for Python • qt for python pyside2 • • iwrwrc  

      4
      0
      Votes
      4
      Posts
      39
      Views

      @iwrwrc There are better ways of doing this than your approach. You have chosen to sacrifice the ability to re-edit the design at any future date. Up to you, it's not what I would have done. You have quoted QWidget(self) I don't know why, and my suggestion that the most likely might be an "unpositioned" widget declared like this but never added still remains. And of course it might have something to do with whatever you did to QTabWidget/QTabBar.
    • UNSOLVED QFormBuilder was unable to create a custom widget of the class 'QVideoWidget'
      Qt for Python • qt for python pyside2 • • publicname40828  

      11
      0
      Votes
      11
      Posts
      117
      Views

      thank you each for your responses @SGaist said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget': What step did you use to create the original file that works with PyQt5 but not PySide2 ? Is it only a bug in Qt Creator or does it also fail at run time ? making a new project in qt-creator using python auto-generates the code for PyQt5, then i switched the imports to PySide2, and changed the uic method of loading UI for the QUiLoader method. everything else remains completely untouched, and 100% of everything else seems to be perfectly functional without producing any error the application will continue to run and function perfectly normal, but the widget won't appear. it's more of an 'ignore' than a 'fail'. from the bug report responses it seems maybe there just -isn't- a QVideoWidget for PySide2? @JonB said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget': you do not have to be able to put a widget on a Designer form or make it work with Promote to use it. Before you say you might abandon the whole Qt approach, are you aware that you can indeed create desired widget type at runtime even if you cannot see it/do so at design-time? i am aware, it's what i spoke of in this quote, though the way i worded it could have been more clear and could lead to confusion. @publicname40828 said in QFormBuilder was unable to create a custom widget of the class 'QVideoWidget': however, in the mean time i've figured out how to neatly embed QVideoWidget declared in python within an existing UI outside of qt creator i declared the QVideoWidget in python providing the ui as a parent (in arg), then used setGeometry to make it fit the exact location of the widget that was made in the form.ui. this is the only Widget that isn't working for me in the transition from PyQt5 to PySide2 so migrating the project will no longer be necessary, and being able to get the exact geometry in a glance in qt-creator made it a relatively quick fix
    • Problem creating an .exe file
      Qt for Python • python qt for python pyside2 pyside • • RafaelRS  

      3
      0
      Votes
      3
      Posts
      90
      Views

      @Samuel-Bachorik I tried it, but I have the same problem, ehwn I try to execute the .exe file a message box open saying "Failed to execute script"
    • UNSOLVED How to split project based on .pyproject file into sub modules?
      Qt for Python • qt for python pyside2 • • Borys  

      1
      0
      Votes
      1
      Posts
      16
      Views

      No one has replied

    • UNSOLVED Run pyqt5 on docker with ui file
      Qt for Python • python qt for python • • eranp03  

      4
      0
      Votes
      4
      Posts
      63
      Views

      Hi, Your application does not run a web server therefore trying to access it with a web browser won't work. You will have to have a X11 server running on your Windows machine. See this article for an explanation about that.
    • UNSOLVED [Solved]QAreaSeries not Showing up. Qt Charts
      Qt for Python • python qt for python • • Qt-Bot05  

      2
      0
      Votes
      2
      Posts
      13
      Views

      Hi, You have here an example of how to build an area series. It's in C++ but easily translated to Python. I think it should provide you with the information you are looking for.
    • UNSOLVED PyQtCharts QAreaSeries. Nothing Show's up.
      Qt for Python • python qt for python • • Qt-Bot05  

      6
      0
      Votes
      6
      Posts
      23
      Views

      @Qt-Bot05 Well, it seems to me you're using Y values the wrong way round for upperSeries and lowerSeries! But I think the docs imply that doesn't actually matter, though you might want to verify by swapping. Also, you're testing with just 2 points, it's an area series so why would you test with less than 4? What are you expecting to see? Anyway, your issue is probably something else. Have you checked it works for you for other than QAreaSeries?
    • UNSOLVED calling a file from another?
      Qt for Python • qt for python import open qt files • • goingwtheflow  

      2
      0
      Votes
      2
      Posts
      23
      Views

      @goingwtheflow You have two .py files, each with their own main, hence standalone programs. How do you intend for them to interact? One would be better without the main. When you post code, please use the Code icon on the toolbar to make your code legible.
    • UNSOLVED Error (The specified module could not be found / plugin cannot be loaded for module "QtQuick")
      Qt for Python • python qt for python pyside2 pyside • • Ryuyxx  

      2
      0
      Votes
      2
      Posts
      110
      Views

      Did you ever find a fix? Mine is doing the exact same thing.
    • UNSOLVED PySide2 and PySide6 freezes when a QThread contains a PyAudio() stream, while PyQt5 works well. Is that a bug or I had the wrong usage?
      Qt for Python • python qt for python pyside2 • • Haujet Zhao  

      2
      0
      Votes
      2
      Posts
      55
      Views

      @Haujet-Zhao I don't know whether it's "supposed" to work in PySide. PyQt5 is more robust/has more support for other libraries. Have a read anyway of the (only) reply to https://stackoverflow.com/questions/63502837/pyqt5-app-using-timer-to-run-a-function-with-a-loop-makes-it-freeze-up, as possible way forward for PySide2/6?
    • UNSOLVED Running multiple plots with pyside2
      Qt for Python • python qt for python pyside2 pyside • • anoop1  

      8
      0
      Votes
      8
      Posts
      78
      Views

      @anoop1 As I said, how do you expect Python's Cmd.cmdloop to interact with Qt's event-driven system and windows/widgets?
    • SOLVED I can't style my widgets
      Qt for Python • python qt for python • • _jao_victor_  

      13
      0
      Votes
      13
      Posts
      87
      Views

      @JKSH Thanks !!!
    • SOLVED QCommandLinkButton stops working when I recreate it
      Qt for Python • python qt for python pyside2 • • Black Cat  

      2
      0
      Votes
      2
      Posts
      20
      Views

      @Black-Cat You gorgot to connect the clicked signal from the new button...
    • UNSOLVED Variable problem in EventFilter
      Qt for Python • python qt for python • • YassineKira  

      4
      0
      Votes
      4
      Posts
      41
      Views

      @jsulm Thanks i will try to use tour method @JonB i try this, it works Thanks a lot @JonB Now i will do what @jsulm propose i will work withe the qsql
    • SOLVED Signal disconnect fail
      Qt for Python • qt for python • • Pernilla  

      5
      0
      Votes
      5
      Posts
      57
      Views

      @SGaist said in Signal disconnect fail: Hi, Since you require the use of multiprocess, then you should use the interprocess facility that comes with it. You are right in the part where there's a copy of everything done. I currently have no idea how everything works so fine mixing Qt's signals and slots and Python's multiprocess. Therefore, I highly recommend that you make proper use of interprocess communication rather than rely on the luck that it worked until now. Yep, this the thing, hence I need to use python multiprocessing.Event, which has nothing to do with Qt... What made this confusing is that the Emitter process 'masquerades' as both processes (since it has all code and data to do so), and communicates with itself... :-D
    • UNSOLVED QAbstractTableModel, QTableView : how to sort ?
      Qt for Python • qt for python • • anto1ne  

      9
      0
      Votes
      9
      Posts
      187
      Views

      Yes you can, that's the starting value of the custom roles. What is usually done is to use a custom enumeration start at that value so you have better names when requesting custom data.
    • SOLVED Drawing a triangle using PyQt5 and OpenGL 3.3 (rewriting the Qt C++ example)
      Qt for Python • qt for python • • 8Observer8  

      2
      0
      Votes
      2
      Posts
      42
      Views

      eyllanesc solved my problem here: https://stackoverflow.com/questions/64914388/drawing-a-triangle-using-pyqt5-and-opengl-rewriting-the-qt-c-example/64915511#64915511 The problem is that the QOpenGLBuffer is a local variable that is destroyed instantly, whereas in C++ QOpenGLBuffer is an attribute of the class. The solution is to change vertPosBuffer to self.vertPosBuffer
    • UNSOLVED Dynamically paint or draw filled and coloured rectangle using pyqt
      Qt for Python • python qt for python • • jacha  

      2
      0
      Votes
      2
      Posts
      71
      Views

      Hi and welcome to devnet, You should add a setter to your widget to pass it the coordinates you want. On a side note, you should call update and not try to call the paintEvent method directly. Depending on your end goal, you might want to consider the Graphics View framework.
    • UNSOLVED How to Disable the QDialog windows in python
      Qt for Python • python qt for python pyside2 pyside • • john14  

      2
      0
      Votes
      2
      Posts
      60
      Views

      @john14 QWidget::setDisabled(bool disable) or setEnabled(bool) are avialble to any QWidget, including a QDialog. If that is what you are wanting.
    • SOLVED Reload paintEvent to draw rect but QLabel can't display pixmap or text
      Qt for Python • python qt for python pyside2 • • klyjm  

      5
      0
      Votes
      5
      Posts
      92
      Views

      @SGaist I don't know how to call it before, now I found using super().paintEvent(arg__1) can solve it.
    • SOLVED Organizing Pyside2 Code
      Qt for Python • qt for python pyside2 • • Abdulrahman  

      2
      0
      Votes
      2
      Posts
      97
      Views

      Need to organize main.qml file that imports nested files of subdirectories. If you have in main.qml: import "qmlFiles" as Uqmls then inside qmlFiles/ directory you have some.qml file and qmlDir, then there inside this file: import "qmlDir" as UDir Is better to organize by this way: dir/ of your main.qml file. dir/subdir/ for import from main.qml file dir/subdir/subdir/ for import from files that are in the dir/subdir/
    • SOLVED How to use a secondary qml file in a main qml file
      Qt for Python • qt for python pyside2 • • duyjuwumu  

      8
      0
      Votes
      8
      Posts
      138
      Views

      @eyllanesc I feel quite dumb. Changing MouseArea.onClicked to onClicked fixed the problem. Thanks for the help to everyone who replied.
    • SOLVED Disabling QGraphicsScene's automatic focus
      Qt for Python • qt for python • • real_mithrandir  

      3
      0
      Votes
      3
      Posts
      66
      Views

      @JonB the QGraphicsScene.setSceneRect totally worked for me. Thanks!
    • UNSOLVED CRUD for Python Objects
      Qt for Python • qt for python • • Paul Hermans  

      5
      0
      Votes
      5
      Posts
      108
      Views

      @Paul-Hermans I don't think there is any Python version. https://doc.qt.io/qtforpython/overviews/qtwidgets-itemviews-editabletreemodel-example.html is that example in the PySide2 documentation, and as you can see the code is still in C++! :) I think that is the case for a lot of Qt examples. Both TreeItem and TreeModel are indeed custom classes in that project. Indeed, if a class name does not start with Q... it's not a Qt-inbuilt! But the sample code reference page shows you all the code for them, and explains each bit. You might Google for e.g. python custom qtreeview code. I came across https://stackoverflow.com/questions/17278182/qtreeview-with-custom-items. No idea if it's good/relevant, but I see it manipulates index.internalPointer(). Might help you to look at that Python code?
    • UNSOLVED pyqt5-tools pip install crashes Qgis 'couldn't load sip module. Python support will be disabled'
      Tools • python qt for python pyqt5 qgis qtlinguist • • hcroope  

      2
      0
      Votes
      2
      Posts
      201
      Views

      @hcroope For PyQt question you might ask at: https://riverbankcomputing.com/mailman/listinfo/pyqt
    • UNSOLVED PySide2 index of setData
      Qt for Python • qt for python pyside2 • • Abdulrahman  

      4
      0
      Votes
      4
      Posts
      89
      Views

      @Abdulrahman Not my area, perhaps this question should be posted to the QML sub-forum, if you don't get an answer here in a while? (except to say: if you have the row, column & model, model->index(row, column) delivers the QModelIndex, if that helps from QML.)
    • SOLVED Windows : QtSql.setDatabaseName not allow to connect to my SQLITE database
      Qt for Python • qt for python pyside2 • • wizard_MG  

      2
      0
      Votes
      2
      Posts
      43
      Views

      sorry miss part of my code please ignore
    • UNSOLVED show other program result in QWindow
      Qt for Python • qt for python pyside2 • • daisyvish  

      12
      0
      Votes
      12
      Posts
      186
      Views

      @daisyvish said in show other program result in QWindow: how to check environment variables for QT? You mean in "in QtCreator"? @SGaist did not ask about environment variables specific for Qt, but any variables which can influence Python. Go to "Projects/YOUR_KIT/Run/Run Environment" and compare the environment variables there to what "set" outputs in cmd.exe
    • UNSOLVED ImportError: DLL load failed while importing QtCore: The specified module could not be found.
      Qt for Python • python qt for python • • Marceepoo  

      10
      0
      Votes
      10
      Posts
      3626
      Views

      @JonB said in ImportError: DLL load failed while importing QtCore: The specified module could not be found.: cmd /k "C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 & python.exe E:\Apps\UtilitiesByMarc\PyQt5_Hello_World.py" That was the exactly the solution I was looking for. Thank you sooo much. Often for me, the hardest part is explaining what I am trying to do without providing too long a description. Thank you for seeing what I needed, and showing me how to do it. Much appreciated.
    • SOLVED [MacOS] Global QMenuBar is not clickable
      Qt for Python • python qt for python • • wlgns2223  

      7
      0
      Votes
      7
      Posts
      169
      Views

      You still shouldn't need a workaround. I'd say it's worth a report since it has been working until now.
    • SOLVED How to add a separator to the menu bar?
      Qt for Python • qt for python • • NonNT  

      8
      0
      Votes
      8
      Posts
      247
      Views

      @NonNT said in How to add a separator to the menu bar?: In Motif and CDE styles, the separator pushes the Help menu to the right; in other styles, the separator is ignored. Figure 3.5 shows both cases. That is why I pointed you at https://www.qtcentre.org/threads/13910-why-addSeparator()-doesn-t-work-on-QMenuBar and said it depends on the style you use.
    • SOLVED WebView crashes when setUrl is called inside a thread
      Qt for Python • python qt for python pyside2 pyside • • mkonst03  

      10
      0
      Votes
      10
      Posts
      84
      Views

      I highly encourage you to learn the signals and slots paradigm. Qt is an asynchronous framework which means that you may not need an additional thread depending on what you need to process and how you process it. Did they warm you about the nuclear footgun that it can be ? ;-)
    • SOLVED QToolButton menu is stuck on the main screen, while application is on second screen.
      Qt for Python • qt for python • • Freemantle01  

      3
      0
      Votes
      3
      Posts
      95
      Views

      @SGaist said in QToolButton menu is stuck on the main screen, while application is on second screen.: Hi and welcome to devnet, Base on the report, it seems to be a regression so it looks like you should use Qt 5.14.2. Thanks for answer, It's working.
    • UNSOLVED Displat Depth image in PyQT4
      Qt for Python • python qt for python • • Lucien  

      6
      0
      Votes
      6
      Posts
      102
      Views

      @Lucien said in Displat Depth image in PyQT4: requires some colors in it (RGB/Mono/Grayscale) which does not fit in Mono and greyscale do not have colors, so don't know what the problem is... "QImage::Format_Mono 1 The image is stored using 1-bit per pixel. Bytes are packed with the most significant bit (MSB) first.". "QImage::Format_Grayscale8 24 The image is stored using an 8-bit grayscale format. (added in Qt 5.5) QImage::Format_Grayscale16 28 The image is stored using an 16-bit grayscale format. (added in Qt 5.13)"
    • SOLVED Delay to open window after use my desktop app(open and close many windows), when more windows I open, larger will be the delay
      Qt for Python • python qt for python pyside2 • • andre_sophia  

      16
      0
      Votes
      16
      Posts
      129
      Views

      @andre_sophia Glad it solved. Yes, in the normal course do all your connect()s in the __init__(), after the setupUi(), so it's just once.