@@ -128,9 +128,20 @@ bool lcKeyboardShortcuts::Load(QTextStream& Stream)
128
128
return true ;
129
129
}
130
130
131
+ void lcMouseShortcuts::Clear ()
132
+ {
133
+ for (int ShortcutIndex = 0 ; ShortcutIndex < static_cast <int >(lcTool::Count); ShortcutIndex++)
134
+ {
135
+ mShortcuts [ShortcutIndex].Modifiers1 = Qt::NoModifier;
136
+ mShortcuts [ShortcutIndex].Button1 = Qt::NoButton;
137
+ mShortcuts [ShortcutIndex].Modifiers2 = Qt::NoModifier;
138
+ mShortcuts [ShortcutIndex].Button2 = Qt::NoButton;
139
+ }
140
+ }
141
+
131
142
void lcMouseShortcuts::Reset ()
132
143
{
133
- memset ( mShortcuts , 0 , sizeof ( mShortcuts ) );
144
+ Clear ( );
134
145
135
146
lcToolShortcut& RotateViewShortcut = mShortcuts [static_cast <int >(lcTool::RotateView)];
136
147
RotateViewShortcut.Modifiers1 = Qt::AltModifier;
@@ -174,25 +185,25 @@ bool lcMouseShortcuts::Save(QStringList& Shortcuts)
174
185
{
175
186
Shortcuts.clear ();
176
187
177
- for (int ToolIdx = 0 ; ToolIdx < static_cast <int >(lcTool::Count); ToolIdx ++)
188
+ for (int ShortcutIndex = 0 ; ShortcutIndex < static_cast <int >(lcTool::Count); ShortcutIndex ++)
178
189
{
179
190
int ButtonIndex1 = 0 ;
180
- for (int Button1 = mShortcuts [ToolIdx ].Button1 ; Button1; Button1 >>= 1 )
191
+ for (int Button1 = mShortcuts [ShortcutIndex ].Button1 ; Button1; Button1 >>= 1 )
181
192
ButtonIndex1++;
182
193
183
194
if (!ButtonIndex1)
184
195
continue ;
185
196
186
- QString Shortcut = QKeySequence (mShortcuts [ToolIdx ].Modifiers1 | (Qt::Key_0 + ButtonIndex1)).toString (QKeySequence::PortableText);
197
+ QString Shortcut = QKeySequence (mShortcuts [ShortcutIndex ].Modifiers1 | (Qt::Key_0 + ButtonIndex1)).toString (QKeySequence::PortableText);
187
198
188
199
int ButtonIndex2 = 0 ;
189
- for (int Button2 = mShortcuts [ToolIdx ].Button2 ; Button2; Button2 >>= 1 )
200
+ for (int Button2 = mShortcuts [ShortcutIndex ].Button2 ; Button2; Button2 >>= 1 )
190
201
ButtonIndex2++;
191
202
192
203
if (ButtonIndex2)
193
- Shortcut += ' ,' + QKeySequence (mShortcuts [ToolIdx ].Modifiers2 | (Qt::Key_0 + ButtonIndex2)).toString (QKeySequence::PortableText);
204
+ Shortcut += ' ,' + QKeySequence (mShortcuts [ShortcutIndex ].Modifiers2 | (Qt::Key_0 + ButtonIndex2)).toString (QKeySequence::PortableText);
194
205
195
- Shortcuts << QString::fromLatin1 (gToolNames [ToolIdx ]) + QLatin1String (" =" ) + Shortcut;
206
+ Shortcuts << QString::fromLatin1 (gToolNames [ShortcutIndex ]) + QLatin1String (" =" ) + Shortcut;
196
207
}
197
208
198
209
return true ;
@@ -216,7 +227,7 @@ bool lcMouseShortcuts::Load(const QString& FileName)
216
227
217
228
bool lcMouseShortcuts::Load (const QStringList& FullShortcuts)
218
229
{
219
- memset ( mShortcuts , 0 , sizeof ( mShortcuts ) );
230
+ Clear ( );
220
231
221
232
for (const QString& FullShortcut : FullShortcuts)
222
233
{
0 commit comments