Skip to content

Qt for Python

For discussion and questions about Qt for Python (PySide & Shiboken)

3.3k Topics 14.6k Posts
  • Windows file dialog causes errors after using QFileIconProvider

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    B
    Thanks @SGaist, I have created an issue: https://bugreports.qt.io/browse/PYSIDE-2359
  • This topic is deleted!

    Unsolved
    6
    0 Votes
    6 Posts
    33 Views
  • QStyledItemDelegate alternative for QML

    Unsolved
    1
    0 Votes
    1 Posts
    227 Views
    No one has replied
  • signal emit, but the slot function is not called.

    Solved
    3
    0 Votes
    3 Posts
    380 Views
    K
    @JonB Wow, how did I not see that? Thank you so much. You're the best.
  • Use correct overload for `QAbstractItemModel.createIndex`

    Unsolved qt for python
    3
    0 Votes
    3 Posts
    394 Views
    D
    @SGaist I was originally try to store an integer value obtained from the source model directly (because I was running into refcount issues with internalPointer when using it with Python objects that kept getting GC'd). Honestly, QAIM has so many shenanigans, I switched to making a wrapper TreeItem class for the QAIM. I can't believe I have spent so much time trying to get just the index() and parent() working. All this just because my source model's children don't remember their parents?
  • I can't get keyPressEvent working from __init__

    Solved
    12
    0 Votes
    12 Posts
    810 Views
    JonBJ
    @user239857 said in I can't get keyPressEvent working from __init__: Oh and it seems if I place (self) as first param of hello_world it's able to work outside of init. Sorry, I did not notice you had def hello_world() instead of def hello_world(self), and I forgot my Python! Every (instance) method which is inside a class MUST have self as first parameter in Python (just as your __init__(self, ...) does).
  • how to add transparent img in stylesheet problem?

    Solved
    2
    0 Votes
    2 Posts
    176 Views
    S
    @Suhel sorry my problem is solve my first stylesheet line is this --> /background-image: url({Url}{val}.png) ; and replace this line to this line -->background: url({Url}{val}.png) transparent;
  • Best practices: factoring code to create a custom slider

    Unsolved pyside2
    4
    0 Votes
    4 Posts
    1k Views
    S
    I agree with @JonB that QLineEdit would not be my first choice. We have similar cases where we use a QStackedWidget with a QLineEdit and a slider to switch between the two. In other instances Qt will put an edit widget over the current widget (e.g. in table widgets). These would be the usual approached to solve this problem differently. However, I would advice against using several stylesheets for your QLineEdit and switching between them. You can have a single stylesheet together with dynamic properties. Have a look at the documentation: https://doc.qt.io/qt-6/stylesheet-examples.html#customizing-using-dynamic-properties Just use an enum for your different modes and check inside the stylesheet the value of your mode to do different styles.
  • How do I update a QCompleter with a new strings list?

    Solved
    3
    0 Votes
    3 Posts
    903 Views
    U
    @Paul-Colby This was extremely helpful and solved it. Thank you!
  • How to set QProgressBar widget in vertically from Qt Designer?

    Unsolved pyside python qt for python
    3
    0 Votes
    3 Posts
    1k Views
    JonBJ
    @BrantFF said in How to set QProgressBar widget in vertically from Qt Designer?: It will return to default value( here is Horizontal ) when I change other attributes. Give an example of exactly one further change which causes Vertical to get replaced by Horizontal. And if it really does that the version of Qt Creator you are using. OIC, Qt Designer: v6.5.0. Give the change example (e.g. does it happen if you uncheck textVisible? does it change if you pick some other widget and change one of its attributes, so that you are saying any change at all causes reversion?) and ask someone with that Designer version if it happens to them.
  • 0 Votes
    4 Posts
    450 Views
    T
    @kkoehne Many thanks, I will check more in object events.
  • Qt Crashing with Wayland Connection Fatal Error

    Unsolved
    2
    0 Votes
    2 Posts
    476 Views
    SGaistS
    Hi and welcome to devnet, Do you experience the same issue with PySide6 ?
  • QTest::mouseClick on disabled button

    Moved Solved qtest button disabled
    4
    0 Votes
    4 Posts
    620 Views
    SGaistS
    Nice ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the tree dotted menu beside that answer you deem correct so other forum users may know a solution has been found.
  • PyQt6: overlay QSlider over QLabel

    Solved
    2
    0 Votes
    2 Posts
    392 Views
    SGaistS
    Hi, Having your slider as child widget of your QLabel is the right thing to do. What exactly did you try ? How did it fail ?
  • How to connect two or more pyqt5 desktop apps to one database locally or remotely

    Unsolved
    8
    0 Votes
    8 Posts
    788 Views
    JonBJ
    @LT-K101 Just so you know. I wouldn't use SQLite for this, but if for whatever reason you wish to stick with that I read somewhere that one "can" have it multi-user-writes but every write (transaction?) locks the database from other processes trying to write (I don't know whether they wait or fail). Also from my experience shared locks across machines/network are slow. It might be tolerable if your write-lock contentions are infrequent. You would have to test, and make sure the separate SQLites properly see each other's changes. The "best" solution is a single SQL server (e.g. My SQL) running on the same machine as where the database files are located.
  • PyQt6 6.5 Dragging MainWindow causes other widgets to change color

    Unsolved
    8
    1 Votes
    8 Posts
    1k Views
    SGaistS
    So it might be related to the gtk plugin. Can you try with the fusion style ?
  • PyQt5 - get signal from subprocess in main

    Unsolved
    6
    0 Votes
    6 Posts
    885 Views
    JonBJ
    @Igor86 IF you are saying you have a main thread which has to act as a TCP server as well as other things, and IF you are right that a TCP server should only stay on main thread, then the thing to move into its own thread is the "because it is busy doing other things. not much, just a 50 ms... but for me in this application even 5 ms delay is a lot", so that the main/TCP server thread remains responsive.
  • connect Qt6/python with firebase

    Unsolved
    2
    0 Votes
    2 Posts
    297 Views
    SGaistS
    Hi and welcome to devnet, That's a bit vague. Do you fail to show a GUI ? What did you try ? How did it fail ? Do you fail to use firebase ? If so what exactly did you try ?
  • PySide2/QtWidgets problem in setStandardButtons

    Unsolved pyside2
    2
    0 Votes
    2 Posts
    964 Views
    JonBJ
    @ZEZON Please paste code not screenshots so people can copy from it. Your code should be working, but I'm afraid it looks like it isn't due to some PySide2->Python issue. https://www.pythonguis.com/tutorials/pyside-dialogs/ for PySide2 even includes same line as you. If you can test under PyQt5 that would confirm. I don't suppose it will help, but try: buttons = QMessageBox.Yes | QMessageBox.No mais.setStandardButtons(buttons) Actually, if you try the above one and it errors please show which of the two lines it complains about, that would be useful to know. I don't know whether something like buttons = QMessageBox.StandardButton(QMessageBox.Yes | QMessageBox.No) mais.setStandardButtons(buttons) would work.
  • PyQt5 - TCP readyRead only firing once if server is on its own QThread

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    JonBJ
    @Igor86 I'm not the expert on this thread stuff --- precisely because it's nasty, and most Qt stuff can be done without secondary threads despite what newcomers seem to think --- but isn't the server object in the worker thread but the client object is back in the main thread? You need to read https://doc.qt.io/qt-6/threads-qobject.html. QThread *QObject::thread() const returns the thread in which the object lives, use that dotted around your use of server/client/set_socket() etc. to see which thread you are in compared against QThread::currentThread() (https://stackoverflow.com/questions/33280672/qthreadcurrentthread-vs-qobjectthread).