You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Author Name: Thomas Gratier (@ThomasG77)
Original Redmine Issue: 14011
Redmine category:map_tools
To access the measurement widget in the toolbar that contains "Measure Line", "Measure Area" and "Measure Angle", I have to do the following:
iface.attributesToolBar().actions()[8]
The problem: it's not deterministic if I choose to add or remove buttons in the "Attributes Toolbar"
If I do below code, It's again not deterministic because I depend from the translated string
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.defaultWidget().actions()[0].text() in ["Measure Line", "Measure Area", "Measure Angle"]:
print action.defaultWidget().actions()[0].text()
So, I would expect something like
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.data() == "qwidget_measure":
print "It the measurement QWidget"
I don't know if I missed an alternate better way.
If there are not better way, the proposed changed would make action.data() contains an id instead of None at the moment.
I also don't know if it's the best solution too (not enough year of experience with Qt/PyQt)
The text was updated successfully, but these errors were encountered:
description was changed from To access the measurement widget in the toolbar that contains "Measure Line", "Measure Area" and "Measure Angle", I have to do the following:
iface.attributesToolBar().actions()[8]
The problem: it's not deterministic if I choose to add or remove buttons in the "Attributes Toolbar"
If I do below code, It's again not deterministic because I depend from the translated string
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.defaultWidget().actions()[0].text() in ["Measure Line", "Measure Area", "Measure Angle"]:
print action.defaultWidget().actions()[0].text()
So, I would expect something like
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.data() == "qwidget_measure":
print "It the measurement QWidget"
I don't know if I missed an alternate better way.
If there are not better way, the proposed changed would make action.data() contains an id instead of None at the moment.
I also don't know if it's the best solution too (not enough year of experience with Qt/PyQt)
to To access the measurement widget in the toolbar that contains "Measure Line", "Measure Area" and "Measure Angle", I have to do the following:
iface.attributesToolBar().actions()[8]
The problem: it's not deterministic if I choose to add or remove buttons in the "Attributes Toolbar"
If I do below code, It's again not deterministic because I depend from the translated string
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.defaultWidget().actions()[0].text() in ["Measure Line", "Measure Area", "Measure Angle"]:
print action.defaultWidget().actions()[0].text()
So, I would expect something like
from PyQt4.QtGui import QWidgetAction
for action in iface.attributesToolBar().actions():
if isinstance(action, QWidgetAction):
if action.data() == "qwidget_measure":
print "It the measurement QWidget"
I don't know if I missed an alternate better way.
If there are not better way, the proposed changed would make action.data() contains an id instead of None at the moment.
I also don't know if it's the best solution too (not enough year of experience with Qt/PyQt)
Author Name: Thomas Gratier (@ThomasG77)
Original Redmine Issue: 14011
Redmine category:map_tools
To access the measurement widget in the toolbar that contains "Measure Line", "Measure Area" and "Measure Angle", I have to do the following:
The problem: it's not deterministic if I choose to add or remove buttons in the "Attributes Toolbar"
If I do below code, It's again not deterministic because I depend from the translated string
So, I would expect something like
I don't know if I missed an alternate better way.
If there are not better way, the proposed changed would make action.data() contains an id instead of None at the moment.
I also don't know if it's the best solution too (not enough year of experience with Qt/PyQt)
The text was updated successfully, but these errors were encountered: