Skip to content

Commit

Permalink
发布用
Browse files Browse the repository at this point in the history
  • Loading branch information
SantaJiang committed Oct 16, 2019
1 parent ce43631 commit 1064c19
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 193 deletions.
190 changes: 6 additions & 184 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
}
}

void MainWindow::keyPressedDisplay(QLabel* label)
{
label->setStyleSheet("background-color: rgb(255, 153, 0);");
}

void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
int key = event->nativeScanCode(); //区分同样键位可用nativeScanCode,码是唯一的
Expand All @@ -254,195 +259,12 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
}
}

//void MainWindow::DefaultColor()
//{
// ui->centralWidget->setStyleSheet("background-color: rgb(0, 102, 153);"); //背景色
// ui->scrollAreaWidgetContents
// ->setStyleSheet("border:none; border-radius:0px; background-color: rgb(0, 0, 0, 100); color: rgb(255, 255, 255);font-size:11px;");
// ui->widget_Keyboard
// ->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(17,17,17,100);} "
// "QLabel{ border:none; border-radius:5px; color: rgb(255, 255, 255); font-size:9px;}"); //键盘外壳色,字颜色

// QMapIterator<int, QLabel *> itA(m_mapKeysPartA);
// QMapIterator<int, QLabel *> itB(m_mapKeysPartB);
// while (itA.hasNext())
// {
// itA.next();
// itA.value()->setStyleSheet("background-color: rgb(102, 204, 255);"); //A区颜色
// }
// while (itB.hasNext())
// {
// itB.next();
// itB.value()->setStyleSheet("background-color: rgb(0, 120, 159);"); //B区颜色
// }
//}


///**
// * @brief GMK情人节
// */
//void MainWindow::Valentine()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(191, 191, 185); font-size:9px;"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(233,233,228);} "
//// "QLabel{ border:none; border-radius:5px; font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248); color: rgb(219,66,147);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(219,66,147); color: rgb(254, 253, 248);"); //B区颜色
//// }
//}


///**
// * @brief GMK KA1953
// */
//void MainWindow::KA1953()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(38, 38, 38); font-size:9px;"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
//// "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(188, 185, 173);"); //B区颜色
//// }

//}

///**
// * @brief GMK大碳
// */
//void MainWindow::Carbon()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(38, 38, 38); font-size:9px;"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
//// "QLabel{ border:none; border-radius:5px; color: rgb(87,93,94); font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(227,217,198); color:rgb(87,93,94);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(87,93,94); color:rgb(237,107,33);"); //B区颜色
//// }

//// ui->label_esc->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Esc
//// ui->label_f5->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_f6->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_f7->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_f8->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_prtsc->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_scrolllock->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_pausebreak->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_up->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_down->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_left->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_right->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);");
//// ui->label_enterl->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Enterl
//// ui->label_enterr->setStyleSheet("background-color: rgb(237,107,33); color: rgb(87,93,94);"); //Enterr

//}

///**
// * @brief GMK9009
// */
//void MainWindow::GMK9009()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(172, 172, 168); font-size:9px;"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(219,219,217);} "
//// "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(254, 253, 248);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(188, 185, 173);"); //B区颜色
//// }

//// ui->label_esc->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);"); //Esc
//// ui->label_ins->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);");
//// ui->label_enterr->setStyleSheet("background-color: rgb(230, 187, 197); color: rgb(5, 5, 5);"); //Enterr
//// ui->label_enterl->setStyleSheet("background-color: rgb(146, 173, 154); color: rgb(5, 5, 5);"); //Enterl

//}

///**
// * @brief GMK死灵
// */
//void MainWindow::Necro()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(95, 95, 95); font-size:9px;"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(68,68,68);} "
//// "QLabel{ border:none; border-radius:5px; color: rgb(113,125,131); font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(230,244,220); color:rgb(113,125,131);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(113,125,131); color:rgb(147,208,210);"); //B区颜色
//// }

//// ui->label_esc->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Esc
//// ui->label_up->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
//// ui->label_down->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
//// ui->label_left->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
//// ui->label_right->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);");
//// ui->label_enterl->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Enterl
//// ui->label_enterr->setStyleSheet("background-color: rgb(147,208,210); color: rgb(37,51,72);"); //Enterr
//}

///**
// * @brief GMK DMG
// */
//void MainWindow::DMG()
//{
//// ui->centralWidget->setStyleSheet("background-color: rgb(145, 145, 145);"); //背景色
//// ui->widget_Keyboard->setStyleSheet("QWidget#widget_Keyboard{ border:none; border-radius:8px; background-color:rgb(215,211,210);} "
//// "QLabel{ border:none; border-radius:5px; color: rgb(5, 5, 5); font-size:9px;}"); //键盘外壳色,字颜色
//// for ( int i=0; i!=m_listKeysPartA.size(); ++i )
//// {
//// m_listKeysPartA.at(i)->setStyleSheet("background-color: rgb(245,245,249); color:rgb(108,60,157);"); //A区颜色
//// }

//// for ( int i=0; i!=m_listKeysPartB.size(); ++i )
//// {
//// m_listKeysPartB.at(i)->setStyleSheet("background-color: rgb(150,153,155); color:rgb(108,60,157);"); //B区颜色
//// }

//// ui->label_esc->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Esc
//// ui->label_enterl->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Enterl
//// ui->label_enterr->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);"); //Enterr
//// ui->label_ins->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
//// ui->label_home->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
// // ui->label_pageup->setStyleSheet("background-color: rgb(219,66,147); color: rgb(245,245,249);");
//}



void MainWindow::keyPressedDisplay(QLabel* label)
{
label->setStyleSheet("background-color: rgb(255, 153, 0);");
}

void MainWindow::keyReleasedDisplay(QLabel *label)
{
label->setStyleSheet("background-color: rgb(200, 215, 227);");
}

//键盘配色显示方案
void MainWindow::defaultColor()
{
//GMK Metropolis
Expand Down
27 changes: 18 additions & 9 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>KeyBoardTool V3.0 Designed By Santa</string>
<string>KeyBoardTool V1.0 Designed By Santa</string>
</property>
<property name="windowIcon">
<iconset resource="logo.qrc">
Expand Down Expand Up @@ -59,16 +59,16 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="leftMargin">
<number>5</number>
<number>6</number>
</property>
<property name="topMargin">
<number>5</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>6</number>
</property>
<property name="bottomMargin">
<number>5</number>
<number>6</number>
</property>
<item>
<widget class="QWidget" name="widget_Keyboard" native="true">
Expand Down Expand Up @@ -3806,7 +3806,7 @@ Lock</string>
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
Expand Down Expand Up @@ -4571,14 +4571,17 @@ background-color: rgb(255, 255, 255);
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignVCenter">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>6</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(223, 223, 228);</string>
</property>
<property name="text">
<string>Num Lock</string>
</property>
Expand Down Expand Up @@ -4628,14 +4631,17 @@ background-color: rgb(255, 255, 255);
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignVCenter">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>6</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(223, 223, 228);</string>
</property>
<property name="text">
<string>Caps Lock</string>
</property>
Expand Down Expand Up @@ -4685,14 +4691,17 @@ background-color: rgb(255, 255, 255);
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignVCenter">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>6</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(223, 223, 228);</string>
</property>
<property name="text">
<string>Scroll Lock</string>
</property>
Expand Down

0 comments on commit 1064c19

Please sign in to comment.