mirror of https://github.com/KLayout/klayout.git
Bugfix: consider device pixel ratio for layout canvas
This commit is contained in:
parent
070ef54c66
commit
290cd39ad9
|
|
@ -291,27 +291,6 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
|
|||
m_do_end_of_drawing_dm (this, &LayoutCanvas::do_end_of_drawing),
|
||||
m_image_cache_size (1)
|
||||
{
|
||||
tl::Color bg (0xffffffff), fg (0xff000000), active (0xffc0c0c0);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
if (widget ()) {
|
||||
|
||||
#if QT_VERSION > 0x050000
|
||||
m_dpr = widget ()->devicePixelRatio ();
|
||||
#endif
|
||||
|
||||
widget ()->setObjectName (QString::fromUtf8 ("canvas"));
|
||||
widget ()->setBackgroundRole (QPalette::NoRole);
|
||||
|
||||
bg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ());
|
||||
fg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ());
|
||||
active = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ());
|
||||
|
||||
widget ()->setAttribute (Qt::WA_NoSystemBackground);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// The gamma value used for subsampling: something between 1.8 and 2.2.
|
||||
m_gamma = 2.0;
|
||||
|
||||
|
|
@ -321,6 +300,7 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
|
|||
|
||||
mp_redraw_thread = new lay::RedrawThread (this, view);
|
||||
|
||||
tl::Color bg (0xffffffff), fg (0xff000000), active (0xffc0c0c0);
|
||||
set_colors (bg, fg, active);
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +329,32 @@ LayoutCanvas::~LayoutCanvas ()
|
|||
clear_fg_bitmaps ();
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
void
|
||||
LayoutCanvas::init_ui (QWidget *parent)
|
||||
{
|
||||
lay::ViewObjectUI::init_ui (parent);
|
||||
|
||||
if (widget ()) {
|
||||
|
||||
#if QT_VERSION > 0x050000
|
||||
m_dpr = widget ()->devicePixelRatio ();
|
||||
#endif
|
||||
|
||||
widget ()->setObjectName (QString::fromUtf8 ("canvas"));
|
||||
widget ()->setBackgroundRole (QPalette::NoRole);
|
||||
|
||||
tl::Color bg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Window).rgb ());
|
||||
tl::Color fg = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Text).rgb ());
|
||||
tl::Color active = tl::Color (widget ()->palette ().color (QPalette::Normal, QPalette::Mid).rgb ());
|
||||
set_colors (bg, fg, active);
|
||||
|
||||
widget ()->setAttribute (Qt::WA_NoSystemBackground);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
LayoutCanvas::key_event (unsigned int key, unsigned int buttons)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -143,6 +143,15 @@ public:
|
|||
LayoutCanvas (lay::LayoutViewBase *view);
|
||||
~LayoutCanvas ();
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
/**
|
||||
* @brief Initializes the widgets
|
||||
*
|
||||
* This method needs to be called after the constructor to establish the drawing widget.
|
||||
*/
|
||||
virtual void init_ui (QWidget *parent);
|
||||
#endif
|
||||
|
||||
void set_colors (tl::Color background, tl::Color foreground, tl::Color active);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ public:
|
|||
/**
|
||||
* @brief Initializes the UI components
|
||||
*/
|
||||
void init_ui (QWidget *parent);
|
||||
virtual void init_ui (QWidget *parent);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue