How to use built in designer widget Icons for subclassed widgets in pyqt5 - pyqt

I've built lots of custom widgets to be used in Qt Designer, lots are just sub-classed standard widgets and I would like to use the standard icon. I can't find any reference to them nor could I actually find them on my system. If you leave out the icon function in the designer custom widget plugin, it will use a generic QT icon but that's it.

Related

PyQt inside Scene 3D of Blender

I import the PyQt5 library under blender and I created a command interface.
My problem is that I found myself with two windows (one of blender of course and one of PyQt)
Is there any way to automatically embed (in the script) the PyQt window inside the Blender 3D scene?
Thanks
I don't believe you will get that to work unless you alter blender's source code and build your own version of blender. While you have access to using a range of widgets that blender uses for it's UI, there aren't any ways to incorporate other GUI toolkits into blender's UI.
Blender uses python to define it's user interface and provide access to it's internal data. You can define your own panels, which are collapsible groups of UI widgets, that will be incorporated into blender's UI with the existing panels. You can define operators to perform custom actions, which are then attached to buttons displayed in your custom panels. You can also create addons so that your additions can be enabled every time blender is run.
To get more control over customising the UI appearance you could use the bgl module, I'm not certain if this can be used outside of a 3DView but you could turn a 3DView into your custom drawing area.

how to add a custom mfc control to the dialog window?

I've derived a class from CStatic in MFC. But I don't know how to add it to my dialog window.
This mfc application that I'm working on is a dialog based application.
In Gtk+ or Qt we could use layouts and add our widgets to them, but in mfc it doesn't seem to be such a mechanism. I'm wondering how is it possible for an custom made control to be added to another GUI element!!!
Please give me a simple example if you can.
thank you
I think the technique you are looking for is subclassing (MSDN).
There is a good sample on that page too.

PyQt4 Qt Designer making dynamic GUIs

I'm trying to figure out a way of using Qt Designer to make a dynamic GUI. For example, let's say I have a main window with a horizontal layout. I have a push button on one side and an empty area on the other. When I click the button the empty area will be filled with a widget that I've made in Qt Designer. When the button is pressed again the widget will be replaced with another widget that I've made in Qt Designer. Would I have to go about making all my widgets, to fill the empty area, custom widgets?
I've tried setting the parent to the empty are, but on the second change I get this
QLayout: Attempting to add QLayout "" to QWidget "t2", which already has a layout
So then I tried deleting the layout but still see the old widget underneath the new one and the layout is now messed up.
help please
Never mind, figured it out. Simple really. Use QStackedWidget and as for the UIs made in Qt Designer wrap that in a class that inherits from QWidget.

slightly customized widget for PyQt4 with qtdesigner

I am creating an application with PyQt4 and I want to use qtDesigner to design the layout. The application contains a QGraphicView, for which I want to implement panning and zomming per mouse. The only way I know how to do that is deriving from QGraphicView overwriting the "mouse*" functions to do the panning and zooming.
Now I want to use this new custom widget with qtdesigner.
googling I find that I could write a "custom widget plugin" for qtdesigner. While it does not seem to be to difficult, I still find it overkill for such a little adjustment I want to make.
What other ways are there to customize a widget in PyQt4 when the layout is done with qdesigner?
Thanks!
You can promote your QGraphicsView to your own subclass
In the designer, right click on the QGraphicsView and select "Promote To" and fill the dialog with relevant information about your own subclass:

QToolBar: Is there a way to add QAction to a QToolBar in QtDesigner?

I've a PyQt4 Installed on Python 2.6. I wish to insert actions or widgets into a toolbar in QtDesigner instead of adding them in code, with addAction or addWidget (as simple as adding actions to a menu in design time).
You can add actions by dragging them to your tool bar from the "Action editor" dock window. You cannot add widgets to the tool bar in Qt Designer, I'm afraid you'll have to do this from your code.
You can create your own widget plugins with new or extended functionalities.
Just follow the definition rules from the documentation .
I use a lot of custom widgets inside the Qt Designer.
Once you have figured out, how it works, it becomes a really power full method for your design work flow inside Qt Designer.

Resources