You should have a look at the QAction documentation : https://doc.qt.io/qt-5/qaction.html The first parameter, you can give a QIcon. For some predefined icon in QGIS, you can look to https://pyqgis-icons-cheatsheet.geotribu.fr/
Le jeu. 27 avr. 2023 à 13:15, Giulio Fattori via QGIS-Developer < qgis-developer@lists.osgeo.org> a écrit : > Great, what if I want an icon too? > Thanks in advance for any help > Giulio > > Il 27/04/2023 00:06, Nyall Dawson via QGIS-Developer ha scritto: > > > > On Thu, 27 Apr 2023 at 07:42, Catania, Luke A ERDC-RDE-GRL-VA CIV via > QGIS-Developer <qgis-developer@lists.osgeo.org> wrote: > > > > But I am looking to access the dock widget and add two icons in its row > of icons or maybe a menu. > > It's not available via the stable API, but let's not let that stop us! 😆 > > layer_tree = iface.layerTreeView() > layer_tree_dock = layer_tree.parent().parent() > toolbar = layer_tree_dock.findChildren(QToolBar)[0] > > my_action = QAction('something') > toolbar.addAction(my_action) > > Nyall > > > > > > > > > > Thanks in advance for any help, > > > > Luke > > > > _______________________________________________ > > QGIS-Developer mailing list > > QGIS-Developer@lists.osgeo.org > > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > _______________________________________________ > QGIS-Developer mailing listqgis-develo...@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer >
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer