Skip to content

Commit

Permalink
Display text as well for button
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinBuira committed Oct 30, 2024
1 parent a02c234 commit af0d091
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Mergin/version_viewer_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
QMenu,
QMessageBox,
QAbstractItemView,
QToolButton
)
from qgis.PyQt.QtGui import QStandardItem, QStandardItemModel, QIcon, QFont, QColor
from qgis.PyQt.QtCore import (
Expand Down Expand Up @@ -317,8 +318,14 @@ def __init__(self, mc, parent=None):
self.toggle_layers_action.setCheckable(True)
self.toggle_layers_action.setChecked(True)
self.toggle_layers_action.toggled.connect(self.toggle_project_layers)
self.toolbar.addAction(self.toggle_layers_action)

#We use a ToolButton instead of simple action to dislay both icon AND text
self.toggle_layers_button = QToolButton()
self.toggle_layers_button.setDefaultAction(self.toggle_layers_action)
self.toggle_layers_button.setText("Show projecct layers")
self.toggle_layers_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
self.toolbar.addWidget(self.toggle_layers_button)

self.toolbar.addSeparator()

self.zoom_full_action = QAction(QgsApplication.getThemeIcon("/mActionZoomFullExtent.svg"), "Zoom Full", self)
Expand Down

0 comments on commit af0d091

Please sign in to comment.