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