mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 04:28:49 +03:00
Adjust completion menu to fit its contents
This commit is contained in:
parent
649d73a7bd
commit
4fd8eccece
5 changed files with 25 additions and 0 deletions
|
@ -64,6 +64,9 @@ public slots:
|
|||
//! Set hovering to the item in the given layout position.
|
||||
void setHovering(int pos);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void itemSelected(const QString &user);
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ QuickSwitcher {
|
|||
background-color: #202228;
|
||||
}
|
||||
|
||||
SuggestionsPopup {
|
||||
background-color: #202228;
|
||||
}
|
||||
|
||||
PopupItem {
|
||||
background-color: #202228;
|
||||
qproperty-hoverColor: rgba(45, 49, 57, 120);
|
||||
|
|
|
@ -22,6 +22,10 @@ QuickSwitcher {
|
|||
background-color: white;
|
||||
}
|
||||
|
||||
SuggestionsPopup {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
PopupItem {
|
||||
background-color: white;
|
||||
qproperty-hoverColor: rgba(192, 193, 195, 120);
|
||||
|
|
|
@ -25,6 +25,10 @@ QuickSwitcher {
|
|||
background-color: palette(window);
|
||||
}
|
||||
|
||||
SuggestionsPopup {
|
||||
background-color: palette(window);
|
||||
}
|
||||
|
||||
PopupItem {
|
||||
background-color: palette(window);
|
||||
qproperty-hoverColor: rgba(192, 193, 195, 120);
|
||||
|
|
|
@ -106,6 +106,7 @@ SuggestionsPopup::addUsers(const QVector<SearchResult> &users)
|
|||
}
|
||||
|
||||
resetSelection();
|
||||
adjustSize();
|
||||
|
||||
resize(geometry().width(), 40 * users.size());
|
||||
}
|
||||
|
@ -171,3 +172,12 @@ SuggestionsPopup::selectHoveredSuggestion()
|
|||
|
||||
resetSelection();
|
||||
}
|
||||
|
||||
void
|
||||
SuggestionsPopup::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue