mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-24 07:55:35 +08:00
refs #617, CActionItem supports icon
* standard paths for applications * support for Qt::DecorationRole * QMap<QString, QPixmap> m_availableActions * Constructor for icon only * only leafs support actions
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6a96d14baa
commit
a34be02e07
@@ -11,6 +11,20 @@
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
CActionBind::CActionBind(const QString &action, const QPixmap &icon)
|
||||
{
|
||||
CActionBind::registerAction(action, icon);
|
||||
}
|
||||
|
||||
QString CActionBind::registerAction(const QString &action, const QPixmap &icon)
|
||||
{
|
||||
const QString a = CActionBind::normalizeAction(action);
|
||||
auto inputManger = CInputManager::instance();
|
||||
Q_ASSERT_X(inputManger, Q_FUNC_INFO, "Missing input manager");
|
||||
inputManger->registerAction(a, icon);
|
||||
return a;
|
||||
}
|
||||
|
||||
CActionBind::~CActionBind()
|
||||
{
|
||||
unbind();
|
||||
@@ -31,7 +45,8 @@ namespace BlackCore
|
||||
QString CActionBind::normalizeAction(const QString &action)
|
||||
{
|
||||
QString n = action.trimmed();
|
||||
if (!n.startsWith('/')) { return n.insert(0, QChar('/')); }
|
||||
if (!n.startsWith('/')) { n.insert(0, QChar('/')); }
|
||||
if (n.endsWith('/')) { n.remove(n.length() - 1 , 1);}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user