@@ -241,6 +241,11 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
241241 }
242242}
243243
244+ void MainWindow::keyPressedDisplay (QLabel* label)
245+ {
246+ label->setStyleSheet (" background-color: rgb(255, 153, 0);" );
247+ }
248+
244249void MainWindow::keyReleaseEvent (QKeyEvent *event)
245250{
246251 int key = event->nativeScanCode (); // 区分同样键位可用nativeScanCode,码是唯一的
@@ -254,195 +259,12 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
254259 }
255260}
256261
257- // void MainWindow::DefaultColor()
258- // {
259- // ui->centralWidget->setStyleSheet("background-color: rgb(0, 102, 153);"); //背景色
260- // ui->scrollAreaWidgetContents
261- // ->setStyleSheet("border:none; border-radius:0px; background-color: rgb(0, 0, 0, 100); color: rgb(255, 255, 255);font-size:11px;");
262- // ui->widget_Keyboard
263- // ->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(17,17,17,100);} "
264- // "QLabel{ border:none; border-radius:5px; color: rgb(255, 255, 255); font-size:9px;}"); //键盘外壳色,字颜色
265-
266- // QMapIterator<int, QLabel *> itA(m_mapKeysPartA);
267- // QMapIterator<int, QLabel *> itB(m_mapKeysPartB);
268- // while (itA.hasNext())
269- // {
270- // itA.next();
271- // itA.value()->setStyleSheet("background-color: rgb(102, 204, 255);"); //A区颜色
272- // }
273- // while (itB.hasNext())
274- // {
275- // itB.next();
276- // itB.value()->setStyleSheet("background-color: rgb(0, 120, 159);"); //B区颜色
277- // }
278- // }
279-
280-
281- // /**
282- // * @brief GMK情人节
283- // */
284- // void MainWindow::Valentine()
285- // {
286- // // ui->centralWidget->setStyleSheet("background-color: rgb(191, 191, 185); font-size:9px;"); //背景色
287- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(233,233,228);} "
288- // // "QLabel{ border:none; border-radius:5px; font-size:9px;}"); //键盘外壳色,字颜色
289- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
290- // // {
291- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248); color: rgb(219,66,147);"); //A区颜色
292- // // }
293-
294- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
295- // // {
296- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(219,66,147); color: rgb(254, 253, 248);"); //B区颜色
297- // // }
298- // }
299-
300-
301- // /**
302- // * @brief GMK KA1953
303- // */
304- // void MainWindow::KA1953()
305- // {
306- // // ui->centralWidget->setStyleSheet("background-color: rgb(38, 38, 38); font-size:9px;"); //背景色
307- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
308- // // "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
309- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
310- // // {
311- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248);"); //A区颜色
312- // // }
313-
314- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
315- // // {
316- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(188, 185, 173);"); //B区颜色
317- // // }
318-
319- // }
320-
321- // /**
322- // * @brief GMK大碳
323- // */
324- // void MainWindow::Carbon()
325- // {
326- // // ui->centralWidget->setStyleSheet("background-color: rgb(38, 38, 38); font-size:9px;"); //背景色
327- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
328- // // "QLabel{ border:none; border-radius:5px; color: rgb(87,93,94); font-size:9px;}"); //键盘外壳色,字颜色
329- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
330- // // {
331- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(227,217,198); color:rgb(87,93,94);"); //A区颜色
332- // // }
333-
334- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
335- // // {
336- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(87,93,94); color:rgb(237,107,33);"); //B区颜色
337- // // }
338-
339- // // ui->label_esc->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Esc
340- // // ui->label_f5->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
341- // // ui->label_f6->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
342- // // ui->label_f7->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
343- // // ui->label_f8->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
344- // // ui->label_prtsc->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
345- // // ui->label_scrolllock->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
346- // // ui->label_pausebreak->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
347- // // ui->label_up->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
348- // // ui->label_down->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
349- // // ui->label_left->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
350- // // ui->label_right->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
351- // // ui->label_enterl->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Enterl
352- // // ui->label_enterr->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Enterr
353-
354- // }
355-
356- // /**
357- // * @brief GMK9009
358- // */
359- // void MainWindow::GMK9009()
360- // {
361- // // ui->centralWidget->setStyleSheet("background-color: rgb(172, 172, 168); font-size:9px;"); //背景色
362- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(219,219,217);} "
363- // // "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
364- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
365- // // {
366- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248);"); //A区颜色
367- // // }
368-
369- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
370- // // {
371- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(188, 185, 173);"); //B区颜色
372- // // }
373-
374- // // ui->label_esc->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);"); //Esc
375- // // ui->label_ins->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);");
376- // // ui->label_enterr->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);"); //Enterr
377- // // ui->label_enterl->setStyleSheet("background-color: rgb(146, 173, 154); color: rgb(5, 5, 5);"); //Enterl
378-
379- // }
380-
381- // /**
382- // * @brief GMK死灵
383- // */
384- // void MainWindow::Necro()
385- // {
386- // // ui->centralWidget->setStyleSheet("background-color: rgb(95, 95, 95); font-size:9px;"); //背景色
387- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
388- // // "QLabel{ border:none; border-radius:5px; color: rgb(113,125,131); font-size:9px;}"); //键盘外壳色,字颜色
389- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
390- // // {
391- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(230,244,220); color:rgb(113,125,131);"); //A区颜色
392- // // }
393-
394- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
395- // // {
396- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(113,125,131); color:rgb(147,208,210);"); //B区颜色
397- // // }
398-
399- // // ui->label_esc->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Esc
400- // // ui->label_up->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
401- // // ui->label_down->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
402- // // ui->label_left->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
403- // // ui->label_right->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
404- // // ui->label_enterl->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Enterl
405- // // ui->label_enterr->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Enterr
406- // }
407-
408- // /**
409- // * @brief GMK DMG
410- // */
411- // void MainWindow::DMG()
412- // {
413- // // ui->centralWidget->setStyleSheet("background-color: rgb(145, 145, 145);"); //背景色
414- // // ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(215,211,210);} "
415- // // "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
416- // // for ( int i=0; i!=m_listKeysPartA.size(); ++i )
417- // // {
418- // // m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(245,245,249); color:rgb(108,60,157);"); //A区颜色
419- // // }
420-
421- // // for ( int i=0; i!=m_listKeysPartB.size(); ++i )
422- // // {
423- // // m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(150,153,155); color:rgb(108,60,157);"); //B区颜色
424- // // }
425-
426- // // ui->label_esc->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Esc
427- // // ui->label_enterl->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Enterl
428- // // ui->label_enterr->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Enterr
429- // // ui->label_ins->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
430- // // ui->label_home->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
431- // // ui->label_pageup->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
432- // }
433-
434-
435-
436- void MainWindow::keyPressedDisplay (QLabel* label)
437- {
438- label->setStyleSheet (" background-color: rgb(255, 153, 0);" );
439- }
440-
441262void MainWindow::keyReleasedDisplay (QLabel *label)
442263{
443264 label->setStyleSheet (" background-color: rgb(200, 215, 227);" );
444265}
445266
267+ // 键盘配色显示方案
446268void MainWindow::defaultColor ()
447269{
448270 // GMK Metropolis
0 commit comments