Bugfix: D25 view background color synchronized with layout view now

This commit is contained in:
Matthias Koefferlein 2022-08-27 14:09:09 +02:00
parent 5613ef1089
commit 7c776779a6
3 changed files with 25 additions and 6 deletions

View File

@ -25,6 +25,8 @@
#include "layD25View.h"
#include "layLayoutView.h"
#include "layConverters.h"
#include "laybasicConfig.h"
#include "layQtTools.h"
#include "ui_D25View.h"
@ -77,11 +79,6 @@ D25View::D25View (lay::Dispatcher *root, LayoutViewBase *view)
view->cellviews_changed_event.add (this, &D25View::cellviews_changed);
view->layer_list_changed_event.add (this, &D25View::layer_properties_changed);
QPalette palette = mp_ui->material_list->palette ();
palette.setColor (QPalette::Base, Qt::black);
palette.setColor (QPalette::Text, Qt::white);
mp_ui->material_list->setPalette (palette);
QFont font = mp_ui->material_list->font ();
font.setWeight (QFont::Bold);
mp_ui->material_list->setFont (font);
@ -119,6 +116,27 @@ D25View::layer_properties_changed (int)
// .. nothing yet ..
}
bool D25View::configure(const std::string &name, const std::string &value)
{
if (name == lay::cfg_background_color) {
lay::ColorConverter lc;
tl::Color bg;
lc.from_string (value, bg);
QPalette palette = mp_ui->material_list->palette ();
palette.setColor (QPalette::Base, bg.to_qc ());
palette.setColor (QPalette::Text, bg.to_mono () ? Qt::black : Qt::white);
mp_ui->material_list->setPalette (palette);
mp_ui->d25_view->update ();
}
return lay::Browser::configure (name, value);
}
void
D25View::menu_activated (const std::string &symbol)
{

View File

@ -60,6 +60,7 @@ public:
D25View (lay::Dispatcher *root, lay::LayoutViewBase *view);
~D25View ();
virtual bool configure (const std::string &name, const std::string &value);
virtual void menu_activated (const std::string &symbol);
virtual void deactivated ();
virtual void activated ();

View File

@ -53,7 +53,7 @@
z(input(1, 0), 0.1 .. 0.2)
z(input(2, 0), height: 250.nm, color: 0xffbc80)
zz(like: 7/0, name: "Metal") do
zz(like: "7/0", name: "Metal") do
z(input(7, 0), height: 100.nm)
z(input(8, 0), height: 150.nm)
end