mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 17:43:23 -08:00
[Settings][Dialog] Implement search for settings by text, description, tooltip, etc. (#7065)
* [Settings] Implement search Took 38 minutes Took 8 seconds Took 9 minutes Took 5 seconds Took 44 seconds Took 25 seconds * Comments Took 23 minutes Took 15 seconds * Comments Took 1 hour 14 minutes * Minor fixes to search Took 13 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
ba203440af
commit
bf6b2a90bc
13 changed files with 1069 additions and 103 deletions
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* @file settings_search_delegate.h
|
||||
* @brief Custom delegate for rendering settings search results
|
||||
* @ingroup Dialogs
|
||||
*/
|
||||
#ifndef COCKATRICE_SETTINGS_SEARCH_DELEGATE_H
|
||||
#define COCKATRICE_SETTINGS_SEARCH_DELEGATE_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
/**
|
||||
* @brief Custom paint delegate for settings search result items
|
||||
*
|
||||
* Renders each search result with a breadcrumb line ("Page > Group"),
|
||||
* the setting label, and a subtle separator. Supports selected/hovered states.
|
||||
*/
|
||||
class SettingsSearchDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsSearchDelegate(QObject *parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
/** @brief Sets the translated page names for breadcrumb display */
|
||||
void setPageNames(const QStringList &names);
|
||||
|
||||
/** @brief Sets the icons shown in front of results, indexed by page position */
|
||||
void setPageIcons(const QStringList &iconResources);
|
||||
|
||||
private:
|
||||
QStringList pageNames; ///< Translated page names indexed by page position
|
||||
QList<QPixmap> pageIcons; ///< Icons of the related settings pages
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_SETTINGS_SEARCH_DELEGATE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue