[LyX/master] Let PrefColors support alpha values
Koji Yokota
yokota at lyx.org
Tue Jun 2 04:51:31 UTC 2026
commit 3b406bee7e0c8c6bbfda487660fc616feb3fd8a9
Author: Koji Yokota <yokota at lyx.org>
Date: Thu May 14 17:54:38 2026 +0900
Let PrefColors support alpha values
This makes it possible for preedit strings to be naturally presented
on colored insets
---
src/frontends/qt/GuiPrefs.cpp | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 1c7f3436e1..8b89f7ec34 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1112,9 +1112,9 @@ void PrefColors::updateRC(LyXRC const & rc)
ColorPair colors =
guiApp->colorCache().getAll(lcolors_[i], false);
theme_colors_[i].first = newcolors_[i].first
- = curcolors_[i].first = colors.first.name();
+ = curcolors_[i].first = colors.first.name(QColor::HexArgb);
theme_colors_[i].second = newcolors_[i].second
- = curcolors_[i].second = colors.second.name();
+ = curcolors_[i].second = colors.second.name(QColor::HexArgb);
setSwatches(i, colors);
}
@@ -1192,9 +1192,9 @@ void PrefColors::changeColor(int const &row, bool const &is_dark_mode)
if (setColor(colorsTV_model_.item(row, is_dark_mode), c, color)) {
if (is_dark_mode)
- newcolors_[size_t(row)].second = c.name();
+ newcolors_[size_t(row)].second = c.name(QColor::HexArgb);
else
- newcolors_[size_t(row)].first = c.name();
+ newcolors_[size_t(row)].first = c.name(QColor::HexArgb);
findThemeFromColorSet();
// emit signal
changed();
@@ -1333,7 +1333,7 @@ bool PrefColors::resetAllColor()
bool PrefColors::setColor(QStandardItem *pitem,
QColor const &new_color, QString const &old_color)
{
- if (new_color.isValid() && new_color.name() != old_color) {
+ if (new_color.isValid() && new_color.name(QColor::HexArgb) != old_color) {
QUndoCommand* setColorCmd =
new SetColor(pitem, new_color, old_color, newcolors_,
autoapply_, this);
@@ -1624,8 +1624,8 @@ ColorNamePairs PrefColors::readTheme(FileName const & fullpath, LyXRC & rc) cons
for (size_type row = 0; row < lcolors_.size(); ++row) {
// get colors from extern lcolor
colors[size_t(row)] =
- {getCurrentColor(lcolors_[row], false).name(),
- getCurrentColor(lcolors_[row], true).name()};
+ {getCurrentColor(lcolors_[row], false).name(QColor::HexArgb),
+ getCurrentColor(lcolors_[row], true).name(QColor::HexArgb)};
}
return colors;
}
@@ -2011,10 +2011,10 @@ void PrefColors::filterByColor(const QColor &color)
{
QList<QStandardItem *>rows_found;
for (int i=0; i<colorsTV_model_.rowCount(); ++i) {
- if (colorsTV_model_.item(i, 0)->data(Qt::DecorationRole).value<QColor>().name()
- == color.name() ||
- colorsTV_model_.item(i, 1)->data(Qt::DecorationRole).value<QColor>().name()
- == color.name()) {
+ if (colorsTV_model_.item(i, 0)->data(Qt::DecorationRole).value<QColor>().name(QColor::HexArgb)
+ == color.name(QColor::HexArgb) ||
+ colorsTV_model_.item(i, 1)->data(Qt::DecorationRole).value<QColor>().name(QColor::HexArgb)
+ == color.name(QColor::HexArgb)) {
rows_found.push_back(colorsTV_model_.item(i));
}
}
@@ -4693,9 +4693,9 @@ void SetColor::undo()
void SetColor::setColor(QColor const &color)
{
if (item_.column() == 1)
- newcolors_[size_t(item_.row())].second = color.name();
+ newcolors_[size_t(item_.row())].second = color.name(QColor::HexArgb);
else
- newcolors_[size_t(item_.row())].first = color.name();
+ newcolors_[size_t(item_.row())].first = color.name(QColor::HexArgb);
setSwatch(&item_, color);
parent_->form_->update();
More information about the lyx-cvs
mailing list