zz_configDialog.cpp

changeset 83
614ec2640e40
parent 78
c190fe218506
child 88
652028158792
equal deleted inserted replaced
82:e61c50fdb8cc 83:614ec2640e40
156 qaShortcutItems.push_back (qItem); 156 qaShortcutItems.push_back (qItem);
157 qShortcutList->insertItem (i, qItem); 157 qShortcutList->insertItem (i, qItem);
158 ++i; 158 ++i;
159 } 159 }
160 160
161 qBTN_setShortcut = new QPushButton ("Set"); 161 qSetShortcut = new QPushButton ("Set");
162 qBTN_resetShortcut = new QPushButton ("Reset"); 162 qResetShortcut = new QPushButton ("Reset");
163 163 qClearShortcut = new QPushButton ("Clear");
164 connect (qBTN_setShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); 164
165 connect (qBTN_resetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); 165 connect (qSetShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ()));
166 connect (qResetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ()));
167 connect (qClearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ()));
166 168
167 QVBoxLayout* qButtonLayout = new QVBoxLayout; 169 QVBoxLayout* qButtonLayout = new QVBoxLayout;
168 qButtonLayout->addWidget (qBTN_setShortcut); 170 qButtonLayout->addWidget (qSetShortcut);
169 qButtonLayout->addWidget (qBTN_resetShortcut); 171 qButtonLayout->addWidget (qResetShortcut);
172 qButtonLayout->addWidget (qClearShortcut);
170 qButtonLayout->addStretch (10); 173 qButtonLayout->addStretch (10);
171 174
172 qLayout->addWidget (qShortcutList, 0, 0); 175 qLayout->addWidget (qShortcutList, 0, 0);
173 qLayout->addLayout (qButtonLayout, 0, 1); 176 qLayout->addLayout (qButtonLayout, 0, 1);
174 qShortcutsTab->setLayout (qLayout); 177 qShortcutsTab->setLayout (qLayout);
275 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); 278 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems ();
276 279
277 for (QListWidgetItem* qItem : qaSel) { 280 for (QListWidgetItem* qItem : qaSel) {
278 long idx = getItemRow (qItem); 281 long idx = getItemRow (qItem);
279 282
280 if (idx == -1)
281 continue;
282
283 actionmeta meta = g_ActionMeta[idx]; 283 actionmeta meta = g_ActionMeta[idx];
284 keyseqconfig* conf = g_ActionMeta[idx].conf; 284 keyseqconfig* conf = g_ActionMeta[idx].conf;
285 285
286 conf->reset (); 286 conf->reset ();
287 (*meta.qAct)->setShortcut (*conf); 287 (*meta.qAct)->setShortcut (*conf);
288 288
289 setShortcutText (qItem, meta);
290 }
291 }
292
293 // =============================================================================
294 void ConfigDialog::slot_clearShortcut () {
295 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems ();
296 QKeySequence qDummySeq;
297
298 for (QListWidgetItem* qItem : qaSel) {
299 long idx = getItemRow (qItem);
300
301 actionmeta meta = g_ActionMeta[idx];
302 keyseqconfig* conf = g_ActionMeta[idx].conf;
303 conf->value = qDummySeq;
304
305 (*meta.qAct)->setShortcut (*conf);
289 setShortcutText (qItem, meta); 306 setShortcutText (qItem, meta);
290 } 307 }
291 } 308 }
292 309
293 // ============================================================================= 310 // =============================================================================

mercurial