CComponentsForm: reduce corner radius on frame border

If we have a frame around parent item, ensure matching corners
inside of embedded item, this avoids ugly unpainted spaces
between frame and item border.

TODO: other constellations are not considered at the moment!
This commit is contained in:
2014-10-04 19:09:31 +02:00
parent f7faf07ab1
commit 09851f3b9f

View File

@@ -423,6 +423,7 @@ void CComponentsForm::paintCCItems()
continue; continue;
} }
//move item x-position, if we have a frame on parent, TODO: other constellations not considered at the moment
w_parent_frame = xpos <= fr_thickness ? fr_thickness : 0; w_parent_frame = xpos <= fr_thickness ? fr_thickness : 0;
//set required x-position to item: //set required x-position to item:
@@ -442,6 +443,7 @@ void CComponentsForm::paintCCItems()
auto_x = (cc_item->getRealXPos() + w_item); auto_x = (cc_item->getRealXPos() + w_item);
} }
//move item y-position, if we have a frame on parent, TODO: other constellations not considered at the moment
w_parent_frame = ypos <= fr_thickness ? fr_thickness : 0; w_parent_frame = ypos <= fr_thickness ? fr_thickness : 0;
//set required y-position to item //set required y-position to item
@@ -461,6 +463,13 @@ void CComponentsForm::paintCCItems()
auto_y = (cc_item->getRealYPos() + h_item); auto_y = (cc_item->getRealYPos() + h_item);
} }
//reduce corner radius, if we have a frame around parent item, ensure matching corners inside of embedded item, this avoids ugly unpainted spaces between frame and item border
//TODO: other constellations not considered at the moment
if (w_parent_frame){
if(xpos <= fr_thickness || ypos <= fr_thickness)
cc_item->setCorner(max(0, cc_item->getCornerRadius()-w_parent_frame), cc_item->getCornerType());
}
//These steps check whether the element can be painted into the container. //These steps check whether the element can be painted into the container.
//Is it too wide or too high, it will be shortened and displayed in the log. //Is it too wide or too high, it will be shortened and displayed in the log.
//This should be avoid! //This should be avoid!