mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
New setting allowing to set a dark style using a style-sheet
A new setting allows to follow the system style or set a new dark style based on a the style-sheet provided by https://github.com/ColinDuquesnoy/QDarkStyleSheet The style-sheet is licensed under the MIT license. Images contained in that project are licensed under CC-BY license. * Set colours using style-sheet in Data Browser tab of Preferences The colours of the frame and text-lines previewing the settings in Data Browser tab need to have being set using a style-sheet, otherwise they are eclipsed by the dark style-sheet when in use. * Update preference colours when the application style is changed In order to have matching colours in all the preferences, the individual colour settings in Data Browser and SQL tabs are reset to default values matching the corresponding style setting (dark stylesheet or follow desktop, which could be dark or light as always). Additionally, several problems with colour settings in QScintilla have been fixed: - We don't use indentation guides - both sets of lexer colour settings must be used, otherwise the result is inconsistant and unpredictable: * lexer->setDefaultColor|Paper and lexer->setColor|Paper See issues #1751 #1493 and #1738
This commit is contained in:
@@ -2380,6 +2380,24 @@ void MainWindow::reloadSettings()
|
||||
// Set data browser font
|
||||
ui->dataTable->reloadSettings();
|
||||
|
||||
switch (static_cast<Settings::AppStyle>(Settings::getValue("General", "appStyle").toInt())) {
|
||||
case Settings::FollowDesktopStyle :
|
||||
qApp->setStyleSheet("");
|
||||
|
||||
break;
|
||||
case Settings::DarkStyle :
|
||||
QFile f(":qdarkstyle/style.qss");
|
||||
if (!f.exists()) {
|
||||
QMessageBox::warning(this, qApp->applicationName(),
|
||||
tr("Could not open find resource file: %1").arg(f.fileName()));
|
||||
} else {
|
||||
f.open(QFile::ReadOnly | QFile::Text);
|
||||
QTextStream ts(&f);
|
||||
qApp->setStyleSheet(ts.readAll());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyle").toInt()));
|
||||
ui->dbToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleStructure").toInt()));
|
||||
ui->browseToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleBrowse").toInt()));
|
||||
|
||||
Reference in New Issue
Block a user