void GuiSetBorder::mousePressEvent(QMouseEvent * e)
{
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ if (e->position().y() > e->position().x()) {
+ if (e->position().y() < height() - e->position().x()) {
+#else
if (e->y() > e->x()) {
if (e->y() < height() - e->x()) {
+#endif
if (left_.enabled) {
setLeft(left_.set == LINE_SET ? LINE_UNSET : LINE_SET);
// emit signal
leftSet();
}
} else {
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ if (bottom_trim_left_.enabled && e->position().x() < margin + 4 + 2 * corner_length) {
+#else
if (bottom_trim_left_.enabled && e->x() < margin + 4 + 2 * corner_length) {
+#endif
setBottomLeftTrim(bottom_trim_left_.set == LINE_SET ? LINE_UNSET : LINE_SET);
// emit signal
bottomLTSet();
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ } else if (bottom_trim_right_.enabled && e->position().x() > bwidth - margin - 2 * corner_length - 4) {
+#else
} else if (bottom_trim_right_.enabled && e->x() > bwidth - margin - 2 * corner_length - 4) {
+#endif
setBottomRightTrim(bottom_trim_right_.set == LINE_SET ? LINE_UNSET : LINE_SET);
// emit signal
bottomRTSet();
}
}
} else {
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ if (e->position().y() < height() - e->position().x()) {
+ if (top_trim_left_.enabled && e->position().x() < margin + 4 + 2 * corner_length) {
+#else
if (e->y() < height() - e->x()) {
if (top_trim_left_.enabled && e->x() < margin + 4 + 2 * corner_length) {
+#endif
setTopLeftTrim(top_trim_left_.set == LINE_SET ? LINE_UNSET : LINE_SET);
// emit signal
topLTSet();
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+ } else if (top_trim_right_.enabled && e->position().x() > bwidth - margin - 2 * corner_length - 4) {
+#else
} else if (top_trim_right_.enabled && e->x() > bwidth - margin - 2 * corner_length - 4) {
+#endif
setTopRightTrim(top_trim_right_.set == LINE_SET ? LINE_UNSET : LINE_SET);
// emit signal
topRTSet();
}
-void GuiSetBorder::undrawWideTopLine()
+void GuiSetBorder::undrawWideTopLine(bool const right)
{
- if (!top_drawn_wide_)
+ if (!top_drawn_wide_ && !right)
return;
// Overpaint previous lines white
- drawLine(Qt::white, margin + corner_length + 2, margin + corner_length,
- bwidth - margin - corner_length - 1, margin + corner_length);
+ if (right)
+ drawLine(Qt::white, margin + 2 * (corner_length + 2), margin + corner_length,
+ bwidth - margin - corner_length - 1, margin + corner_length);
+ else
+ drawLine(Qt::white, margin + corner_length + 2, margin + corner_length,
+ bwidth - margin - corner_length - 1, margin + corner_length);
top_drawn_wide_ = false;
}
}
-void GuiSetBorder::undrawWideBottomLine()
+void GuiSetBorder::undrawWideBottomLine(bool const right)
{
- if (!bottom_drawn_wide_)
+ if (!bottom_drawn_wide_ && !right)
return;
- //Overpaint previous lines white
- drawLine(Qt::white, margin + corner_length + 2, bwidth - margin - corner_length + 1,
- bwidth - margin - corner_length - 1, bwidth - margin - corner_length + 1);
+ // Overpaint previous lines white
+ if (right)
+ drawLine(Qt::white, margin + 2 * (corner_length + 2), bwidth - margin - corner_length + 1,
+ bwidth - margin - corner_length - 1, bwidth - margin - corner_length + 1);
+ else
+ drawLine(Qt::white, margin + corner_length + 2, bwidth - margin - corner_length + 1,
+ bwidth - margin - corner_length - 1, bwidth - margin - corner_length + 1);
bottom_drawn_wide_ = false;
}
void GuiSetBorder::setTopRightTrimEnabled(bool enabled)
{
top_trim_right_.enabled = enabled;
- undrawWideTopLine();
+ undrawWideTopLine(enabled);
drawTopRightTrim(top_trim_right_.set);
drawTop(top_.set);
- top_drawn_wide_ = !enabled;;
+ top_drawn_wide_ = !enabled;
}
undrawWideBottomLine();
drawBottomLeftTrim(bottom_trim_left_.set);
drawBottom(bottom_.set);
- bottom_drawn_wide_ = !enabled;;
+ bottom_drawn_wide_ = !enabled;
}
void GuiSetBorder::setBottomRightTrimEnabled(bool enabled)
{
bottom_trim_right_.enabled = enabled;
- undrawWideBottomLine();
+ undrawWideBottomLine(enabled);
drawBottomRightTrim(bottom_trim_right_.set);
drawBottom(bottom_.set);
- bottom_drawn_wide_ = !enabled;;
+ bottom_drawn_wide_ = !enabled;
}