Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

get rid of a button



  • I have a button in my gui that I can't recognise its origin
    6ced2bd1-2857-4a18-89c6-38ffcc95555d-image.png
    This one in right!
    My .py file for interface that I generated after designing the interface in qtdesigner is kind of long to share, also the problem now is that i added some codes manually in the .py file, which made it for me difficult to re-open the interface using qt designer.
    is there any quick way to find which code is responsible for that button?

    Any help would be appreciated.



  • @iwrwrc said in get rid of a button:

    also the problem now is that i added some codes manually in the .py file, which made it for me difficult to re-open the interface using qt designer.

    You're not supposed to do this. If you want to use Designer you should stick with using its saved .ui file and then either pyuic5 preprocess it to a .py file or use dynamic loadUi(). What are you going to do in the future if you do want make a redesign of the UI?

    is there any quick way to find which code is responsible for that button?

    Not really, without more work than it will take to track down. Since it;s at the top left, my guess is that you have somewhere a QWidget(self) (could be any widget type) which you do not then call addWidget() on to actually add to a layout. I think those "unpositioned" widgets show up at top left corner of parent.



  • @JonB said in get rid of a button:

    QWidget(self)

    I had to use manual modifications on my generated .py because I wanted to use QTabBar instead of QtabWidget,

    and QTabBar is not found in Qt Designer



  • @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.