Add WindowSelectionWidget

Refreshes list of windows when widget becomes visible to support widget
caching
This commit is contained in:
WarmUpTill
2025-05-21 13:05:31 +02:00
committed by WarmUpTill
parent c43439ee64
commit c281c6db83
7 changed files with 50 additions and 15 deletions

View File

@@ -0,0 +1,25 @@
#include "window-selection.hpp"
#include "selection-helpers.hpp"
namespace advss {
WindowSelectionWidget::WindowSelectionWidget(QWidget *parent)
: FilterComboBox(parent)
{
setEditable(true);
SetAllowUnmatchedSelection(true);
setMaxVisibleItems(20);
PopulateWindowSelection(this);
}
void WindowSelectionWidget::showEvent(QShowEvent *event)
{
FilterComboBox::showEvent(event);
const QSignalBlocker b(this);
const auto text = currentText();
clear();
PopulateWindowSelection(this);
setCurrentText(text);
}
} // namespace advss