Debug messages.

This commit is contained in:
Lukas Brübach 2025-06-13 01:57:58 +02:00
parent 6c60fc482b
commit d6f3f876c3
5 changed files with 35 additions and 3 deletions

View file

@ -27,7 +27,12 @@ CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
banner = new BannerWidget(this, cardGroupCategory, Qt::Orientation::Vertical, bannerOpacity);
layout->addWidget(banner);
CardGroupDisplayWidget::updateCardDisplays();
qInfo() << "Tracked index (default CardGroupDisplayWidget): " << cardGroupCategory << " (" << zoneName << ")"
<< "_trackedIndex.isValid()=" << _trackedIndex.isValid()
<< "row=" << _trackedIndex.row()
<< "column=" << _trackedIndex.column()
<< "parent(row)=" << _trackedIndex.parent().row()
<< "parent(column)=" << _trackedIndex.parent().column();
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
@ -58,7 +63,7 @@ QWidget* CardGroupDisplayWidget::constructWidgetForIndex(int rowIndex)
void CardGroupDisplayWidget::updateCardDisplays()
{
qInfo() << "Constructing Card Display Widgets for Card Group Display widget";
qInfo() << "Constructing Card Display Widgets for Card Group Display widget for zone: " << cardGroupCategory;
qInfo() << deckListModel->data(trackedIndex.sibling(trackedIndex.row(), 1), Qt::EditRole).toString() << " has "
<< deckListModel->rowCount(trackedIndex.sibling(trackedIndex.row(), 0)) << " entries.";
for (int i = 0; i < deckListModel->rowCount(trackedIndex); ++i) {
@ -69,6 +74,13 @@ void CardGroupDisplayWidget::updateCardDisplays()
void CardGroupDisplayWidget::onCardAddition(const QModelIndex &parent, int first, int last)
{
if (parent == trackedIndex) {
qInfo() << "Tracked index (default CardGroupDisplayWidget): " << cardGroupCategory << " (" << zoneName << ")"
<< "_trackedIndex.isValid()=" << trackedIndex.isValid()
<< "row=" << trackedIndex.row()
<< "column=" << trackedIndex.column()
<< "parent(row)=" << trackedIndex.parent().row()
<< "parent(column)=" << trackedIndex.parent().column();
qInfo() << "Card addition to " << cardGroupCategory;
for (int i = first; i <= last; i++) {
insertIntoLayout(constructWidgetForIndex(i), i);
}
@ -81,6 +93,7 @@ void CardGroupDisplayWidget::onCardRemoval(const QModelIndex &parent, int first,
Q_UNUSED(first);
Q_UNUSED(last);
if (parent == trackedIndex) {
qInfo() << "Card removal from " << cardGroupCategory;
for (const QPersistentModelIndex &idx : indexToWidgetMap.keys()) {
if (!idx.isValid()) {
removeFromLayout(indexToWidgetMap.value(idx));

View file

@ -31,6 +31,7 @@ FlatCardGroupDisplayWidget::FlatCardGroupDisplayWidget(QWidget *parent,
banner->setBuddy(flowWidget);
layout->addWidget(flowWidget);
qInfo() << "Initialized a flat CardGroupDisplayWidget";
FlatCardGroupDisplayWidget::updateCardDisplays();
// connect(deckListModel, &DeckListModel::dataChanged, this, &FlatCardGroupDisplayWidget::updateCardDisplays);
}

View file

@ -30,6 +30,7 @@ OverlappedCardGroupDisplayWidget::OverlappedCardGroupDisplayWidget(QWidget *pare
banner->setBuddy(overlapWidget);
layout->addWidget(overlapWidget);
qInfo() << "Initialized an overlap CardGroupDisplayWidget";
OverlappedCardGroupDisplayWidget::updateCardDisplays();
connect(cardSizeWidget->getSlider(), &QSlider::valueChanged, this,

View file

@ -39,12 +39,27 @@ DeckCardZoneDisplayWidget::DeckCardZoneDisplayWidget(QWidget *parent,
// connect(deckListModel, &DeckListModel::dataChanged, this, &DeckCardZoneDisplayWidget::decklistDataChanged);
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &DeckCardZoneDisplayWidget::onCategoryAddition);
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &DeckCardZoneDisplayWidget::onCategoryRemoval);
qInfo() << "Tracked index:" << zoneName << "_trackedIndex.isValid()=" << _trackedIndex.isValid()
<< "row=" << _trackedIndex.row() << "column=" << _trackedIndex.column()
<< "parent(row)=" << _trackedIndex.parent().row() << "parent(column)=" << _trackedIndex.parent().column()
<< "parent(valid)=" << _trackedIndex.parent().isValid();
}
qInfo() << "Cleaning up invalid card group " << displayWidget->cardGroupCategory << " from " << displayWidget->zoneName;
qInfo() << "Cleaned.";
qInfo() << categoryName << " is already contained in the index to widget map";
qInfo() << categoryName << " needs a widget";
qInfo() << "It's getting an overlap widget.";
qInfo() << "Getting a flat widget for christmas";
qInfo() << "Constructing Group Display Widgets for Zone Display widget";
qInfo() << deckListModel->data(trackedIndex.sibling(trackedIndex.row(), 1), Qt::EditRole).toString() << " has "
<< deckListModel->rowCount(trackedIndex.sibling(trackedIndex.row(), 0)) << " entries.";
void DeckCardZoneDisplayWidget::onCategoryAddition(const QModelIndex &parent, int first, int last)
{
if (parent == trackedIndex) {
qInfo() << deckListModel->data(trackedIndex.sibling(trackedIndex.row(), 1), Qt::EditRole).toString() << " zone thinks it has a new category";
qInfo() << deckListModel->data(trackedIndex.sibling(trackedIndex.row(), 1), Qt::EditRole).toString()
<< " zone thinks it has a new category";
for (int i = first; i <= last; i++) {
QPersistentModelIndex index = QPersistentModelIndex(deckListModel->index(i, 0, trackedIndex));

View file

@ -198,6 +198,8 @@ void VisualDeckEditorWidget::retranslateUi()
displayTypeButton->setToolTip(
tr("Change how cards are displayed within zones (i.e. overlapped or fully visible.)"));
}
qInfo() << "Cleaning up invalid card zone " << displayWidget->zoneName;
qInfo() << "Cleaned.";
void VisualDeckEditorWidget::onCardAddition(const QModelIndex &parent, int first, int last)
{