mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
Change buttons to be push rather than toggle.
Took 17 minutes Took 9 seconds
This commit is contained in:
parent
19db58b28f
commit
9bf2668f15
8 changed files with 25 additions and 29 deletions
|
|
@ -53,16 +53,15 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
|
|||
|
||||
// Create the toggle button for Exact Match/Includes mode
|
||||
toggleButton = new QPushButton(this);
|
||||
toggleButton->setCheckable(true);
|
||||
layout->addWidget(toggleButton);
|
||||
connect(toggleButton, &QPushButton::toggled, this,
|
||||
connect(toggleButton, &QPushButton::clicked, this,
|
||||
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode);
|
||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||
QTimer::singleShot(100, this, &VisualDatabaseDisplayFormatLegalityFilterWidget::syncWithFilterModel);
|
||||
});
|
||||
|
||||
createFormatButtons(); // Populate buttons initially
|
||||
updateFilterMode(false); // Initialize toggle button text
|
||||
createFormatButtons(); // Populate buttons initially
|
||||
updateFilterMode(); // Initialize toggle button text
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -177,9 +176,9 @@ void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFormatFilter()
|
|||
emit filterModel->layoutChanged();
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode(bool checked)
|
||||
void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode()
|
||||
{
|
||||
exactMatchMode = checked;
|
||||
exactMatchMode = !exactMatchMode;
|
||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||
updateFormatFilter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
void handleFormatToggled(const QString &format, bool active);
|
||||
void updateFormatFilter();
|
||||
void updateFilterMode(bool checked);
|
||||
void updateFilterMode();
|
||||
void syncWithFilterModel();
|
||||
|
||||
private:
|
||||
|
|
@ -40,7 +40,7 @@ private:
|
|||
QMap<QString, bool> activeFormats; // Track active filters
|
||||
QMap<QString, QPushButton *> formatButtons; // Store toggle buttons
|
||||
|
||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
||||
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_VISUAL_DATABASE_DISPLAY_FORMAT_LEGALITY_FILTER_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -49,15 +49,14 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
|
|||
|
||||
// Create the toggle button for Exact Match/Includes mode
|
||||
toggleButton = new QPushButton(this);
|
||||
toggleButton->setCheckable(true);
|
||||
layout->addWidget(toggleButton);
|
||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode);
|
||||
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode);
|
||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||
QTimer::singleShot(100, this, &VisualDatabaseDisplayMainTypeFilterWidget::syncWithFilterModel);
|
||||
});
|
||||
|
||||
createMainTypeButtons(); // Populate buttons initially
|
||||
updateFilterMode(false); // Initialize toggle button text
|
||||
updateFilterMode(); // Initialize toggle button text
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -172,9 +171,9 @@ void VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeFilter()
|
|||
emit filterModel->layoutChanged();
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode(bool checked)
|
||||
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode()
|
||||
{
|
||||
exactMatchMode = checked;
|
||||
exactMatchMode = !exactMatchMode;
|
||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||
updateMainTypeFilter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
void handleMainTypeToggled(const QString &mainType, bool active);
|
||||
void updateMainTypeFilter();
|
||||
void updateFilterMode(bool checked);
|
||||
void updateFilterMode();
|
||||
void syncWithFilterModel();
|
||||
|
||||
private:
|
||||
|
|
@ -45,7 +45,7 @@ private:
|
|||
QMap<QString, bool> activeMainTypes; // Track active filters
|
||||
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
||||
|
||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
||||
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||
};
|
||||
|
||||
#endif // VISUAL_DATABASE_DISPLAY_MAIN_TYPE_FILTER_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -70,9 +70,8 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
|||
|
||||
// Create the toggle button for Exact Match/Includes mode
|
||||
toggleButton = new QPushButton(this);
|
||||
toggleButton->setCheckable(true);
|
||||
layout->addWidget(toggleButton);
|
||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplaySetFilterWidget::updateFilterMode);
|
||||
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplaySetFilterWidget::updateFilterMode);
|
||||
connect(filterModel, &FilterTreeModel::layoutChanged, this,
|
||||
[this]() { QTimer::singleShot(100, this, &VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel); });
|
||||
|
||||
|
|
@ -264,9 +263,9 @@ void VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel()
|
|||
}
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplaySetFilterWidget::updateFilterMode(bool checked)
|
||||
void VisualDatabaseDisplaySetFilterWidget::updateFilterMode()
|
||||
{
|
||||
exactMatchMode = checked;
|
||||
exactMatchMode = !exactMatchMode;
|
||||
updateSetFilter();
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
void updateSetFilter();
|
||||
void syncWithFilterModel();
|
||||
void updateFilterMode(bool checked);
|
||||
void updateFilterMode();
|
||||
|
||||
private:
|
||||
FilterTreeModel *filterModel;
|
||||
|
|
@ -60,7 +60,7 @@ private:
|
|||
QMap<QString, QPushButton *> setButtons; // Store set filter buttons
|
||||
QMap<QString, bool> activeSets; // Track active set filters
|
||||
|
||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
||||
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||
};
|
||||
|
||||
#endif // VISUAL_DATABASE_DISPLAY_SET_FILTER_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -54,15 +54,14 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
|
|||
|
||||
// Toggle button setup (Exact Match / Includes mode)
|
||||
toggleButton = new QPushButton(this);
|
||||
toggleButton->setCheckable(true);
|
||||
layout->addWidget(toggleButton);
|
||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode);
|
||||
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode);
|
||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||
QTimer::singleShot(100, this, &VisualDatabaseDisplaySubTypeFilterWidget::syncWithFilterModel);
|
||||
});
|
||||
|
||||
createSubTypeButtons(); // Populate buttons initially
|
||||
updateFilterMode(false); // Initialize the toggle button text
|
||||
createSubTypeButtons(); // Populate buttons initially
|
||||
updateFilterMode(); // Initialize the toggle button text
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -180,9 +179,9 @@ void VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeFilter()
|
|||
emit filterModel->layoutChanged();
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode(bool checked)
|
||||
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode()
|
||||
{
|
||||
exactMatchMode = checked;
|
||||
exactMatchMode = !exactMatchMode;
|
||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||
updateSubTypeFilter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
void handleSubTypeToggled(const QString &mainType, bool active);
|
||||
void updateSubTypeFilter();
|
||||
void updateFilterMode(bool checked);
|
||||
void updateFilterMode();
|
||||
void syncWithFilterModel();
|
||||
|
||||
private:
|
||||
|
|
@ -45,7 +45,7 @@ private:
|
|||
QMap<QString, bool> activeSubTypes; // Track active filters
|
||||
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
||||
|
||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
||||
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||
};
|
||||
|
||||
#endif // VISUAL_DATABASE_DISPLAY_SUB_TYPE_FILTER_WIDGET_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue