mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed the split overlay not appearing proprly
This commit is contained in:
parent
c27a4eec33
commit
795758f618
5 changed files with 22 additions and 55 deletions
|
@ -191,6 +191,8 @@ bool TwitchChannel::isBroadcaster()
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
auto app = getApp();
|
||||||
|
|
||||||
|
qDebug() << "ASD" << (this->name == app->accounts->Twitch.getCurrent()->getUserName());
|
||||||
|
|
||||||
return this->name == app->accounts->Twitch.getCurrent()->getUserName();
|
return this->name == app->accounts->Twitch.getCurrent()->getUserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,13 @@ void SplitOverlay::resizeEvent(QResizeEvent *event)
|
||||||
|
|
||||||
void SplitOverlay::mouseMoveEvent(QMouseEvent *event)
|
void SplitOverlay::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((event->modifiers() & Qt::AltModifier) == 0) {
|
BaseWidget::mouseMoveEvent(event);
|
||||||
this->hide();
|
|
||||||
}
|
// qDebug() << QGuiApplication::queryKeyboardModifiers();
|
||||||
|
|
||||||
|
// if ((QGuiApplication::queryKeyboardModifiers() & Qt::AltModifier) == Qt::AltModifier) {
|
||||||
|
// this->hide();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitOverlay::ButtonEventFilter::ButtonEventFilter(SplitOverlay *_parent, HoveredElement _element)
|
SplitOverlay::ButtonEventFilter::ButtonEventFilter(SplitOverlay *_parent, HoveredElement _element)
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
explicit SplitOverlay(Split *parent = nullptr);
|
explicit SplitOverlay(Split *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// bool event(QEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
|
@ -129,10 +129,15 @@ Split::Split(QWidget *parent)
|
||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
this->managedConnect(modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
this->managedConnect(modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
||||||
|
|
||||||
|
qDebug() << "xD" << status;
|
||||||
|
|
||||||
if ((status == Qt::AltModifier || status == (Qt::AltModifier | Qt::ControlModifier)) &&
|
if ((status == Qt::AltModifier || status == (Qt::AltModifier | Qt::ControlModifier)) &&
|
||||||
this->isMouseOver) {
|
this->isMouseOver) {
|
||||||
|
qDebug() << "show";
|
||||||
this->overlay->show();
|
this->overlay->show();
|
||||||
} else {
|
} else {
|
||||||
|
qDebug() << "hide";
|
||||||
this->overlay->hide();
|
this->overlay->hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -271,26 +276,19 @@ void Split::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
void Split::mouseMoveEvent(QMouseEvent *event)
|
void Split::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
this->handleModifiers(event, event->modifiers());
|
this->handleModifiers(event, QGuiApplication::queryKeyboardModifiers());
|
||||||
}
|
|
||||||
|
|
||||||
void Split::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
// if (event->buttons() == Qt::LeftButton && event->modifiers() & Qt::AltModifier) {
|
|
||||||
// this->drag();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::keyPressEvent(QKeyEvent *event)
|
void Split::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
this->view.unsetCursor();
|
this->view.unsetCursor();
|
||||||
this->handleModifiers(event, event->modifiers());
|
this->handleModifiers(event, QGuiApplication::queryKeyboardModifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::keyReleaseEvent(QKeyEvent *event)
|
void Split::keyReleaseEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
this->view.unsetCursor();
|
this->view.unsetCursor();
|
||||||
this->handleModifiers(event, event->modifiers());
|
this->handleModifiers(event, QGuiApplication::queryKeyboardModifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::resizeEvent(QResizeEvent *event)
|
void Split::resizeEvent(QResizeEvent *event)
|
||||||
|
@ -304,7 +302,7 @@ void Split::enterEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
this->isMouseOver = true;
|
this->isMouseOver = true;
|
||||||
|
|
||||||
auto a = modifierStatus;
|
this->handleModifiers(event, QGuiApplication::queryKeyboardModifiers());
|
||||||
|
|
||||||
if (modifierStatus == Qt::AltModifier ||
|
if (modifierStatus == Qt::AltModifier ||
|
||||||
modifierStatus == (Qt::AltModifier | Qt::ControlModifier)) {
|
modifierStatus == (Qt::AltModifier | Qt::ControlModifier)) {
|
||||||
|
@ -315,7 +313,10 @@ void Split::enterEvent(QEvent *event)
|
||||||
void Split::leaveEvent(QEvent *event)
|
void Split::leaveEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
this->isMouseOver = false;
|
this->isMouseOver = false;
|
||||||
|
|
||||||
this->overlay->hide();
|
this->overlay->hide();
|
||||||
|
|
||||||
|
this->handleModifiers(event, QGuiApplication::queryKeyboardModifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers)
|
void Split::handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers)
|
||||||
|
@ -324,41 +325,6 @@ void Split::handleModifiers(QEvent *event, Qt::KeyboardModifiers modifiers)
|
||||||
modifierStatus = modifiers;
|
modifierStatus = modifiers;
|
||||||
modifierStatusChanged.invoke(modifiers);
|
modifierStatusChanged.invoke(modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (modifiers == Qt::AltModifier) {
|
|
||||||
// if (!modifierStatus) {
|
|
||||||
// modifierStatus = true;
|
|
||||||
// modifierStatusChanged.invoke(true);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (modifierStatus) {
|
|
||||||
// modifierStatus = false;
|
|
||||||
// modifierStatusChanged.invoke(false);
|
|
||||||
// }
|
|
||||||
// this->setCursor(Qt::ArrowCursor);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::dragEnterEvent(QDragEnterEvent *event)
|
|
||||||
{
|
|
||||||
event->acceptProposedAction();
|
|
||||||
this->isDragging = true;
|
|
||||||
QTimer::singleShot(1, [this] { this->overlay->show(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::dragLeaveEvent(QDragLeaveEvent *event)
|
|
||||||
{
|
|
||||||
this->overlay->hide();
|
|
||||||
this->isDragging = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::dragMoveEvent(QDragMoveEvent *event)
|
|
||||||
{
|
|
||||||
event->acceptProposedAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Split::dropEvent(QDropEvent *event)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Slots
|
/// Slots
|
||||||
|
|
|
@ -77,18 +77,12 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
|
||||||
void keyPressEvent(QKeyEvent *event) override;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
void keyReleaseEvent(QKeyEvent *event) override;
|
void keyReleaseEvent(QKeyEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void enterEvent(QEvent *event) override;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
||||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
|
||||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
|
||||||
void dropEvent(QDropEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SplitContainer *container;
|
SplitContainer *container;
|
||||||
IndirectChannel channel;
|
IndirectChannel channel;
|
||||||
|
|
Loading…
Reference in a new issue