mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
updated splitheader
This commit is contained in:
parent
27cd953c8c
commit
28fb877020
|
@ -197,7 +197,9 @@ SOURCES += \
|
||||||
src/controllers/accounts/accountcontroller.cpp \
|
src/controllers/accounts/accountcontroller.cpp \
|
||||||
src/controllers/accounts/accountmodel.cpp \
|
src/controllers/accounts/accountmodel.cpp \
|
||||||
src/controllers/accounts/account.cpp \
|
src/controllers/accounts/account.cpp \
|
||||||
src/widgets/helper/splitoverlay.cpp
|
src/widgets/helper/splitoverlay.cpp \
|
||||||
|
src/widgets/helper/dropoverlay.cpp \
|
||||||
|
src/widgets/helper/splitnode.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/precompiled_header.hpp \
|
src/precompiled_header.hpp \
|
||||||
|
@ -343,7 +345,9 @@ HEADERS += \
|
||||||
src/controllers/accounts/accountmodel.hpp \
|
src/controllers/accounts/accountmodel.hpp \
|
||||||
src/controllers/accounts/account.hpp \
|
src/controllers/accounts/account.hpp \
|
||||||
src/util/sharedptrelementless.hpp \
|
src/util/sharedptrelementless.hpp \
|
||||||
src/widgets/helper/splitoverlay.hpp
|
src/widgets/helper/splitoverlay.hpp \
|
||||||
|
src/widgets/helper/dropoverlay.hpp \
|
||||||
|
src/widgets/helper/splitnode.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc
|
resources/resources.qrc
|
||||||
|
|
|
@ -241,13 +241,13 @@ void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||||
tooltipWidget->show();
|
tooltipWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this->dragging) {
|
if (this->dragging) {
|
||||||
// if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
||||||
// std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
||||||
// this->split->drag();
|
this->split->drag();
|
||||||
// this->dragging = false;
|
this->dragging = false;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitHeader::leaveEvent(QEvent *event)
|
void SplitHeader::leaveEvent(QEvent *event)
|
||||||
|
|
|
@ -112,9 +112,9 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
void SplitOverlay::resizeEvent(QResizeEvent *event)
|
void SplitOverlay::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
float scale = this->getScale();
|
float _scale = this->getScale();
|
||||||
bool wideEnough = event->size().width() > 150 * scale;
|
bool wideEnough = event->size().width() > 150 * _scale;
|
||||||
bool highEnough = event->size().height() > 150 * scale;
|
bool highEnough = event->size().height() > 150 * _scale;
|
||||||
|
|
||||||
this->_left->setVisible(wideEnough);
|
this->_left->setVisible(wideEnough);
|
||||||
this->_right->setVisible(wideEnough);
|
this->_right->setVisible(wideEnough);
|
||||||
|
|
|
@ -189,22 +189,11 @@ public:
|
||||||
{
|
{
|
||||||
auto &siblings = this->parent->children;
|
auto &siblings = this->parent->children;
|
||||||
|
|
||||||
qreal size =
|
qreal width = this->parent->geometry.width() / siblings.size();
|
||||||
// std::accumulate(this->parent->children.begin(),
|
qreal height = this->parent->geometry.height() / siblings.size();
|
||||||
// this->parent->children.end(), 0,
|
|
||||||
// [_direction](qreal val, Node *node) {
|
|
||||||
// if (toContainerType(_direction) ==
|
|
||||||
// Type::VerticalContainer) {
|
|
||||||
// return val + node->geometry.height();
|
|
||||||
// } else {
|
|
||||||
// return val + node->geometry.width();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
this->parent->geometry.width() / siblings.size();
|
|
||||||
|
|
||||||
if (siblings.size() == 1) {
|
if (siblings.size() == 1) {
|
||||||
this->geometry = QRect(0, 0, size, size);
|
this->geometry = QRect(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = std::find_if(siblings.begin(), siblings.end(),
|
auto it = std::find_if(siblings.begin(), siblings.end(),
|
||||||
|
@ -216,7 +205,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *node = new Node(_split, this->parent);
|
Node *node = new Node(_split, this->parent);
|
||||||
node->geometry = QRectF(0, 0, size, size);
|
node->geometry = QRectF(0, 0, width, height);
|
||||||
siblings.insert(it, std::unique_ptr<Node>(node));
|
siblings.insert(it, std::unique_ptr<Node>(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue