diff --git a/src/laybasic/laybasic/layDitherPattern.h b/src/laybasic/laybasic/layDitherPattern.h
index 9a2e91836..a0980e581 100644
--- a/src/laybasic/laybasic/layDitherPattern.h
+++ b/src/laybasic/laybasic/layDitherPattern.h
@@ -134,6 +134,7 @@ public:
*
* @param width The desired width (-1 for default)
* @param height The desired height (-1 for default)
+ * @param frame_width The width of the frame around the bitmap
*/
QBitmap get_bitmap (int width = -1, int height = -1, int frame_width = -1) const;
#endif
diff --git a/src/layui/layui/SelectStippleForm.ui b/src/layui/layui/SelectStippleForm.ui
index 40b6a314b..e4363cd98 100644
--- a/src/layui/layui/SelectStippleForm.ui
+++ b/src/layui/layui/SelectStippleForm.ui
@@ -54,8 +54,8 @@
- 34
- 36
+ 32
+ 32
diff --git a/src/layui/layui/laySelectStippleForm.cc b/src/layui/layui/laySelectStippleForm.cc
index 76f9354a4..ca15ca0f2 100644
--- a/src/layui/layui/laySelectStippleForm.cc
+++ b/src/layui/layui/laySelectStippleForm.cc
@@ -77,8 +77,16 @@ namespace {
void
SelectStippleForm::update ()
{
+#if QT_VERSION >= 0x050000
+ double dpr = devicePixelRatio ();
+#else
+ double dpr = 1.0;
+#endif
+
mp_ui->stipple_items->clear ();
+ QSize icon_size = mp_ui->stipple_items->iconSize ();
+
if (m_include_nil) {
new QListWidgetItem (QObject::tr ("None"), mp_ui->stipple_items);
}
@@ -91,21 +99,41 @@ SelectStippleForm::update ()
// fill the list of stipple items
for (lay::DitherPattern::iterator i = m_pattern.begin (); i != m_pattern.begin_custom (); ++i) {
+
std::string name (i->name ());
if (name.empty ()) {
name = tl::sprintf ("#%d", std::distance (m_pattern.begin (), i));
}
- new QListWidgetItem (QIcon (i->get_bitmap ()), tl::to_qstring (name), mp_ui->stipple_items);
+
+ lay::DitherPatternInfo dp_info = *i;
+ dp_info.scale_pattern (dpr);
+ QBitmap bitmap = dp_info.get_bitmap (icon_size.width () * dpr, icon_size.height () * dpr, dpr);
+#if QT_VERSION >= 0x050000
+ bitmap.setDevicePixelRatio (dpr);
+#endif
+ new QListWidgetItem (QIcon (bitmap), tl::to_qstring (name), mp_ui->stipple_items);
+
}
for (std::vector ::const_iterator i = iters.begin (); i != iters.end (); ++i) {
+
if ((*i)->order_index () > 0) {
+
std::string name ((*i)->name ());
if (name.empty ()) {
name = tl::sprintf ("custom #%d", (*i)->order_index ());
}
- new QListWidgetItem (QIcon ((*i)->get_bitmap ()), tl::to_qstring (name), mp_ui->stipple_items);
+
+ lay::DitherPatternInfo dp_info = **i;
+ dp_info.scale_pattern (dpr);
+ QBitmap bitmap = dp_info.get_bitmap (icon_size.width () * dpr, icon_size.height () * dpr, dpr);
+#if QT_VERSION >= 0x050000
+ bitmap.setDevicePixelRatio (dpr);
+#endif
+ new QListWidgetItem (QIcon (bitmap), tl::to_qstring (name), mp_ui->stipple_items);
+
}
+
}
}