Fixed tooltip display when hiding media player panel.

This commit is contained in:
John Preston 2016-10-14 21:44:15 +03:00
parent 5d6dafeeda
commit fa0e255183
4 changed files with 21 additions and 12 deletions

View file

@ -1752,6 +1752,7 @@ void HistoryInner::leaveEvent(QEvent *e) {
App::hoveredItem(nullptr);
}
ClickHandler::clearActive();
PopupTooltip::Hide();
if (!ClickHandler::getPressed() && _cursor != style::cur_default) {
_cursor = style::cur_default;
setCursor(_cursor);
@ -2292,9 +2293,11 @@ QPoint HistoryInner::tooltipPos() const {
}
void HistoryInner::onParentGeometryChanged() {
bool needToUpdate = (_dragAction != NoDrag || _touchScroll || rect().contains(mapFromGlobal(QCursor::pos())));
auto mousePos = QCursor::pos();
auto mouseOver = _widget->rect().contains(_widget->mapFromGlobal(mousePos));
auto needToUpdate = (_dragAction != NoDrag || _touchScroll || mouseOver);
if (needToUpdate) {
dragActionUpdate(QCursor::pos());
dragActionUpdate(mousePos);
}
}

View file

@ -65,7 +65,13 @@ void Panel::resizeEvent(QResizeEvent *e) {
}
void Panel::onListHeightUpdated() {
updateSize();
if (auto widget = _scroll->widget()) {
if (widget->height() > 0 || _cover) {
updateSize();
} else {
hideIgnoringEnterEvents();
}
}
}
void Panel::updateControlsGeometry() {
@ -108,10 +114,6 @@ void Panel::scrollPlaylistToCurrentTrack() {
auto rect = list->getCurrentTrackGeometry();
auto top = _scroll->scrollTop(), bottom = top + _scroll->height();
_scroll->scrollToY(rect.y());
//if (top > rect.y()) {
//} else if (bottom < rect.y() + rect.height()) {
// _scroll->scrollToY(rect.y() + rect.height() - _scroll->height());
//}
}
}
@ -130,7 +132,7 @@ void Panel::updateSize() {
height += _cover->height();
}
auto listHeight = 0;
if (auto widget = static_cast<ScrolledWidget*>(_scroll->widget())) {
if (auto widget = _scroll->widget()) {
listHeight = widget->height();
}
auto scrollVisible = (listHeight > 0);
@ -261,6 +263,12 @@ void Panel::setPinCallback(PinCallback &&callback) {
void Panel::onShowStart() {
ensureCreated();
if (auto widget = _scroll->widget()) {
if (widget->height() <= 0 && !_cover) {
return;
}
}
if (isHidden()) {
scrollPlaylistToCurrentTrack();
show();

View file

@ -210,14 +210,12 @@ void Widget::handleSeekFinished(float64 progress) {
}
void Widget::resizeEvent(QResizeEvent *e) {
updatePlayPrevNextPositions();
auto right = st::mediaPlayerCloseRight;
_close->moveToRight(right, st::mediaPlayerPlayTop); right += _close->width();
_repeatTrack->moveToRight(right, st::mediaPlayerPlayTop); right += _repeatTrack->width();
_volumeToggle->moveToRight(right, st::mediaPlayerPlayTop); right += _volumeToggle->width();
updateLabelsGeometry();
updatePlayPrevNextPositions();
_playback->setGeometry(0, height() - st::mediaPlayerPlayback.fullWidth, width(), st::mediaPlayerPlayback.fullWidth);
}
@ -262,6 +260,7 @@ void Widget::updatePlayPrevNextPositions() {
} else {
_playPause->moveToLeft(left, top);
}
updateLabelsGeometry();
}
int Widget::getLabelsLeft() const {

View file

@ -139,7 +139,6 @@ private:
a_height.finish();
_a_height.stop();
_forceHeight = _hiding ? 0 : -1;
sendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
if (_hiding) hide();
} else {
a_height.update(dt, anim::linear);