mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -07:00
add search bar to ZoneViewWidget
This commit is contained in:
parent
dd37823a5d
commit
caae0c8e10
3 changed files with 21 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
||||||
{
|
{
|
||||||
setBackgroundBrush(QBrush(QColor(0, 0, 0)));
|
setBackgroundBrush(QBrush(QColor(0, 0, 0)));
|
||||||
setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
|
setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
setViewportUpdateMode(BoundingRectViewportUpdate);
|
setViewportUpdateMode(BoundingRectViewportUpdate);
|
||||||
|
|
||||||
connect(scene, &GameScene::sceneRectChanged, this, &GameView::updateSceneRect);
|
connect(scene, &GameScene::sceneRectChanged, this, &GameView::updateSceneRect);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#include "view_zone_widget.h"
|
#include "view_zone_widget.h"
|
||||||
|
|
||||||
|
#include "../../client/ui/pixel_map_generator.h"
|
||||||
#include "../../settings/cache_settings.h"
|
#include "../../settings/cache_settings.h"
|
||||||
#include "../cards/card_item.h"
|
#include "../cards/card_item.h"
|
||||||
|
#include "../filters/syntax_help.h"
|
||||||
#include "../game_scene.h"
|
#include "../game_scene.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
#include "pb/command_shuffle.pb.h"
|
#include "pb/command_shuffle.pb.h"
|
||||||
|
|
@ -41,9 +43,24 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
||||||
setFlag(ItemIgnoresTransformations);
|
setFlag(ItemIgnoresTransformations);
|
||||||
|
|
||||||
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
|
QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical);
|
||||||
|
vbox->setSpacing(2);
|
||||||
|
|
||||||
// If the number is < 0, then it means that we can give the option to make the area sorted
|
// If the number is < 0, then it means that we can give the option to make the area sorted
|
||||||
if (numberCards < 0) {
|
if (numberCards < 0) {
|
||||||
|
// search edit
|
||||||
|
searchEdit.setFocusPolicy(Qt::ClickFocus);
|
||||||
|
searchEdit.setPlaceholderText(tr("Search by card name (or search expressions)"));
|
||||||
|
searchEdit.setClearButtonEnabled(true);
|
||||||
|
searchEdit.addAction(loadColorAdjustedPixmap("theme:icons/search"), QLineEdit::LeadingPosition);
|
||||||
|
auto help = searchEdit.addAction(QPixmap("theme:icons/info"), QLineEdit::TrailingPosition);
|
||||||
|
|
||||||
|
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
|
||||||
|
|
||||||
|
QGraphicsProxyWidget *searchEditProxy = new QGraphicsProxyWidget;
|
||||||
|
searchEditProxy->setWidget(&searchEdit);
|
||||||
|
searchEditProxy->setZValue(2000000007);
|
||||||
|
vbox->addItem(searchEditProxy);
|
||||||
|
|
||||||
// top row
|
// top row
|
||||||
QGraphicsLinearLayout *hTopRow = new QGraphicsLinearLayout(Qt::Horizontal);
|
QGraphicsLinearLayout *hTopRow = new QGraphicsLinearLayout(Qt::Horizontal);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QGraphicsProxyWidget>
|
#include <QGraphicsProxyWidget>
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
@ -47,6 +48,8 @@ private:
|
||||||
QPushButton *closeButton;
|
QPushButton *closeButton;
|
||||||
QScrollBar *scrollBar;
|
QScrollBar *scrollBar;
|
||||||
ScrollableGraphicsProxyWidget *scrollBarProxy;
|
ScrollableGraphicsProxyWidget *scrollBarProxy;
|
||||||
|
|
||||||
|
QLineEdit searchEdit;
|
||||||
QComboBox groupBySelector;
|
QComboBox groupBySelector;
|
||||||
QComboBox sortBySelector;
|
QComboBox sortBySelector;
|
||||||
QCheckBox shuffleCheckBox;
|
QCheckBox shuffleCheckBox;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue