diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 3532bfa9..306c937a 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -460,7 +460,6 @@ void MainWindow::updateEditorColorSchemes() QString schemeName = pSettings->editor().colorScheme(); //color for code completion popup PColorSchemeItem item; - item = pColorManager->getItem(schemeName, SYNS_AttrFunction); QColor baseColor = palette().color(QPalette::Base); if (item) { @@ -496,11 +495,12 @@ void MainWindow::updateEditorColorSchemes() if (item) { mStatementColors->insert(StatementKind::skPreprocessor,item); mStatementColors->insert(StatementKind::skEnum,item); - if (haveGoodContrast(item->foreground(), baseColor)) { - mHeaderCompletionPopup->setSuggestionColor(item->foreground()); - } else { - mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text)); - } +// if (haveGoodContrast(item->foreground(), baseColor)) { +// mHeaderCompletionPopup->setSuggestionColor(item->foreground()); +// } else { +// mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text)); +// } + mHeaderCompletionPopup->setSuggestionColor(item->foreground()); } else { mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text)); } @@ -527,6 +527,18 @@ void MainWindow::updateEditorColorSchemes() } else { ui->tableIssues->setWarningColor(palette().color(QPalette::Text)); } + item = pColorManager->getItem(schemeName, COLOR_SCHEME_TEXT); + if (item) { + QPalette pal = palette(); + pal.setColor(QPalette::Base,item->background()); + pal.setColor(QPalette::Text,item->foreground()); + mCompletionPopup->setPalette(pal); + mHeaderCompletionPopup->setPalette(pal); + } else { + QPalette pal = palette(); + mCompletionPopup->setPalette(pal); + mHeaderCompletionPopup->setPalette(pal); + } } void MainWindow::applySettings() diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index 79cf2d21..b5587591 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -25,7 +25,7 @@ CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) : kind = statement->kind; } PColorSchemeItem item = mColors->value(kind,PColorSchemeItem()); - if (item && haveGoodContrast(item->foreground(),palette().color(QPalette::Base))) { + if (item) { return item->foreground(); } return palette().color(QPalette::Text); @@ -922,8 +922,7 @@ QVariant CodeCompletionListModel::data(const QModelIndex &index, int role) const PStatement statement = mStatements->at(index.row()); if (mColorCallback) return mColorCallback(statement); - QApplication *app = dynamic_cast(QApplication::instance()); - return app->palette().color(QPalette::Text); + return qApp->palette().color(QPalette::Text); } } return QVariant();