Perfect dark: remove explict Qt widget coloring

This commit is contained in:
shenlebantongying 2022-12-25 01:31:07 -05:00
parent 7d6b6cc473
commit 587aad1471
11 changed files with 88 additions and 458 deletions

View file

@ -445,7 +445,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
closeCurrentTabAction.setShortcutContext( Qt::WidgetWithChildrenShortcut );
closeCurrentTabAction.setShortcut( QKeySequence( "Ctrl+W" ) );
closeCurrentTabAction.setText( tr("Close current tab") );
closeCurrentTabAction.setIcon( QIcon(":/icons/closetab-hover.png") );
connect( &closeCurrentTabAction, SIGNAL( triggered() ),
this, SLOT( closeCurrentTab() ) );
@ -1226,13 +1225,11 @@ void MainWindow::applyQtStyleSheet( QString const & displayStyle, QString const
css += macCssFile.readAll();
#endif
if ( displayStyle.size() )
{
// Load an additional stylesheet
QFile builtInCssFile( QString( ":/qt-style-st-%1.css" ).arg( displayStyle ) );
if ( builtInCssFile.open( QFile::ReadOnly ) )
css += builtInCssFile.readAll();
}
#if defined(Q_OS_WIN)
QFile winCssFile( ":/qt-style-win.css" );
winCssFile.open( QFile::ReadOnly );
css += winCssFile.readAll();
#endif
// Try loading a style sheet if there's one
QFile cssFile( Config::getUserQtCssFileName() );

View file

@ -1,32 +0,0 @@
#navToolbar #translateLine
{
margin-top: 1px;
}
#navToolbar GroupComboBox
{
margin-bottom: 1px;
margin-top: 0px;
padding: 2px 18px 2px 4px;
}
#navToolbar GroupComboBox::drop-down {
padding-right: 2px;
border-right: 1px solid darkgray;
}
ScanPopup #translateLine
{
padding: 3px 3px 3px 3px;
}
ScanPopup GroupComboBox
{
margin: 2px 0px 4px 1px;
padding: 1px 18px 1px 4px;
}
ScanPopup GroupComboBox::drop-down {
padding-right: 2px;
border-right: 1px solid darkgray;
}

View file

@ -1,10 +0,0 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #searchPane #wordList, MainWindow #dictsPane #dictsList,
MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
}
MainWindow #searchPane #translateLine
{
font-weight: bold;
}

View file

@ -1,143 +0,0 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
background: #fefdeb;
color: black;
}
MainWindow #translateLine[noResults="true"],
ScanPopup #translateLine[noResults="true"]
{
background: #febb7d;
}
#navToolbar #menuButton::menu-indicator {
image: none;
}
#navToolbar #translateLine
{
border: 1px solid gray;
border-radius: 3px;
padding: 1px 3px 2px 3px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
margin-left: 0px;
}
#navToolbar GroupComboBox
{
margin-right: 0px;
border: 1px solid gray;
border-right: 1px transparent;
border-radius: 3px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
padding: 2px 4px 2px 4px;
}
#navToolbar GroupComboBox:on {
padding: 3px 3px 1px 5px;
}
#navToolbar GroupComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left: 1px solid darkgray;
border-right: 1px transparent;
}
#navToolbar GroupComboBox::down-arrow {
image: url(:/icons/1downarrow.svg);
max-height: 100%;
}
QTabBar::close-button {
image: url(:/icons/closetab.svg)
}
QTabBar::close-button:hover {
image: url(:/icons/closetab-hover.png)
}
ArticleView #searchText[noResults="true"]
{
background: #febb7d;
}
MainStatusBar #text
{
border-top-right-radius: 3px;
border-top: 1px solid palette(dark);
border-right: 1px solid palette(dark);
background: palette(window);
padding: 2px;
}
MainStatusBar #icon
{
border-top: 1px solid palette(dark);
background: palette(window);
padding: 2px;
padding-left: 4px;
padding-right: 0px;
}
ScanPopup #translateLine
{
margin: 0px;
padding: 1px 3px 1px 3px;
border: 1px solid gray;
border-radius: 3px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
ScanPopup GroupComboBox
{
margin: 0px 0px 0px 1px;
padding: 1px 4px 1px 4px;
border: 1px solid gray;
border-right: 1px transparent;
border-radius: 3px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
ScanPopup GroupComboBox:on {
padding: 3px 3px 1px 5px;
}
ScanPopup GroupComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left: 1px solid darkgray;
border-right: 1px transparent;
}
ScanPopup GroupComboBox::down-arrow {
image: url(:/icons/1downarrow.svg);
max-height: 100%;
}
.ScanPopup #outerFrame
{
border: 1px solid palette(dark);
}
.ScanPopup MainStatusBar #text
{
border-bottom: 1px solid palette(dark);
}
.ScanPopup MainStatusBar[hasImage="false"] #text
{
border-left: 1px solid palette(dark);
}
.ScanPopup MainStatusBar #icon
{
border-left: 1px solid palette(dark);
border-bottom: 1px solid palette(dark);
}

View file

@ -1,76 +0,0 @@
MainWindow {
background-color: #CFDDF0;
}
MainWindow #menubar {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #F0F6FF, stop:0.5 #D2E0F5, stop:0.9 #DCEBFF, stop:1 #F0F6FF);
}
MainWindow #menubar::item {
padding: 2px 8px;
background: transparent;
}
MainWindow #menubar::item:selected { /* when selected using mouse or keyboard */
background: #839EC7;
}
MainWindow #menubar::item:pressed {
background: #728AAD;
}
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList {
background-color: #fff;
}
MainWindow #centralWidget QTabBar::tab {
border: 1px solid #667B9B;
border-bottom-color: #667B9B;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
padding: 1px 3px;
margin-left: 1px;
margin-top: 2px;
margin-bottom: 2px;
background-color: #CFDDF0;
color: darkslategray;
}
MainWindow #centralWidget QTabBar::tab:selected {
background-color: #839EC7;
color: #fff;
border-bottom-style: none;
}
MainWindow #dictsPane #dictsList {
background: #EAF0F8;
color: darkblue;
}
ArticleView #searchFrame QMenu {background-color: none}
ArticleView QMenu {background-color: none}
QMainWindow::separator {
width: 1px; /* when vertical */
height: 1px; /* when horizontal */
}
#dictsPaneTitleBar {
margin: 2px;
}
/* Colored header for the History Pane */
#historyPaneTitleBar {
margin: 2px;
}
ScanPopup #outerFrame
{
background-color: #CEDDEF;
}
ScanPopup #dictionaryBar
{
background: #CEDDEF;
}

