mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Format code using clang-format
This commit is contained in:
@ -3,10 +3,9 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
ActionsShortcutsModel::ActionsShortcutsModel(QObject *parent) :
|
||||
QAbstractItemModel(parent)
|
||||
ActionsShortcutsModel::ActionsShortcutsModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ActionsShortcutsModel::rowCount(const QModelIndex &parent) const
|
||||
@ -35,7 +34,7 @@ Qt::ItemFlags ActionsShortcutsModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
if(index.column() == KEYS)
|
||||
if (index.column() == KEYS)
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
@ -48,10 +47,8 @@ QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
||||
if (role == Qt::DecorationRole && index.column() == ICON)
|
||||
return QVariant(actions[index.row()]->icon());
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
switch (index.column()) {
|
||||
case ICON:
|
||||
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
case NAME:
|
||||
@ -61,7 +58,7 @@ QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
}
|
||||
|
||||
if(role == Qt::ForegroundRole && index.column() == KEYS && actions[index.row()]->shortcut().isEmpty())
|
||||
if (role == Qt::ForegroundRole && index.column() == KEYS && actions[index.row()]->shortcut().isEmpty())
|
||||
return QBrush(QColor("#AAAAAA"));
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
@ -69,10 +66,9 @@ QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
if (index.column() == NAME)
|
||||
return QVariant(actions[index.row()]->toolTip());
|
||||
if (index.column() == KEYS)
|
||||
{
|
||||
if (index.column() == KEYS) {
|
||||
QKeySequence ks = actions[index.row()]->shortcut();
|
||||
if(ks.isEmpty())
|
||||
if (ks.isEmpty())
|
||||
return tr("None");
|
||||
return QVariant(ks.toString(QKeySequence::NativeText));
|
||||
}
|
||||
@ -84,13 +80,11 @@ bool ActionsShortcutsModel::setData(const QModelIndex &index, const QVariant &va
|
||||
{
|
||||
Q_UNUSED(role);
|
||||
|
||||
if(index.column() == KEYS)
|
||||
{
|
||||
if (index.column() == KEYS) {
|
||||
ShortcutsManager sm = ShortcutsManager::getShortcutsManager();
|
||||
if(sm.checkConflicts(value.toString(), actions[index.row()]))
|
||||
if (sm.checkConflicts(value.toString(), actions[index.row()]))
|
||||
emit conflict(value.toString());
|
||||
else
|
||||
{
|
||||
else {
|
||||
actions[index.row()]->setShortcut(value.toString());
|
||||
ShortcutsManager::getShortcutsManager().saveShortcut(actions[index.row()]);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user