Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,23 @@
template class RegisterUiStateQtWidget<StringSelectOptionWidget>;


// Shows the selected entry's text in its own color. An entry with no color
// keeps the theme's text color: Color() is 0, which Qt draws as black.
static void set_selected_text_color(Color color, QLineEdit& line_edit){
QPalette palette;
if (color){
palette.setColor(QPalette::Text, QColor((uint32_t)color));
}
line_edit.setPalette(palette);
Comment thread
dayfine marked this conversation as resolved.
Resolved
}




StringSelectCellWidget::~StringSelectCellWidget(){
m_value.remove_listener(*this);
}
StringSelectCellWidget::StringSelectCellWidget(QWidget& parent, StringSelectCell& value)

Check warning on line 43 in SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::StringSelectCellWidget::StringSelectCellWidget( QWidget & parent , StringSelectCell & value): function_lines=36 (advisory above 25, limit 50)
: NoWheelCompactComboBox(&parent)
, ConfigWidget(value, *this)
, m_value(value)
Expand All @@ -49,9 +60,7 @@

StringSelectCellWidget::update_value();

QPalette palette;
palette.setColor(QPalette::Text, QColor((uint32_t)entry.text_color));
this->lineEdit()->setPalette(palette);
set_selected_text_color(entry.text_color, *this->lineEdit());

connect(
this, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
Expand Down Expand Up @@ -85,14 +94,11 @@
size_t index = m_value.index();
this->setCurrentIndex((int)index);

QPalette palette;
palette.setColor(QPalette::Text, QColor((uint32_t)cases[index].text_color));
// palette.setColor(QPalette::Text, Qt::red);
this->lineEdit()->setPalette(palette);
set_selected_text_color(cases[index].text_color, *this->lineEdit());

update_size_cache();
}
void StringSelectCellWidget::hide_options(){

Check warning on line 101 in SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::StringSelectCellWidget::hide_options(): function_lines=33 (advisory above 25, limit 50)
// cout << "hide_options()" << endl;
do{
// All options shown.
Expand Down Expand Up @@ -122,10 +128,7 @@
this->addItem(pixmap, QString::fromStdString(entry.display_name));
this->setCurrentIndex(0);

QPalette palette;
palette.setColor(QPalette::Text, QColor((uint32_t)entry.text_color));
// palette.setColor(QPalette::Text, Qt::red);
this->lineEdit()->setPalette(palette);
set_selected_text_color(entry.text_color, *this->lineEdit());

}
QSize StringSelectCellWidget::sizeHint() const{
Expand Down
Loading