View file

@ -1,5 +0,0 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
background: #fefdeb;
color: black;
}

View file

@ -1,6 +0,0 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList,
MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
background: white;
color: black;
}

View file

@ -1,63 +0,0 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList,
MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
}
/* WARNING: hides all separators! */
#navToolbar::separator {
width: 0px;
}
/* Another way to hide specific separators */
#navToolbar #beforeOptionsSeparator, #navToolbar #beforeScanPopupSeparator, #navToolbar #afterScanPopupSeparator, #navToolbar #separatorBeforeZoom, #navToolbar #separatorBeforeSave {
background: rgba(0,0,0,0%);
width: 0px;
margin: -3px;
}
/* Hide various buttons in the toolbar: */
#navToolbar #menuButtonXX, #navToolbar #soundButtonXX, #navToolbar #backButtonXX, #navToolbar #forwardButtonXX, #navToolbar #zoomInButtonXX, #navToolbar #zoomOutButtonXX, #navToolbar #zoomBaseButtonXX, #navToolbar #saveArticleButton, #navToolbar #printButton {
width: 0px;
height: 0px;
margin: -3px;
}
/* remove the main toolbar handle */
#navToolbar::handle, #dictionaryBar::handle {
image: none;
}
#navToolbar #scanPopupButton {
margin-left: 5px;
}
/* Colored header for the "Found in Dictionaries:" pane */
#dictsPaneTitleBar {
margin: 2px;
}
/* Colored header for the History Pane */
#historyPaneTitleBar {
margin: 2px;
}
/* Thin separators between the main UI and sidebars */
QMainWindow::separator {
width: 1px; /* when vertical */
height: 1px; /* when horizontal */
}
ScanPopup #goBackButtonAA,
/* ScanPopup #queryError, */
ScanPopup #goForwardButtonAA,
ScanPopup #wordListButtonXX,
ScanPopup #pronounceButtonAA,
ScanPopup #sendWordButtonXX
/* ScanPopup #showDictionaryBar, */
/* ScanPopup #pinButton */
{
width: 0px;
height: 0px;
margin: -4px;
}

6
qt-style-win.css Normal file
View file

@ -0,0 +1,6 @@
QTabBar::close-button {
image: url(:/icons/closetab.svg)
}
QTabBar::close-button:hover {
image: url(:/icons/closetab-hover.png)
}

View file

