Fix background color in collapsed row with child list.
This commit is contained in:
		
							parent
							
								
									7ad26a0fca
								
							
						
					
					
						commit
						2d6bac5a28
					
				
					 4 changed files with 20 additions and 13 deletions
				
			
		| 
						 | 
					@ -570,8 +570,8 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
		.topicJumpCache = _topicJumpCache.get(),
 | 
							.topicJumpCache = _topicJumpCache.get(),
 | 
				
			||||||
		.folder = _openedFolder,
 | 
							.folder = _openedFolder,
 | 
				
			||||||
		.forum = _openedForum,
 | 
							.forum = _openedForum,
 | 
				
			||||||
 | 
							.currentBg = currentBg(),
 | 
				
			||||||
		.filter = _filterId,
 | 
							.filter = _filterId,
 | 
				
			||||||
		.childListShown = childListShown.shown,
 | 
					 | 
				
			||||||
		.now = ms,
 | 
							.now = ms,
 | 
				
			||||||
		.width = fullWidth,
 | 
							.width = fullWidth,
 | 
				
			||||||
		.paused = videoPaused,
 | 
							.paused = videoPaused,
 | 
				
			||||||
| 
						 | 
					@ -659,7 +659,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
				if (reorderingPinned) {
 | 
									if (reorderingPinned) {
 | 
				
			||||||
					const auto pinnedBottom = shownHeight(promoted + _pinnedRows.size());
 | 
										const auto pinnedBottom = shownHeight(promoted + _pinnedRows.size());
 | 
				
			||||||
					const auto pinnedTop = shownHeight(promoted);
 | 
										const auto pinnedTop = shownHeight(promoted);
 | 
				
			||||||
					p.fillRect(0, pinnedTop - skippedTop, fullWidth, pinnedBottom - pinnedTop, st::dialogsBg);
 | 
										p.fillRect(0, pinnedTop - skippedTop, fullWidth, pinnedBottom - pinnedTop, currentBg());
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				p.translate(0, top - skippedTop);
 | 
									p.translate(0, top - skippedTop);
 | 
				
			||||||
| 
						 | 
					@ -686,7 +686,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			p.fillRect(dialogsClip, st::dialogsBg);
 | 
								p.fillRect(dialogsClip, currentBg());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (_state == WidgetState::Filtered) {
 | 
						} else if (_state == WidgetState::Filtered) {
 | 
				
			||||||
		if (!_hashtagResults.empty()) {
 | 
							if (!_hashtagResults.empty()) {
 | 
				
			||||||
| 
						 | 
					@ -703,7 +703,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
				for (; from < to; ++from) {
 | 
									for (; from < to; ++from) {
 | 
				
			||||||
					auto &result = _hashtagResults[from];
 | 
										auto &result = _hashtagResults[from];
 | 
				
			||||||
					bool selected = (from == (isPressed() ? _hashtagPressed : _hashtagSelected));
 | 
										bool selected = (from == (isPressed() ? _hashtagPressed : _hashtagSelected));
 | 
				
			||||||
					p.fillRect(0, 0, fullWidth, st::mentionHeight, selected ? st::mentionBgOver : st::dialogsBg);
 | 
										p.fillRect(0, 0, fullWidth, st::mentionHeight, selected ? st::mentionBgOver : currentBg());
 | 
				
			||||||
					result->row.paintRipple(p, 0, 0, fullWidth);
 | 
										result->row.paintRipple(p, 0, 0, fullWidth);
 | 
				
			||||||
					auto &tag = result->tag;
 | 
										auto &tag = result->tag;
 | 
				
			||||||
					if (selected) {
 | 
										if (selected) {
 | 
				
			||||||
| 
						 | 
					@ -923,6 +923,7 @@ void InnerWidget::paintCollapsedRow(
 | 
				
			||||||
	const auto fullWidth = width();
 | 
						const auto fullWidth = width();
 | 
				
			||||||
	Ui::PaintCollapsedRow(p, row->row, row->folder, text, unread, {
 | 
						Ui::PaintCollapsedRow(p, row->row, row->folder, text, unread, {
 | 
				
			||||||
		.st = _st,
 | 
							.st = _st,
 | 
				
			||||||
 | 
							.currentBg = currentBg(),
 | 
				
			||||||
		.width = fullWidth,
 | 
							.width = fullWidth,
 | 
				
			||||||
		.selected = selected,
 | 
							.selected = selected,
 | 
				
			||||||
		.narrow = (fullWidth < st::columnMinimalWidthLeft / 2),
 | 
							.narrow = (fullWidth < st::columnMinimalWidthLeft / 2),
 | 
				
			||||||
| 
						 | 
					@ -952,7 +953,7 @@ void InnerWidget::paintPeerSearchResult(
 | 
				
			||||||
			? st::dialogsBgActive
 | 
								? st::dialogsBgActive
 | 
				
			||||||
			: context.selected
 | 
								: context.selected
 | 
				
			||||||
			? st::dialogsBgOver
 | 
								? st::dialogsBgOver
 | 
				
			||||||
			: st::dialogsBg));
 | 
								: currentBg()));
 | 
				
			||||||
	if (!context.active) {
 | 
						if (!context.active) {
 | 
				
			||||||
		result->row.paintRipple(p, 0, 0, context.width);
 | 
							result->row.paintRipple(p, 0, 0, context.width);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1048,6 +1049,13 @@ void InnerWidget::paintPeerSearchResult(
 | 
				
			||||||
	result->name.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
 | 
						result->name.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QBrush InnerWidget::currentBg() const {
 | 
				
			||||||
 | 
						return anim::brush(
 | 
				
			||||||
 | 
							st::dialogsBg,
 | 
				
			||||||
 | 
							st::dialogsBgOver,
 | 
				
			||||||
 | 
							_childListShown.current().shown);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void InnerWidget::paintSearchInChat(
 | 
					void InnerWidget::paintSearchInChat(
 | 
				
			||||||
		Painter &p,
 | 
							Painter &p,
 | 
				
			||||||
		const Ui::PaintContext &context) const {
 | 
							const Ui::PaintContext &context) const {
 | 
				
			||||||
| 
						 | 
					@ -1062,7 +1070,7 @@ void InnerWidget::paintSearchInChat(
 | 
				
			||||||
		p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), tr::lng_dlg_search_in(tr::now));
 | 
							p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), tr::lng_dlg_search_in(tr::now));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	auto fullRect = QRect(0, top, width(), height - top);
 | 
						auto fullRect = QRect(0, top, width(), height - top);
 | 
				
			||||||
	p.fillRect(fullRect, st::dialogsBg);
 | 
						p.fillRect(fullRect, currentBg());
 | 
				
			||||||
	if (_searchInChat) {
 | 
						if (_searchInChat) {
 | 
				
			||||||
		if (_searchFromPeer) {
 | 
							if (_searchFromPeer) {
 | 
				
			||||||
			p.fillRect(QRect(0, top + st::dialogsSearchInHeight, width(), st::lineWidth), st::shadowFg);
 | 
								p.fillRect(QRect(0, top + st::dialogsSearchInHeight, width(), st::lineWidth), st::shadowFg);
 | 
				
			||||||
| 
						 | 
					@ -1244,7 +1252,7 @@ void InnerWidget::selectByMouse(QPoint globalPosition) {
 | 
				
			||||||
			_selectedTopicJump = selectedTopicJump;
 | 
								_selectedTopicJump = selectedTopicJump;
 | 
				
			||||||
			_collapsedSelected = collapsedSelected;
 | 
								_collapsedSelected = collapsedSelected;
 | 
				
			||||||
			updateSelectedRow();
 | 
								updateSelectedRow();
 | 
				
			||||||
			setCursor((_selected || _collapsedSelected)
 | 
								setCursor((_selected || _collapsedSelected >= 0)
 | 
				
			||||||
				? style::cur_pointer
 | 
									? style::cur_pointer
 | 
				
			||||||
				: style::cur_default);
 | 
									: style::cur_default);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -377,6 +377,8 @@ private:
 | 
				
			||||||
	void trackSearchResultsHistory(not_null<History*> history);
 | 
						void trackSearchResultsHistory(not_null<History*> history);
 | 
				
			||||||
	void trackSearchResultsForum(Data::Forum *forum);
 | 
						void trackSearchResultsForum(Data::Forum *forum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						[[nodiscard]] QBrush currentBg() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[[nodiscard]] const std::vector<Key> &pinnedChatsOrder() const;
 | 
						[[nodiscard]] const std::vector<Key> &pinnedChatsOrder() const;
 | 
				
			||||||
	void checkReorderPinnedStart(QPoint localPosition);
 | 
						void checkReorderPinnedStart(QPoint localPosition);
 | 
				
			||||||
	int updateReorderIndexGetCount();
 | 
						int updateReorderIndexGetCount();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -305,10 +305,7 @@ void PaintRow(
 | 
				
			||||||
		? st::dialogsBgActive
 | 
							? st::dialogsBgActive
 | 
				
			||||||
		: context.selected
 | 
							: context.selected
 | 
				
			||||||
		? st::dialogsBgOver
 | 
							? st::dialogsBgOver
 | 
				
			||||||
		: anim::brush(
 | 
							: context.currentBg;
 | 
				
			||||||
			st::dialogsBg,
 | 
					 | 
				
			||||||
			st::dialogsBgOver,
 | 
					 | 
				
			||||||
			context.childListShown);
 | 
					 | 
				
			||||||
	p.fillRect(geometry, bg);
 | 
						p.fillRect(geometry, bg);
 | 
				
			||||||
	if (!(flags & Flag::TopicJumpRipple)) {
 | 
						if (!(flags & Flag::TopicJumpRipple)) {
 | 
				
			||||||
		auto ripple = context.active
 | 
							auto ripple = context.active
 | 
				
			||||||
| 
						 | 
					@ -1137,7 +1134,7 @@ void PaintCollapsedRow(
 | 
				
			||||||
		const PaintContext &context) {
 | 
							const PaintContext &context) {
 | 
				
			||||||
	p.fillRect(
 | 
						p.fillRect(
 | 
				
			||||||
		QRect{ 0, 0, context.width, st::dialogsImportantBarHeight },
 | 
							QRect{ 0, 0, context.width, st::dialogsImportantBarHeight },
 | 
				
			||||||
		context.selected ? st::dialogsBgOver : st::dialogsBg);
 | 
							context.selected ? st::dialogsBgOver : context.currentBg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	row.paintRipple(p, 0, 0, context.width);
 | 
						row.paintRipple(p, 0, 0, context.width);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,9 +57,9 @@ struct PaintContext {
 | 
				
			||||||
	TopicJumpCache *topicJumpCache = nullptr;
 | 
						TopicJumpCache *topicJumpCache = nullptr;
 | 
				
			||||||
	Data::Folder *folder = nullptr;
 | 
						Data::Folder *folder = nullptr;
 | 
				
			||||||
	Data::Forum *forum = nullptr;
 | 
						Data::Forum *forum = nullptr;
 | 
				
			||||||
 | 
						QBrush currentBg;
 | 
				
			||||||
	FilterId filter = 0;
 | 
						FilterId filter = 0;
 | 
				
			||||||
	float64 topicsExpanded = 0.;
 | 
						float64 topicsExpanded = 0.;
 | 
				
			||||||
	float64 childListShown = 0.;
 | 
					 | 
				
			||||||
	crl::time now = 0;
 | 
						crl::time now = 0;
 | 
				
			||||||
	int width = 0;
 | 
						int width = 0;
 | 
				
			||||||
	bool active = false;
 | 
						bool active = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue