12#include <QActionGroup>
22 : QActionGroup(parent)
33 for (
int i = 0; i < unitNames.count(); ++i) {
34 QAction* action =
new QAction(unitNames.at(i),
this);
36 action->setCheckable(
true);
38 if (currentUnitIndex == i) {
39 action->setChecked(
true);
54 Q_FOREACH (QAction *action, actions()) {
55 if (action->data().toInt() == indexInList) {
56 action->setChecked(
true);
62 if (action->isChecked()) {
63 action->setChecked(
false);
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void setUnit(const KoUnit &unit)
static KoUnit fromListForUi(int index, ListOptions listOptions=ListAll, qreal factor=1.0)
static QStringList listOfUnitNameForUi(ListOptions listOptions=ListAll)
Returns the list of unit types for the UI, controlled with the given listOptions.
int indexInListForUi(ListOptions listOptions=ListAll) const
UnitActionGroup(KisDocument *document, bool addPixelUnit, QObject *parent=0)
KoUnit::ListOptions m_listOptions
void onTriggered(QAction *action)
void onUnitChanged(const KoUnit &unit)