@ -1,140 +1,107 @@
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree
{
MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree {
}
MainWindow #translateLine[noResults="true"],
ScanPopup #translateLine[noResults="true"] {
#translateLine {
color: palette(Text); /* ensure the text is inverse of the background, and also placehold text is grey */
}
#translateLine[noResults="true"] {
background: #febb7d;
}
#navToolbar #menuButton::menu-indicator {
image: none;
image: none;
}
#navToolbar #translateLine
{
border: 1px solid gray;
border-radius: 3px;
padding: 1px 3px 2px 3px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
margin-left: 0px;
#navToolbar #translateLine {
border: 1px solid gray;
border-radius: 3px;
padding: 1px 3px 2px 3px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-left: 0;
}
#navToolbar GroupComboBox
{
margin-right: 0px;
border: 1px solid gray;
border-right: 1px transparent;
border-radius: 3px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
padding: 2px 4px 2px 4px;
GroupComboBox {
margin-right: 0;
border: 1px solid gray;
border-right: 1px transparent;
border-radius: 3px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
padding: 2px 4px 2px 4px;
background: palette(window); /* Distinguish the combobox from the translate line by make it darker*/
color: palette(Text);
}
#navToolbar GroupComboBox:on {
padding: 3px 3px 1px 5px;
GroupComboBox:on {
padding: 3px 3px 1px 5px;
}
#navToolbar GroupComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left: 1px solid darkgray;
border-right: 1px transparent;
GroupComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left: 1px solid darkgray;
border-right: 1px transparent;
/* Hack: For unknown reason, if the padding right is unset, the drop-down won't show full content */
padding-right: 4px;
border-right: 1px solid darkgray;
/* Hack: end*/
}
#navToolbar GroupComboBox::down-arrow {
GroupComboBox::down-arrow {
image: url(:/icons/1downarrow.svg);
max-height: 100%;
}
QTabBar::close-button {
image: url(:/icons/closetab.svg)
ArticleView #searchText[noResults="true"] {
background: #febb7d;
}
QTabBar::close-button:hover {
image: url(:/icons/closetab-hover.png)
MainStatusBar #text {
border-top-right-radius: 3px;
border-top: 1px solid palette(dark);
border-right: 1px solid palette(dark);
background: palette(window);
padding: 2px;
}
MainStatusBar #icon {
border-top: 1px solid palette(dark);
background: palette(window);
padding: 2px;
padding-left: 4px;
padding-right: 0;
}
ScanPopup #translateLine {
margin: 0;
padding: 1px 3px 1px 3px;
border: 1px solid gray;
border-radius: 3px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
ArticleView #searchText[noResults="true"]
{
background: #febb7d;
.ScanPopup #outerFrame {
border: 1px solid palette(dark);
}
MainStatusBar #text
{
border-top-right-radius: 3px;
border-top: 1px solid palette(dark);
border-right: 1px solid palette(dark);
background: palette(window);
padding: 2px;
.ScanPopup MainStatusBar #text {
border-bottom: 1px solid palette(dark);
}
MainStatusBar #icon
{
border-top: 1px solid palette(dark);
background: palette(window);
padding: 2px;
padding-left: 4px;
padding-right: 0px;
.ScanPopup MainStatusBar[hasImage="false"] #text {
border-left: 1px solid palette(dark);
}
ScanPopup #translateLine
{
margin: 0px;
padding: 1px 3px 1px 3px;
border: 1px solid gray;
border-radius: 3px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
ScanPopup GroupComboBox
{
margin: 0px 0px 0px 1px;
padding: 1px 4px 1px 4px;
border: 1px solid gray;
border-right: 1px transparent;
border-radius: 3px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
ScanPopup GroupComboBox:on {
padding: 3px 3px 1px 5px;
}
ScanPopup GroupComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left: 1px solid darkgray;
border-right: 1px transparent;
}
ScanPopup GroupComboBox::down-arrow {
image: url(:/icons/1downarrow.svg);
max-height: 100%;
}
.ScanPopup #outerFrame
{
border: 1px solid palette(dark);
}
.ScanPopup MainStatusBar #text
{
border-bottom: 1px solid palette(dark);
}
.ScanPopup MainStatusBar[hasImage="false"] #text
{
border-left: 1px solid palette(dark);
}
.ScanPopup MainStatusBar #icon
{
border-left: 1px solid palette(dark);
border-bottom: 1px solid palette(dark);
.ScanPopup MainStatusBar #icon {
border-left: 1px solid palette(dark);
border-bottom: 1px solid palette(dark);
}

View file

@ -18,7 +18,6 @@
<file>icons/icon32_hunspell.png</file>
<file>icons/icon32_wiki.png</file>
<file>icons/wiktionary.png</file>
<file>qt-style-st-lingvo.css</file>
<file>article-style-st-lingvo.css</file>
<file>icons/icon_dsl_native.png</file>
<file>icons/forvo.png</file>
@ -31,16 +30,14 @@
<file>icons/expand_opt.png</file>
<file>icons/collapse_opt.png</file>
<file>article-style-st-babylon.css</file>
<file>qt-style-st-babylon.css</file>
<file>icons/menu_button.svg</file>
<file>icons/clear.png</file>
<file>article-style-st-modern.css</file>
<file>qt-style-st-modern.css</file>
<file>article-style-st-lingoes.css</file>
<file>icons/icon32_lingoes.png</file>
<file>article-style-st-lingoes-blue.css</file>
<file>qt-style-st-lingoes-blue.css</file>
<file>qt-style-macos.css</file>
<file>qt-style-win.css</file>
<file>icons/mdict.png</file>
<file>icons/downarrow.png</file>
<file>icons/blank.png</file>
@ -100,9 +97,7 @@
<file>icons/wizard-selected.svg</file>
<file>icons/mdict-bg.png</file>
<file>article-style-st-classic.css</file>
<file>qt-style-st-classic.css</file>
<file>icons/old-arrow.png</file>
<file>icons/old-downarrow.png</file>
<file>qt-style-st-lingoes.css</file>
</qresource>
</RCC>