Project

General

Profile

Bug #687 ยป 0068-Qt6x-Avoid-using-deprecated-QCheckBox-stateChanged.patch

Marko Lindqvist, 05/30/2024 05:16 PM

View differences:

client/gui-qt/chatline.cpp
connect(chat_output, &text_browser_dblclck::dbl_clicked,
this, &chatwdg::toggle_size);
connect(remove_links, &QAbstractButton::clicked, this, &chatwdg::rm_links);
connect(cb, &QCheckBox::stateChanged, this, &chatwdg::state_changed);
#ifdef FC_QT6X_MODE
#if QT_VERSION >= 0x060700
connect(cb, &QCheckBox::checkStateChanged, this, &chatwdg::state_changed);
#else // QT >= 6.7
connect(cb, &QCheckBox::stateChanged, this, &chatwdg::state_changed_depr);
#endif // QT >= 6.7
#else // FC_QT6X_MODE
connect(cb, &QCheckBox::stateChanged, this, &chatwdg::state_changed_depr);
#endif // FC_QT6X_MODE
setMouseTracking(true);
chat_listener::listen();
}
/***********************************************************************//**
Manages "To allies" chat button state
Manages "To allies" chat button state.
***************************************************************************/
void chatwdg::state_changed(Qt::CheckState state)
{
if (state != Qt::Unchecked) {
gui_options.gui_qt_allied_chat_only = true;
} else {
gui_options.gui_qt_allied_chat_only = false;
}
}
/***********************************************************************//**
Manages "To allies" chat button state.
This deprecated slot is used in Qt < 6.7
***************************************************************************/
void chatwdg::state_changed(int state)
void chatwdg::state_changed_depr(int state)
{
if (state > 0) {
gui_options.gui_qt_allied_chat_only = true;
client/gui-qt/chatline.h
void scroll_to_bottom();
void update_font();
private slots:
void state_changed(int state);
void state_changed(Qt::CheckState state);
void state_changed_depr(int state);
void rm_links();
void anchor_clicked(const QUrl &link);
void toggle_size();
client/gui-qt/citydlg.cpp
} else if (i == list_size - 2) {
cma_celeb_checkbox = new QCheckBox;
slider_grid->addWidget(cma_celeb_checkbox, i + 1, 2 , 1 , 1);
#ifdef FC_QT6X_MODE
#if QT_VERSION >= 0x060700
connect(cma_celeb_checkbox,
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed);
&QCheckBox::checkStateChanged, this, &city_dialog::cma_toggle_changed);
#else // QT >= 6.7
connect(cma_celeb_checkbox,
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed_depr);
#endif // QT >= 6.7
#else // FC_QT6X_MODE
connect(cma_celeb_checkbox,
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed_depr);
#endif // FC_QT6X_MODE
} else {
fc_assert(i == list_size - 1);
cma_max_growth = new QCheckBox;
slider_grid->addWidget(cma_max_growth, i + 1, 2 , 1 , 1);
#ifdef FC_QT6X_MODE
#if QT_VERSION >= 0x060700
connect(cma_max_growth,
&QCheckBox::checkStateChanged, this, &city_dialog::cma_toggle_changed);
#else // QT >= 6.7
connect(cma_max_growth,
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed_depr);
#endif // QT >= 6.7
#else // FC_QT6X_MODE
connect(cma_max_growth,
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed);
&QCheckBox::stateChanged, this, &city_dialog::cma_toggle_changed_depr);
#endif // FC_QT6X_MODE
}
if (i <= list_size - 2) {
......
}
/************************************************************************//**
CMA option 'celebrate' or 'max_growth' QCheckBox state has been changed
CMA option 'celebrate' or 'max_growth' QCheckBox state has been changed.
****************************************************************************/
void city_dialog::cma_toggle_changed(Qt::CheckState state)
{
if (cma_is_city_under_agent(dlgcity, nullptr)) {
cma_changed();
update_cma_tab();
}
}
/************************************************************************//**
CMA option 'celebrate' or 'max_growth' QCheckBox state has been changed.
This deprecated slot is used on Qt < 6.7.
****************************************************************************/
void city_dialog::cma_toggle_changed(int val)
void city_dialog::cma_toggle_changed_depr(int state)
{
if (cma_is_city_under_agent(dlgcity, nullptr)) {
cma_changed();
client/gui-qt/citydlg.h
void display_worklist_menu(const QPoint &p);
void disband_state_changed(bool allow_disband);
void cma_slider(int val);
void cma_toggle_changed(int val);
void cma_toggle_changed(Qt::CheckState state);
void cma_toggle_changed_depr(int state);
void cma_remove();
void cma_enable();
void cma_changed();
client/gui-qt/fc_client.h
void browse_saves();
void browse_scenarios();
void clear_status_bar();
void state_preview(int);
void state_preview(Qt::CheckState state);
void state_preview_depr(int state);
public slots:
void switch_page(int i);
client/gui-qt/gotodlg.cpp
connect(close_but, &QAbstractButton::clicked, this, &goto_dialog::close_dlg);
connect(goto_city, &QAbstractButton::clicked, this, &goto_dialog::go_to_city);
connect(airlift_city, &QAbstractButton::clicked, this, &goto_dialog::airlift_to);
connect(show_all, &QCheckBox::stateChanged,
#ifdef FC_QT6X_MODE
#if QT_VERSION >= 0x060700
connect(show_all, &QCheckBox::checkStateChanged,
this, &goto_dialog::checkbox_changed);
#else // QT >= 6.7
connect(show_all, &QCheckBox::stateChanged,
this, &goto_dialog::checkbox_changed_depr);
#endif // QT >= 6.7
#else // FC_QT6X_MODE
connect(show_all, &QCheckBox::stateChanged,
this, &goto_dialog::checkbox_changed_depr);
#endif // FC_QT6X_MODE
connect(goto_tab->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection &,
const QItemSelection &)),
......
/***********************************************************************//**
Slot for checkbox 'all nations'
***************************************************************************/
void goto_dialog::checkbox_changed(int state)
void goto_dialog::checkbox_changed(Qt::CheckState state)
{
update_dlg();
}
/***********************************************************************//**
Slot for checkbox 'all nations'
This deprecated slot is used in Qt < 6.7
***************************************************************************/
void goto_dialog::checkbox_changed_depr(int state)
{
update_dlg();
}
client/gui-qt/gotodlg.h
void go_to_city();
void airlift_to();
void item_selected(const QItemSelection &sl, const QItemSelection &ds);
void checkbox_changed(int state);
void checkbox_changed(Qt::CheckState state);
void checkbox_changed_depr(int state);
protected:
void paint(QPainter *painter, QPaintEvent *event);
void paintEvent(QPaintEvent *event);
client/gui-qt/pages.cpp
connect(saves_load->selectionModel(),
&QItemSelectionModel::selectionChanged, this,
&fc_client::slot_selection_changed);
connect(show_preview, &QCheckBox::stateChanged, this,
#ifdef FC_QT6X_MODE
#if QT_VERSION >= 0x060700
connect(show_preview, &QCheckBox::checkStateChanged, this,
&fc_client::state_preview);
#else // QT >= 6.7
connect(show_preview, &QCheckBox::stateChanged, this,
&fc_client::state_preview_depr);
#endif // QT >= 6.7
#else // FC_QT6X_MODE
connect(show_preview, &QCheckBox::stateChanged, this,
&fc_client::state_preview_depr);
#endif // FC_QT6X_MODE
pages_layout[PAGE_LOAD]->addWidget(wdg, 1, 0);
pages_layout[PAGE_LOAD]->addWidget(load_save_text, 2, 0, 1, 2);
pages_layout[PAGE_LOAD]->addWidget(load_pix, 2, 2, 1, 2);
......
}
/**********************************************************************//**
State of preview has been changed
State of preview has been changed.
**************************************************************************/
void fc_client::state_preview(Qt::CheckState state)
{
QItemSelection slctn;
if (show_preview->checkState() == Qt::Unchecked) {
gui_options.gui_qt_show_preview = false;
} else {
gui_options.gui_qt_show_preview = true;
}
slctn = saves_load->selectionModel()->selection();
saves_load->selectionModel()->clearSelection();
saves_load->selectionModel()->select(slctn, QItemSelectionModel::Rows
| QItemSelectionModel::SelectCurrent);
}
/**********************************************************************//**
State of preview has been changed.
This deprecated slot is used in Qt < 6.7
**************************************************************************/
void fc_client::state_preview(int new_state)
void fc_client::state_preview_depr(int new_state)
{
QItemSelection slctn;
    (1-1/1)