code completion popup window use editor's background clor
This commit is contained in:
parent
731a10a1d6
commit
c5105cfa43
|
@ -460,7 +460,6 @@ void MainWindow::updateEditorColorSchemes()
|
||||||
QString schemeName = pSettings->editor().colorScheme();
|
QString schemeName = pSettings->editor().colorScheme();
|
||||||
//color for code completion popup
|
//color for code completion popup
|
||||||
PColorSchemeItem item;
|
PColorSchemeItem item;
|
||||||
|
|
||||||
item = pColorManager->getItem(schemeName, SYNS_AttrFunction);
|
item = pColorManager->getItem(schemeName, SYNS_AttrFunction);
|
||||||
QColor baseColor = palette().color(QPalette::Base);
|
QColor baseColor = palette().color(QPalette::Base);
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -496,11 +495,12 @@ void MainWindow::updateEditorColorSchemes()
|
||||||
if (item) {
|
if (item) {
|
||||||
mStatementColors->insert(StatementKind::skPreprocessor,item);
|
mStatementColors->insert(StatementKind::skPreprocessor,item);
|
||||||
mStatementColors->insert(StatementKind::skEnum,item);
|
mStatementColors->insert(StatementKind::skEnum,item);
|
||||||
if (haveGoodContrast(item->foreground(), baseColor)) {
|
// if (haveGoodContrast(item->foreground(), baseColor)) {
|
||||||
mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
// mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
||||||
} else {
|
// } else {
|
||||||
mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text));
|
// mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text));
|
||||||
}
|
// }
|
||||||
|
mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
||||||
} else {
|
} else {
|
||||||
mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text));
|
mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text));
|
||||||
}
|
}
|
||||||
|
@ -527,6 +527,18 @@ void MainWindow::updateEditorColorSchemes()
|
||||||
} else {
|
} else {
|
||||||
ui->tableIssues->setWarningColor(palette().color(QPalette::Text));
|
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()
|
void MainWindow::applySettings()
|
||||||
|
|
|
@ -25,7 +25,7 @@ CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
||||||
kind = statement->kind;
|
kind = statement->kind;
|
||||||
}
|
}
|
||||||
PColorSchemeItem item = mColors->value(kind,PColorSchemeItem());
|
PColorSchemeItem item = mColors->value(kind,PColorSchemeItem());
|
||||||
if (item && haveGoodContrast(item->foreground(),palette().color(QPalette::Base))) {
|
if (item) {
|
||||||
return item->foreground();
|
return item->foreground();
|
||||||
}
|
}
|
||||||
return palette().color(QPalette::Text);
|
return palette().color(QPalette::Text);
|
||||||
|
@ -922,8 +922,7 @@ QVariant CodeCompletionListModel::data(const QModelIndex &index, int role) const
|
||||||
PStatement statement = mStatements->at(index.row());
|
PStatement statement = mStatements->at(index.row());
|
||||||
if (mColorCallback)
|
if (mColorCallback)
|
||||||
return mColorCallback(statement);
|
return mColorCallback(statement);
|
||||||
QApplication *app = dynamic_cast<QApplication *>(QApplication::instance());
|
return qApp->palette().color(QPalette::Text);
|
||||||
return app->palette().color(QPalette::Text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
Loading…
Reference in New Issue