Replacing widgets and customizing
-
wrote on 10 Jul 2024, 07:32 last edited by JUDE34823 7 Oct 2024, 07:58
Hi, if someone could let me know the best practice for this I would appreciate it..
I am using QT Designer 6.4.3 and VS Code, Windows 11. I have a design with a main window, central widget, then a sidebar with buttons, a stacked widget with pages, with buttons and labels and spinboxes etc on each page.
I am customizing most of the items, for example I replace a pushbutton with a custom toggle switch.py that changes the color of the overlay widget in central widget. All the buttons are replaced with custom.py buttons.
It has turned ugly! I think the first problem is targeting the items to be replaced and how to setup those items in QT Designer. I found that I had to put a button in a widget to be able to replace it. So i ended up with extra widgets all over the place. Widgets in widgets and layouts in layouts just so the item would be found and replaced successfully in VS Code. Now for example I have rogue extra replaced buttons that should not be there.
I copy the code from QT Designer and paste to a ui.py that I do not touch. Then all coding I do in app.py with custom items like button.py used.
A bit of a long question I suppose but the main idea is best practice for replacing items with custom .py items, QT Designer setup. Where to find out about this?
Many Thanks.
-
See https://doc.qt.io/qt-6/designer-using-custom-widgets.html on how to use your custom widgets with designer.
-
See https://doc.qt.io/qt-6/designer-using-custom-widgets.html on how to use your custom widgets with designer.
wrote on 10 Jul 2024, 08:26 last edited by@Christian-Ehrlicher thank you
-
wrote on 10 Jul 2024, 08:53 last edited by JUDE34823 7 Oct 2024, 08:55
It did not really help, I am not promoting. And making custom plugins does not seem to be the way to go.
The problem is that I started coding only a few months ago, I have made about 10 apps with great success but now I start with QT Designer to make the UIs look better, the complexity has tripled and the gremlins are plenty, dealing with app.py , ui.py and several custombutton.py etc.
Looking in manuals and forums does not seem to help much.
What would you recommend? A course? A skype tutor? I don't know where to start.
Thanks.
-
If you have a custom widget derived e.g. from QPushButton then create a promoted widget derived from QPushButton. Where is the problem?
-
wrote on 11 Jul 2024, 07:07 last edited by
yes, it's easy when you know how. I found a relevant tutorial.
1/6