[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui/shortcuts
From: Jonathan Marten <jjm () keelhaul ! me ! uk>
Date: 2010-03-03 13:11:27
Message-ID: 1267621887.275554.23854.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1098311 by marten:
Automatically assign an accelerator to a checkable group box (because
it is useful for user interaction). But not to a normal group box
(because it's pointless).
Do this at a lower priority than other widget types, so that existing
assignments should not change too much.
Review at http://reviewboard.kde.org/r/3084/
BUG:229135
M +15 -5 kacceleratormanager.cpp
M +3 -1 kacceleratormanager_private.h
--- trunk/KDE/kdelibs/kdeui/shortcuts/kacceleratormanager.cpp #1098310:1098311
@@ -243,9 +243,11 @@
continue;
}
}
+
// we possibly reserved an accel, but we won't set it as it looks silly
- if ( qobject_cast<QGroupBox*>( it->m_widget ) )
- continue;
+ QGroupBox *groupBox = qobject_cast<QGroupBox*>(it->m_widget);
+ if (groupBox && !groupBox->isCheckable())
+ continue;
int tprop = it->m_widget->metaObject()->indexOfProperty("text");
if (tprop != -1) {
@@ -391,9 +393,17 @@
if (qobject_cast<QPushButton*>(w) || qobject_cast<QCheckBox*>(w) || \
qobject_cast<QRadioButton*>(w) || qobject_cast<QLabel*>(w)) weight = \
KAccelManagerAlgorithm::ACTION_ELEMENT_WEIGHT;
- // don't put weight on group boxes, as usually the contents are more \
important
- if (qobject_cast<QGroupBox*>(w))
- weight = KAccelManagerAlgorithm::GROUP_BOX_WEIGHT;
+ // don't put weight on non-checkable group boxes,
+ // as usually the contents are more important
+ QGroupBox *groupBox = qobject_cast<QGroupBox*>(w);
+ if (groupBox)
+ {
+ if (groupBox->isCheckable())
+ weight = KAccelManagerAlgorithm::CHECKABLE_GROUP_BOX_WEIGHT;
+ else
+ weight = KAccelManagerAlgorithm::GROUP_BOX_WEIGHT;
+ }
+
i->m_content = KAccelString(content, weight);
item->addChild(i);
}
--- trunk/KDE/kdelibs/kdeui/shortcuts/kacceleratormanager_private.h #1098310:1098311
@@ -103,8 +103,10 @@
WANTED_ACCEL_EXTRA_WEIGHT = 150,
// Default weight for an 'action' widget (ie, pushbuttons)
ACTION_ELEMENT_WEIGHT = 50,
- // Default weight for group boxes (low priority)
+ // Default weight for group boxes (lowest priority)
GROUP_BOX_WEIGHT = -2000,
+ // Default weight for checkable group boxes (low priority)
+ CHECKABLE_GROUP_BOX_WEIGHT = 20,
// Default weight for menu titles
MENU_TITLE_WEIGHT = 250,
// Additional weight for KDE standard accelerators
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic