mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Change button style.
Took 24 minutes Took 4 seconds
This commit is contained in:
parent
f21d61237a
commit
fe9f4f6803
6 changed files with 31 additions and 71 deletions
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef COCKATRICE_VISUAL_DATABASE_DISPLAY_FILTER_BUTTON_H
|
||||
#define COCKATRICE_VISUAL_DATABASE_DISPLAY_FILTER_BUTTON_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
const QString visualDatabaseDisplayFilterButtonStyle = QString(R"(
|
||||
QPushButton {
|
||||
background-color: palette(button);
|
||||
color: palette(button-text);
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid palette(dark);
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: palette(highlight);
|
||||
color: palette(highlighted-text);
|
||||
border: 1px solid palette(shadow);
|
||||
}
|
||||
)");
|
||||
|
||||
#endif // COCKATRICE_VISUAL_DATABASE_DISPLAY_FILTER_BUTTON_H
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#include "visual_database_display_format_legality_filter_widget.h"
|
||||
|
||||
#include "../../../filters/filter_tree_model.h"
|
||||
#include "visual_database_display_filter_button.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
|
@ -80,21 +81,7 @@ void VisualDatabaseDisplayFormatLegalityFilterWidget::createFormatButtons()
|
|||
for (auto it = allFormatsWithCount.begin(); it != allFormatsWithCount.end(); ++it) {
|
||||
auto *button = new QPushButton(it.key(), flowWidget);
|
||||
button->setCheckable(true);
|
||||
QPalette pal = button->palette();
|
||||
QString base = pal.button().color().name();
|
||||
QString highlight = pal.highlight().color().name();
|
||||
|
||||
button->setStyleSheet(QString(R"(
|
||||
QPushButton {
|
||||
background-color: %1;
|
||||
padding: 5px;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: %2;
|
||||
color: white;
|
||||
}
|
||||
)")
|
||||
.arg(base, highlight));
|
||||
button->setStyleSheet(visualDatabaseDisplayFilterButtonStyle);
|
||||
|
||||
flowWidget->addWidget(button);
|
||||
formatButtons[it.key()] = button;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "visual_database_display_main_type_filter_widget.h"
|
||||
|
||||
#include "../../../filters/filter_tree_model.h"
|
||||
#include "visual_database_display_filter_button.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
|
@ -75,21 +76,8 @@ void VisualDatabaseDisplayMainTypeFilterWidget::createMainTypeButtons()
|
|||
for (auto it = allMainCardTypesWithCount.begin(); it != allMainCardTypesWithCount.end(); ++it) {
|
||||
auto *button = new QPushButton(it.key(), flowWidget);
|
||||
button->setCheckable(true);
|
||||
QPalette pal = button->palette();
|
||||
QString base = pal.button().color().name();
|
||||
QString highlight = pal.highlight().color().name();
|
||||
|
||||
button->setStyleSheet(QString(R"(
|
||||
QPushButton {
|
||||
background-color: %1;
|
||||
padding: 5px;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: %2;
|
||||
color: white;
|
||||
}
|
||||
)")
|
||||
.arg(base, highlight));
|
||||
button->setStyleSheet(visualDatabaseDisplayFilterButtonStyle);
|
||||
|
||||
flowWidget->addWidget(button);
|
||||
typeButtons[it.key()] = button;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h"
|
||||
#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h"
|
||||
#include "../deck_editor/deck_state_manager.h"
|
||||
#include "visual_database_display_filter_button.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
||||
|
|
@ -95,21 +96,8 @@ void VisualDatabaseDisplayNameFilterWidget::createNameFilter(const QString &name
|
|||
|
||||
// Create a button for the filter
|
||||
auto *button = new QPushButton(name, flowWidget);
|
||||
QPalette pal = button->palette();
|
||||
QString base = pal.button().color().name();
|
||||
QString highlight = pal.highlight().color().name();
|
||||
|
||||
button->setStyleSheet(QString(R"(
|
||||
QPushButton {
|
||||
background-color: %1;
|
||||
padding: 5px;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: %2;
|
||||
color: white;
|
||||
}
|
||||
)")
|
||||
.arg(base, highlight));
|
||||
button->setStyleSheet(visualDatabaseDisplayFilterButtonStyle);
|
||||
|
||||
connect(button, &QPushButton::clicked, this, [this, name]() {
|
||||
removeNameFilter(name);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../filters/filter_tree_model.h"
|
||||
#include "visual_database_display_filter_button.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
|
@ -101,21 +102,8 @@ void VisualDatabaseDisplaySetFilterWidget::createSetButtons()
|
|||
|
||||
auto *button = new QPushButton(longName + " (" + shortName + ")", flowWidget);
|
||||
button->setCheckable(true);
|
||||
QPalette pal = button->palette();
|
||||
QString base = pal.button().color().name();
|
||||
QString highlight = pal.highlight().color().name();
|
||||
|
||||
button->setStyleSheet(QString(R"(
|
||||
QPushButton {
|
||||
background-color: %1;
|
||||
padding: 5px;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: %2;
|
||||
color: white;
|
||||
}
|
||||
)")
|
||||
.arg(base, highlight));
|
||||
button->setStyleSheet(visualDatabaseDisplayFilterButtonStyle);
|
||||
|
||||
flowWidget->addWidget(button);
|
||||
setButtons[shortName] = button;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "visual_database_display_sub_type_filter_widget.h"
|
||||
|
||||
#include "../../../filters/filter_tree_model.h"
|
||||
#include "visual_database_display_filter_button.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
|
|
@ -80,21 +81,8 @@ void VisualDatabaseDisplaySubTypeFilterWidget::createSubTypeButtons()
|
|||
for (auto it = allSubCardTypesWithCount.begin(); it != allSubCardTypesWithCount.end(); ++it) {
|
||||
auto *button = new QPushButton(it.key(), flowWidget);
|
||||
button->setCheckable(true);
|
||||
QPalette pal = button->palette();
|
||||
QString base = pal.button().color().name();
|
||||
QString highlight = pal.highlight().color().name();
|
||||
|
||||
button->setStyleSheet(QString(R"(
|
||||
QPushButton {
|
||||
background-color: %1;
|
||||
padding: 5px;
|
||||
}
|
||||
QPushButton:checked {
|
||||
background-color: %2;
|
||||
color: white;
|
||||
}
|
||||
)")
|
||||
.arg(base, highlight));
|
||||
button->setStyleSheet(visualDatabaseDisplayFilterButtonStyle);
|
||||
|
||||
flowWidget->addWidget(button);
|
||||
typeButtons[it.key()] = button;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue