diff --git a/src/widgets/helper/notebookbutton.cpp b/src/widgets/helper/notebookbutton.cpp index 174e1a998..5a3b651b8 100644 --- a/src/widgets/helper/notebookbutton.cpp +++ b/src/widgets/helper/notebookbutton.cpp @@ -45,12 +45,20 @@ void NotebookButton::paintEvent(QPaintEvent *) float h = height(), w = width(); if (icon == IconPlus) { - painter.fillRect( - QRectF((h / 12) * 2 + 1, (h / 12) * 5 + 1, w - ((h / 12) * 5), (h / 12) * 1), - foreground); - painter.fillRect( - QRectF((h / 12) * 5 + 1, (h / 12) * 2 + 1, (h / 12) * 1, w - ((h / 12) * 5)), - foreground); + painter.setPen([&] { + QColor tmp = foreground; + if (!this->mouseOver) { + tmp.setAlpha(180); + } + return tmp; + }()); + QRect rect = this->rect(); + int s = h * 4 / 9; + + painter.drawLine(rect.left() + rect.width() / 2 - (s / 2), rect.top() + rect.height() / 2, + rect.left() + rect.width() / 2 + (s / 2), rect.top() + rect.height() / 2); + painter.drawLine(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2 - (s / 2), + rect.left() + rect.width() / 2, rect.top() + rect.height() / 2 + (s / 2)); } else if (icon == IconUser) { painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::HighQualityAntialiasing); diff --git a/src/widgets/notebook.cpp b/src/widgets/notebook.cpp index a099c0c20..0e9539e2e 100644 --- a/src/widgets/notebook.cpp +++ b/src/widgets/notebook.cpp @@ -90,7 +90,7 @@ void Notebook::removePage(QWidget *page) } } - this->performLayout(); + this->performLayout(true); } void Notebook::removeCurrentPage() @@ -262,7 +262,7 @@ void Notebook::rearrangePage(QWidget *page, int index) { this->items.move(this->indexOf(page), index); - this->performLayout(); + this->performLayout(true); } bool Notebook::getAllowUserTabManagement() const @@ -307,7 +307,7 @@ void Notebook::performLayout(bool animated) { auto app = getApp(); - int xStart = (int)(2 * this->getScale()); + int xStart = int(2 * this->getScale()); int x = xStart, y = 0; float scale = this->getScale(); @@ -349,12 +349,12 @@ void Notebook::performLayout(bool animated) for (auto i = this->items.begin(); i != this->items.end(); i++) { // int yOffset = i->tab->isSelected() ? 0 : 1; - if (!first && - (i == this->items.end() && this->showAddButton ? tabHeight : 0) + x + i->tab->width() > - width()) // - { + bool wrap = + !first && (((i + 1 == this->items.end() && this->showAddButton) ? tabHeight : 0) + x + + i->tab->width()) > width(); + + if (wrap) { y += i->tab->height(); - // y += 20; i->tab->moveAnimated(QPoint(xStart, y), animated); x = i->tab->width() + xStart; } else { @@ -376,7 +376,7 @@ void Notebook::performLayout(bool animated) this->update(); } - y += (int)(3 * scale); + y += int(3 * scale); for (auto &i : this->items) { i.tab->raise(); diff --git a/src/widgets/notebook.hpp b/src/widgets/notebook.hpp index e419c3298..005bd1593 100644 --- a/src/widgets/notebook.hpp +++ b/src/widgets/notebook.hpp @@ -45,7 +45,7 @@ public: bool getShowAddButton() const; void setShowAddButton(bool value); - void performLayout(bool animate = true); + void performLayout(bool animate = false); protected: virtual void scaleChangedEvent(float scale) override; diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp index a7578d77c..52a408ee4 100644 --- a/src/widgets/split.cpp +++ b/src/widgets/split.cpp @@ -311,6 +311,10 @@ void Split::enterEvent(QEvent *event) if (modifierStatus == showSplitOverlayModifiers /*|| modifierStatus == showAddSplitRegions*/) { this->overlay->show(); } + + if (this->container != nullptr) { + this->container->resetMouseStatus(); + } } void Split::leaveEvent(QEvent *event) diff --git a/src/widgets/splitcontainer.cpp b/src/widgets/splitcontainer.cpp index cccf8a490..535e1f475 100644 --- a/src/widgets/splitcontainer.cpp +++ b/src/widgets/splitcontainer.cpp @@ -97,6 +97,12 @@ void SplitContainer::hideResizeHandles() } } +void SplitContainer::resetMouseStatus() +{ + this->mouseOverPoint = QPoint(-10000, -10000); + this->update(); +} + void SplitContainer::appendNewSplit(bool openChannelNameDialog) { util::assertInGuiThread(); @@ -468,6 +474,10 @@ void SplitContainer::dragEnterEvent(QDragEnterEvent *event) void SplitContainer::mouseMoveEvent(QMouseEvent *event) { + if (Split::modifierStatus == showSplitOverlayModifiers) { + this->setCursor(Qt::PointingHandCursor); + } + this->mouseOverPoint = event->pos(); this->update(); } diff --git a/src/widgets/splitcontainer.hpp b/src/widgets/splitcontainer.hpp index d86d83c7e..367610847 100644 --- a/src/widgets/splitcontainer.hpp +++ b/src/widgets/splitcontainer.hpp @@ -188,6 +188,7 @@ public: void setTab(NotebookTab *tab); void hideResizeHandles(); + void resetMouseStatus(); static bool isDraggingSplit; static Split *draggingSplit;