Fixes #309 alt tabbing doesn't hide resize handles
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 361 B |
|
@ -65,14 +65,14 @@ SplitOverlay::SplitOverlay(Split *parent)
|
|||
up->setFocusPolicy(Qt::NoFocus);
|
||||
down->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
move->setCursor(Qt::PointingHandCursor);
|
||||
move->setCursor(Qt::SizeAllCursor);
|
||||
left->setCursor(Qt::PointingHandCursor);
|
||||
right->setCursor(Qt::PointingHandCursor);
|
||||
up->setCursor(Qt::PointingHandCursor);
|
||||
down->setCursor(Qt::PointingHandCursor);
|
||||
|
||||
this->managedConnect(this->scaleChanged, [=](float _scale) {
|
||||
int a = _scale * 40;
|
||||
int a = int(_scale * 30);
|
||||
QSize size(a, a);
|
||||
|
||||
move->setIconSize(size);
|
||||
|
@ -83,9 +83,11 @@ SplitOverlay::SplitOverlay(Split *parent)
|
|||
});
|
||||
|
||||
this->setMouseTracking(true);
|
||||
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void SplitOverlay::paintEvent(QPaintEvent *event)
|
||||
void SplitOverlay::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.fillRect(this->rect(), QColor(0, 0, 0, 150));
|
||||
|
@ -95,16 +97,22 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
|
|||
case SplitLeft: {
|
||||
rect = QRect(0, 0, this->width() / 2, this->height());
|
||||
} break;
|
||||
|
||||
case SplitRight: {
|
||||
rect = QRect(this->width() / 2, 0, this->width() / 2, this->height());
|
||||
} break;
|
||||
|
||||
case SplitUp: {
|
||||
rect = QRect(0, 0, this->width(), this->height() / 2);
|
||||
} break;
|
||||
|
||||
case SplitDown: {
|
||||
rect = QRect(0, this->height() / 2, this->width(), this->height() / 2);
|
||||
} break;
|
||||
|
||||
default:;
|
||||
}
|
||||
|
||||
if (!rect.isNull()) {
|
||||
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||
|
@ -174,19 +182,22 @@ bool SplitOverlay::ButtonEventFilter::eventFilter(QObject *watched, QEvent *even
|
|||
this->parent->split->drag();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
} break;
|
||||
case QEvent::MouseButtonRelease: {
|
||||
if (this->hoveredElement != HoveredElement::SplitMove) {
|
||||
SplitContainer *container = this->parent->split->getContainer();
|
||||
|
||||
if (container != nullptr) {
|
||||
auto *_split = new Split(container);
|
||||
container->insertSplit(
|
||||
_split,
|
||||
(SplitContainer::Direction)(this->hoveredElement + SplitContainer::Left -
|
||||
SplitLeft),
|
||||
this->parent->split);
|
||||
auto dir = SplitContainer::Direction(this->hoveredElement +
|
||||
SplitContainer::Left - SplitLeft);
|
||||
container->insertSplit(_split, dir, this->parent->split);
|
||||
this->parent->hide();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default:;
|
||||
}
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,15 @@ void SplitContainer::setTab(NotebookTab *_tab)
|
|||
this->refreshTabTitle();
|
||||
}
|
||||
|
||||
void SplitContainer::hideResizeHandles()
|
||||
{
|
||||
this->overlay.hide();
|
||||
|
||||
for (std::unique_ptr<ResizeHandle> &handle : this->resizeHandles) {
|
||||
handle->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void SplitContainer::appendNewSplit(bool openChannelNameDialog)
|
||||
{
|
||||
util::assertInGuiThread();
|
||||
|
@ -155,6 +164,7 @@ void SplitContainer::addSplit(Split *split)
|
|||
this->tab->setHighlightState(state);
|
||||
}
|
||||
});
|
||||
|
||||
split->focused.connect([this, split] { this->setSelected(split); });
|
||||
|
||||
this->layout();
|
||||
|
@ -197,6 +207,10 @@ SplitContainer::Position SplitContainer::releaseSplit(Split *split)
|
|||
|
||||
this->refreshTabTitle();
|
||||
|
||||
// fourtf: really bad
|
||||
split->getChannelView().tabHighlightRequested.disconnectAll();
|
||||
split->focused.disconnectAll();
|
||||
|
||||
split->getChannelView().tabHighlightRequested.disconnectAll();
|
||||
|
||||
return position;
|
||||
|
|
|
@ -187,6 +187,7 @@ public:
|
|||
Node *getBaseNode();
|
||||
|
||||
void setTab(NotebookTab *tab);
|
||||
void hideResizeHandles();
|
||||
|
||||
static bool isDraggingSplit;
|
||||
static Split *draggingSplit;
|
||||
|
|
|
@ -164,6 +164,10 @@ bool Window::event(QEvent *event)
|
|||
split->updateLastReadMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (SplitContainer *container = dynamic_cast<SplitContainer *>(page)) {
|
||||
container->hideResizeHandles();
|
||||
}
|
||||
} break;
|
||||
|
||||
default:;
|
||||
|
|