Allow changing SeparatePanel title height.
This commit is contained in:
parent
303947c78c
commit
dcb4a33eef
3 changed files with 15 additions and 3 deletions
|
|
@ -160,6 +160,7 @@ boxDividerHeight: 10px;
|
||||||
|
|
||||||
separatePanelBorderCacheSize: 60px;
|
separatePanelBorderCacheSize: 60px;
|
||||||
separatePanelTitleHeight: 62px;
|
separatePanelTitleHeight: 62px;
|
||||||
|
separatePanelNoTitleHeight: 32px;
|
||||||
separatePanelClose: IconButton(boxTitleClose) {
|
separatePanelClose: IconButton(boxTitleClose) {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@ SeparatePanel::SeparatePanel(QWidget *parent)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _close(this, st::separatePanelClose)
|
, _close(this, st::separatePanelClose)
|
||||||
, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
|
, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
|
||||||
, _body(this) {
|
, _body(this)
|
||||||
|
, _titleHeight(st::separatePanelTitleHeight) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setWindowIcon(QGuiApplication::windowIcon());
|
setWindowIcon(QGuiApplication::windowIcon());
|
||||||
initControls();
|
initControls();
|
||||||
|
|
@ -107,6 +108,11 @@ void SeparatePanel::setTitle(rpl::producer<QString> title) {
|
||||||
updateTitleGeometry(width());
|
updateTitleGeometry(width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SeparatePanel::setTitleHeight(int height) {
|
||||||
|
_titleHeight = height;
|
||||||
|
updateControlsGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void SeparatePanel::initControls() {
|
void SeparatePanel::initControls() {
|
||||||
widthValue(
|
widthValue(
|
||||||
) | rpl::start_with_next([=](int width) {
|
) | rpl::start_with_next([=](int width) {
|
||||||
|
|
@ -127,6 +133,9 @@ void SeparatePanel::initControls() {
|
||||||
}, _back->lifetime());
|
}, _back->lifetime());
|
||||||
_back->hide(anim::type::instant);
|
_back->hide(anim::type::instant);
|
||||||
_titleLeft.stop();
|
_titleLeft.stop();
|
||||||
|
|
||||||
|
_back->raise();
|
||||||
|
_close->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeparatePanel::updateTitleGeometry(int newWidth) {
|
void SeparatePanel::updateTitleGeometry(int newWidth) {
|
||||||
|
|
@ -552,7 +561,7 @@ void SeparatePanel::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeparatePanel::updateControlsGeometry() {
|
void SeparatePanel::updateControlsGeometry() {
|
||||||
const auto top = _padding.top() + st::separatePanelTitleHeight;
|
const auto top = _padding.top() + _titleHeight;
|
||||||
_body->setGeometry(
|
_body->setGeometry(
|
||||||
_padding.left(),
|
_padding.left(),
|
||||||
top,
|
top,
|
||||||
|
|
@ -716,7 +725,7 @@ void SeparatePanel::mousePressEvent(QMouseEvent *e) {
|
||||||
_padding.left(),
|
_padding.left(),
|
||||||
_padding.top(),
|
_padding.top(),
|
||||||
width() - _padding.left() - _padding.right(),
|
width() - _padding.left() - _padding.right(),
|
||||||
st::separatePanelTitleHeight);
|
_titleHeight);
|
||||||
if (e->button() == Qt::LeftButton) {
|
if (e->button() == Qt::LeftButton) {
|
||||||
if (dragArea.contains(e->pos())) {
|
if (dragArea.contains(e->pos())) {
|
||||||
const auto dragViaSystem = [&] {
|
const auto dragViaSystem = [&] {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public:
|
||||||
explicit SeparatePanel(QWidget *parent = nullptr);
|
explicit SeparatePanel(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setTitle(rpl::producer<QString> title);
|
void setTitle(rpl::producer<QString> title);
|
||||||
|
void setTitleHeight(int height);
|
||||||
void setInnerSize(QSize size);
|
void setInnerSize(QSize size);
|
||||||
[[nodiscard]] QRect innerGeometry() const;
|
[[nodiscard]] QRect innerGeometry() const;
|
||||||
|
|
||||||
|
|
@ -105,6 +106,7 @@ private:
|
||||||
rpl::event_stream<> _userCloseRequests;
|
rpl::event_stream<> _userCloseRequests;
|
||||||
rpl::event_stream<> _closeEvents;
|
rpl::event_stream<> _closeEvents;
|
||||||
|
|
||||||
|
int _titleHeight = 0;
|
||||||
bool _hideOnDeactivate = false;
|
bool _hideOnDeactivate = false;
|
||||||
bool _useTransparency = true;
|
bool _useTransparency = true;
|
||||||
style::margins _padding;
|
style::margins _padding;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue