mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Add simple shadow to subsection tabs.
This commit is contained in:
parent
6a43107bb2
commit
66473738d6
1 changed files with 18 additions and 1 deletions
|
@ -97,10 +97,18 @@ void SubsectionTabs::setupHorizontal(not_null<QWidget*> parent) {
|
||||||
st::chatTabsScroll,
|
st::chatTabsScroll,
|
||||||
true);
|
true);
|
||||||
scroll->show();
|
scroll->show();
|
||||||
|
const auto shadow = Ui::CreateChild<Ui::PlainShadow>(_horizontal);
|
||||||
const auto slider = scroll->setOwnedWidget(
|
const auto slider = scroll->setOwnedWidget(
|
||||||
object_ptr<Ui::HorizontalSlider>(scroll));
|
object_ptr<Ui::HorizontalSlider>(scroll));
|
||||||
setupSlider(scroll, slider, false);
|
setupSlider(scroll, slider, false);
|
||||||
|
|
||||||
|
shadow->showOn(rpl::single(
|
||||||
|
rpl::empty
|
||||||
|
) | rpl::then(
|
||||||
|
scroll->scrolls()
|
||||||
|
) | rpl::map([=] { return scroll->scrollLeft() > 0; }));
|
||||||
|
shadow->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
||||||
_horizontal->resize(
|
_horizontal->resize(
|
||||||
_horizontal->width(),
|
_horizontal->width(),
|
||||||
std::max(toggle->height(), slider->height()));
|
std::max(toggle->height(), slider->height()));
|
||||||
|
@ -121,6 +129,7 @@ void SubsectionTabs::setupHorizontal(not_null<QWidget*> parent) {
|
||||||
const auto togglew = toggle->width();
|
const auto togglew = toggle->width();
|
||||||
const auto height = size.height();
|
const auto height = size.height();
|
||||||
scroll->setGeometry(togglew, 0, size.width() - togglew, height);
|
scroll->setGeometry(togglew, 0, size.width() - togglew, height);
|
||||||
|
shadow->setGeometry(togglew, 0, st::lineWidth, height);
|
||||||
}, scroll->lifetime());
|
}, scroll->lifetime());
|
||||||
|
|
||||||
_horizontal->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
_horizontal->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
||||||
|
@ -156,11 +165,18 @@ void SubsectionTabs::setupVertical(not_null<QWidget*> parent) {
|
||||||
_vertical,
|
_vertical,
|
||||||
st::chatTabsScroll);
|
st::chatTabsScroll);
|
||||||
scroll->show();
|
scroll->show();
|
||||||
|
const auto shadow = Ui::CreateChild<Ui::PlainShadow>(_vertical);
|
||||||
const auto slider = scroll->setOwnedWidget(
|
const auto slider = scroll->setOwnedWidget(
|
||||||
object_ptr<Ui::VerticalSlider>(scroll));
|
object_ptr<Ui::VerticalSlider>(scroll));
|
||||||
setupSlider(scroll, slider, true);
|
setupSlider(scroll, slider, true);
|
||||||
|
|
||||||
|
shadow->showOn(rpl::single(
|
||||||
|
rpl::empty
|
||||||
|
) | rpl::then(
|
||||||
|
scroll->scrolls()
|
||||||
|
) | rpl::map([=] { return scroll->scrollTop() > 0; }));
|
||||||
|
shadow->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
||||||
_vertical->resize(
|
_vertical->resize(
|
||||||
std::max(toggle->width(), slider->width()),
|
std::max(toggle->width(), slider->width()),
|
||||||
_vertical->height());
|
_vertical->height());
|
||||||
|
@ -170,6 +186,7 @@ void SubsectionTabs::setupVertical(not_null<QWidget*> parent) {
|
||||||
const auto toggleh = toggle->height();
|
const auto toggleh = toggle->height();
|
||||||
const auto width = size.width();
|
const auto width = size.width();
|
||||||
scroll->setGeometry(0, toggleh, width, size.height() - toggleh);
|
scroll->setGeometry(0, toggleh, width, size.height() - toggleh);
|
||||||
|
shadow->setGeometry(0, toggleh, width, st::lineWidth);
|
||||||
}, scroll->lifetime());
|
}, scroll->lifetime());
|
||||||
|
|
||||||
_vertical->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
_vertical->paintRequest() | rpl::start_with_next([=](QRect clip) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue