Merge pull request #16265 from kadet1090/sketcher-taskpanel-fixes
Gui: Fix issues with icons in sketcher elements panel
This commit is contained in:
@@ -128,6 +128,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
||||
@@ -222,9 +222,9 @@ public:
|
||||
// limitation of not knowing about padding, border and margin boxes of stylesheets
|
||||
// thus being unable to provide proper sizeHint for stylesheets to render correctly
|
||||
if (role == Qt::DecorationRole) {
|
||||
int size = listWidget()->style()->pixelMetric(QStyle::PM_ListViewIconSize);
|
||||
auto size = listWidget()->iconSize();
|
||||
|
||||
return QIcon(QPixmap(QSize(size, size)));
|
||||
return QIcon(QPixmap(size));
|
||||
}
|
||||
|
||||
return QListWidgetItem::data(role);
|
||||
@@ -246,6 +246,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isGeometryPreselected(Sketcher::PointPos pos) const
|
||||
{
|
||||
switch (pos) {
|
||||
case Sketcher::PointPos::none:
|
||||
return hovered == SubElementType::edge;
|
||||
case Sketcher::PointPos::start:
|
||||
return hovered == SubElementType::start;
|
||||
case Sketcher::PointPos::end:
|
||||
return hovered == SubElementType::end;
|
||||
case Sketcher::PointPos::mid:
|
||||
return hovered == SubElementType::mid;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Sketcher::SketchObject* getSketchObject() const
|
||||
{
|
||||
return sketchView->getSketchObject();
|
||||
@@ -943,9 +959,16 @@ void ElementItemDelegate::drawSubControl(SubControl element,
|
||||
|
||||
auto drawSelectIcon = [&](Sketcher::PointPos pos) {
|
||||
auto icon = ElementWidgetIcons::getIcon(item->GeometryType, pos, item->State);
|
||||
auto opacity = 0.4f;
|
||||
|
||||
if (isHovered) {
|
||||
auto isOptionSelected = option.state & QStyle::State_Selected;
|
||||
auto isOptionHovered = option.state & QStyle::State_MouseOver;
|
||||
|
||||
// items that user is not interacting with should be fully opaque
|
||||
// only if item is partially selected (so only one part of geometry)
|
||||
// the rest should be dimmed out
|
||||
auto opacity = isOptionHovered || isOptionSelected ? 0.4 : 1.0;
|
||||
|
||||
if (item->isGeometryPreselected(pos)) {
|
||||
opacity = 0.8f;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user