mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
FlowWidget debugging.
This commit is contained in:
parent
a8b7fb91e4
commit
14229666e3
8 changed files with 35 additions and 15 deletions
|
|
@ -11,11 +11,13 @@ EdhrecCommanderApiResponseCardListDisplayWidget::EdhrecCommanderApiResponseCardL
|
|||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setMinimumSize(0, 0);
|
||||
|
||||
auto header = new QLabel(this);
|
||||
header->setText(toDisplay.header);
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
||||
flowWidget = new FlowWidget(this, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
|
||||
foreach (EdhrecCommanderApiResponseCardDetails card_detail, toDisplay.cardViews) {
|
||||
auto widget = new EdhrecCommanderApiResponseCardDetailsDisplayWidget(flowWidget, card_detail);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ EdhrecCommanderResponseCommanderDetailsDisplayWidget::EdhrecCommanderResponseCom
|
|||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
setMinimumWidth(0);
|
||||
|
||||
auto commanderPicture = new CardInfoPictureWidget(this);
|
||||
commanderPicture->setCard(CardDatabaseManager::getInstance()->getCard(commanderDetails.getName()));
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "api_response/edhrec_commander_api_response.h"
|
||||
#include "edhrec_commander_api_response_card_list_display_widget.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
|
||||
EdhrecCommanderApiResponseDisplayWidget::EdhrecCommanderApiResponseDisplayWidget(QWidget *parent,
|
||||
EdhrecCommanderApiResponse response)
|
||||
: QWidget(parent)
|
||||
|
|
@ -12,14 +14,24 @@ EdhrecCommanderApiResponseDisplayWidget::EdhrecCommanderApiResponseDisplayWidget
|
|||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
setMinimumSize(QSize(0, 0));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
auto commanderPicture = new CardInfoPictureWidget(this);
|
||||
commanderPicture->setCard(
|
||||
CardDatabaseManager::getInstance()->getCard(response.container.getCommanderDetails().getName()));
|
||||
layout->addWidget(commanderPicture);
|
||||
layout->addWidget(commanderPicture, 0, Qt::AlignHCenter);
|
||||
|
||||
auto edhrec_commander_api_response_card_lists = response.container.getCardlists();
|
||||
foreach (EdhrecCommanderApiResponseCardList card_list, edhrec_commander_api_response_card_lists) {
|
||||
auto cardListDisplayWidget = new EdhrecCommanderApiResponseCardListDisplayWidget(this, card_list);
|
||||
layout->addWidget(cardListDisplayWidget);
|
||||
layout->addWidget(cardListDisplayWidget, 0, Qt::AlignHCenter);
|
||||
}
|
||||
}
|
||||
|
||||
void EdhrecCommanderApiResponseDisplayWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
qDebug() << event->size();
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ class EdhrecCommanderApiResponseDisplayWidget : public QWidget
|
|||
|
||||
public:
|
||||
explicit EdhrecCommanderApiResponseDisplayWidget(QWidget *parent, EdhrecCommanderApiResponse response);
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,11 @@
|
|||
TabEdhRec::TabEdhRec(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
|
||||
{
|
||||
setMinimumSize(0, 0);
|
||||
container = new QWidget(this);
|
||||
layout = new QHBoxLayout(this);
|
||||
container->setLayout(layout);
|
||||
setCentralWidget(container);
|
||||
flowWidget = new FlowWidget(container, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
layout->addWidget(flowWidget);
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
setCentralWidget(flowWidget);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
networkManager->setTransferTimeout(); // Use Qt's default timeout
|
||||
#endif
|
||||
|
|
@ -77,8 +74,8 @@ void TabEdhRec::processApiJson(QNetworkReply *reply)
|
|||
EdhrecCommanderApiResponse deckData;
|
||||
deckData.fromJson(jsonObj);
|
||||
|
||||
auto widget = new EdhrecCommanderApiResponseDisplayWidget(this, deckData);
|
||||
flowWidget->addWidget(widget);
|
||||
displayWidget = new EdhrecCommanderApiResponseDisplayWidget(flowWidget, deckData);
|
||||
flowWidget->addWidget(displayWidget);
|
||||
|
||||
reply->deleteLater();
|
||||
update();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../../../game/cards/card_database.h"
|
||||
#include "../../../ui/widgets/general/layout_containers/flow_widget.h"
|
||||
#include "../../tab.h"
|
||||
#include "edhrec_commander_api_response_display_widget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QNetworkAccessManager>
|
||||
|
|
@ -29,10 +30,9 @@ public slots:
|
|||
void setCard(CardInfoPtr _cardToQuery);
|
||||
|
||||
private:
|
||||
QWidget *container;
|
||||
FlowWidget *flowWidget;
|
||||
QHBoxLayout *layout;
|
||||
CardInfoPtr cardToQuery;
|
||||
EdhrecCommanderApiResponseDisplayWidget *displayWidget;
|
||||
};
|
||||
|
||||
#endif // TAB_EDHREC_H
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@
|
|||
#include <QLoggingCategory>
|
||||
#include <QWidget>
|
||||
#include <qscrollarea.h>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
|
||||
inline Q_LOGGING_CATEGORY(FlowWidgetLog, "flow_widget");
|
||||
inline Q_LOGGING_CATEGORY(FlowWidgetSizeLog, "flow_widget.size");
|
||||
|
||||
inline Q_LOGGING_CATEGORY(FlowWidgetLog, "flow_widget");
|
||||
inline Q_LOGGING_CATEGORY(FlowWidgetSizeLog, "flow_widget.size");
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void ShortcutTreeView::updateSearchString(const QString &searchString)
|
|||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
const auto skipEmptyParts = Qt::SkipEmptyParts;
|
||||
#else
|
||||
const auto skipEmptyParts = QString::SkipEmptyParts;
|
||||
const auto skipEmptyParts = Qt::SkipEmptyParts;
|
||||
#endif
|
||||
QStringList searchWords = searchString.split(" ", skipEmptyParts);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue