mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-03 11:49:29 -05:00
Dynamically change the status bar color depending on the current screen (#11672)
* Revert (https://github.com/keepassxreboot/keepassxc/pull/11455) * Do not use styles for QStatusBar * Dynamically change the status bar color depending on the current screen
This commit is contained in:
parent
e4bb80b96c
commit
5a3289ee3c
@ -687,11 +687,6 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
restoreConfigState();
|
restoreConfigState();
|
||||||
updateMenuActionState();
|
updateMenuActionState();
|
||||||
|
|
||||||
// Check the current screen and hide the status bar if it is the WelcomeScreen
|
|
||||||
if (m_ui->stackedWidget->currentIndex() == WelcomeScreen) {
|
|
||||||
statusBar()->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -1197,10 +1192,10 @@ void MainWindow::switchToDatabases()
|
|||||||
{
|
{
|
||||||
if (m_ui->tabWidget->currentIndex() == -1) {
|
if (m_ui->tabWidget->currentIndex() == -1) {
|
||||||
m_ui->stackedWidget->setCurrentIndex(WelcomeScreen);
|
m_ui->stackedWidget->setCurrentIndex(WelcomeScreen);
|
||||||
statusBar()->hide();
|
statusBar()->setAutoFillBackground(false);
|
||||||
} else {
|
} else {
|
||||||
m_ui->stackedWidget->setCurrentIndex(DatabaseTabScreen);
|
m_ui->stackedWidget->setCurrentIndex(DatabaseTabScreen);
|
||||||
statusBar()->show();
|
statusBar()->setAutoFillBackground(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1209,6 +1204,7 @@ void MainWindow::switchToSettings(bool enabled)
|
|||||||
if (enabled) {
|
if (enabled) {
|
||||||
m_ui->settingsWidget->loadSettings();
|
m_ui->settingsWidget->loadSettings();
|
||||||
m_ui->stackedWidget->setCurrentIndex(SettingsScreen);
|
m_ui->stackedWidget->setCurrentIndex(SettingsScreen);
|
||||||
|
statusBar()->setAutoFillBackground(true);
|
||||||
} else {
|
} else {
|
||||||
switchToDatabases();
|
switchToDatabases();
|
||||||
}
|
}
|
||||||
@ -1220,6 +1216,7 @@ void MainWindow::togglePasswordGenerator(bool enabled)
|
|||||||
m_ui->passwordGeneratorWidget->loadSettings();
|
m_ui->passwordGeneratorWidget->loadSettings();
|
||||||
m_ui->passwordGeneratorWidget->regeneratePassword();
|
m_ui->passwordGeneratorWidget->regeneratePassword();
|
||||||
m_ui->stackedWidget->setCurrentIndex(PasswordGeneratorScreen);
|
m_ui->stackedWidget->setCurrentIndex(PasswordGeneratorScreen);
|
||||||
|
statusBar()->setAutoFillBackground(false);
|
||||||
} else {
|
} else {
|
||||||
m_ui->passwordGeneratorWidget->saveSettings();
|
m_ui->passwordGeneratorWidget->saveSettings();
|
||||||
switchToDatabases();
|
switchToDatabases();
|
||||||
@ -1309,10 +1306,10 @@ void MainWindow::databaseTabChanged(int tabIndex)
|
|||||||
{
|
{
|
||||||
if (tabIndex != -1 && m_ui->stackedWidget->currentIndex() == WelcomeScreen) {
|
if (tabIndex != -1 && m_ui->stackedWidget->currentIndex() == WelcomeScreen) {
|
||||||
m_ui->stackedWidget->setCurrentIndex(DatabaseTabScreen);
|
m_ui->stackedWidget->setCurrentIndex(DatabaseTabScreen);
|
||||||
statusBar()->show();
|
statusBar()->setAutoFillBackground(true);
|
||||||
} else if (tabIndex == -1 && m_ui->stackedWidget->currentIndex() == DatabaseTabScreen) {
|
} else if (tabIndex == -1 && m_ui->stackedWidget->currentIndex() == DatabaseTabScreen) {
|
||||||
m_ui->stackedWidget->setCurrentIndex(WelcomeScreen);
|
m_ui->stackedWidget->setCurrentIndex(WelcomeScreen);
|
||||||
statusBar()->hide();
|
statusBar()->setAutoFillBackground(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_actionMultiplexer.setCurrentObject(m_ui->tabWidget->currentDatabaseWidget());
|
m_actionMultiplexer.setCurrentObject(m_ui->tabWidget->currentDatabaseWidget());
|
||||||
|
@ -72,10 +72,6 @@ QPlainTextEdit, QTextEdit {
|
|||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar {
|
|
||||||
background-color: palette(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
*[title="true"] {
|
*[title="true"] {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ QString DarkStyle::getAppStyleSheet() const
|
|||||||
void DarkStyle::polish(QWidget* widget)
|
void DarkStyle::polish(QWidget* widget)
|
||||||
{
|
{
|
||||||
if (qobject_cast<QMainWindow*>(widget) || qobject_cast<QDialog*>(widget) || qobject_cast<QMenuBar*>(widget)
|
if (qobject_cast<QMainWindow*>(widget) || qobject_cast<QDialog*>(widget) || qobject_cast<QMenuBar*>(widget)
|
||||||
|| qobject_cast<QToolBar*>(widget) || qobject_cast<QStatusBar*>(widget)) {
|
|| qobject_cast<QToolBar*>(widget)) {
|
||||||
auto palette = widget->palette();
|
auto palette = widget->palette();
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
if (!osUtils->isDarkMode()) {
|
if (!osUtils->isDarkMode()) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
DatabaseWidget:!active,
|
DatabaseWidget:!active,
|
||||||
DatabaseWidget #groupView:!active, DatabaseWidget #tagView:!active,
|
DatabaseWidget #groupView:!active, DatabaseWidget #tagView:!active,
|
||||||
EntryPreviewWidget *:!active[blendIn="true"], QStatusBar:!active {
|
EntryPreviewWidget *:!active[blendIn="true"] {
|
||||||
background-color: #404042;
|
background-color: #404042;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseWidget:disabled,
|
DatabaseWidget:disabled,
|
||||||
DatabaseWidget #groupView:disabled, DatabaseWidget #tagView:disabled,
|
DatabaseWidget #groupView:disabled, DatabaseWidget #tagView:disabled,
|
||||||
EntryPreviewWidget *:disabled[blendIn="true"], QStatusBar:disabled {
|
EntryPreviewWidget *:disabled[blendIn="true"] {
|
||||||
background-color: #424242;
|
background-color: #424242;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ QString LightStyle::getAppStyleSheet() const
|
|||||||
void LightStyle::polish(QWidget* widget)
|
void LightStyle::polish(QWidget* widget)
|
||||||
{
|
{
|
||||||
if (qobject_cast<QMainWindow*>(widget) || qobject_cast<QDialog*>(widget) || qobject_cast<QMenuBar*>(widget)
|
if (qobject_cast<QMainWindow*>(widget) || qobject_cast<QDialog*>(widget) || qobject_cast<QMenuBar*>(widget)
|
||||||
|| qobject_cast<QToolBar*>(widget) || qobject_cast<QStatusBar*>(widget)) {
|
|| qobject_cast<QToolBar*>(widget)) {
|
||||||
auto palette = widget->palette();
|
auto palette = widget->palette();
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
if (osUtils->isDarkMode()) {
|
if (osUtils->isDarkMode()) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
DatabaseWidget:!active,
|
DatabaseWidget:!active,
|
||||||
DatabaseWidget #groupView:!active, DatabaseWidget #tagView:!active,
|
DatabaseWidget #groupView:!active, DatabaseWidget #tagView:!active,
|
||||||
EntryPreviewWidget *:!active[blendIn="true"], QStatusBar:!active {
|
EntryPreviewWidget *:!active[blendIn="true"] {
|
||||||
background-color: #FCFCFC;
|
background-color: #FCFCFC;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseWidget:disabled,
|
DatabaseWidget:disabled,
|
||||||
DatabaseWidget #groupView:disabled, DatabaseWidget #tagView:disabled,
|
DatabaseWidget #groupView:disabled, DatabaseWidget #tagView:disabled,
|
||||||
EntryPreviewWidget *:disabled[blendIn="true"], QStatusBar:disabled {
|
EntryPreviewWidget *:disabled[blendIn="true"] {
|
||||||
background-color: #EDEDED;
|
background-color: #EDEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user