Now that the Qt4 support was dropped, we can use the new connection syntax supported by Qt5. It provides compile-time checking of the validity of the connection. Previously, the connection between signals and slots were checked only run-time. Commit d85de3399f97 ("kconfig: qconf: fix signal connection to invalid slots") fixed wrong slots. This change makes it possible to catch such mistakes easily.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -310,15 +310,16 @@ ConfigList::ConfigList(QWidget *parent, const char *name) · 309 unmodified lines | ||
| 310 | 310 | |
| 311 | 311 | setHeaderLabels(QStringList() << "Option" << "Name" << "Value"); |
| 312 | 312 | |
| 313 | − connect(this, SIGNAL(itemSelectionChanged(void)), | |
| 314 | − SLOT(updateSelection(void))); | |
| 313 | + connect(this, &ConfigList::itemSelectionChanged, | |
| 314 | + this, &ConfigList::updateSelection); | |
| 315 | 315 | |
| 316 | 316 | if (name) { |
| 317 | 317 | configSettings->beginGroup(name); |
| 318 | 318 | showName = configSettings->value("/showName", false).toBool(); |
| 319 | 319 | optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt(); |
| 320 | 320 | configSettings->endGroup(); |
| 321 | − connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | |
| 321 | + connect(configApp, &QApplication::aboutToQuit, | |
| 322 | + this, &ConfigList::saveSettings); | |
| 322 | 323 | } |
| 323 | 324 | |
| 324 | 325 | showColumn(promptColIdx); |
| @@ -888,10 +889,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) · 563 unmodified lines | ||
| 888 | 889 | headerPopup = new QMenu(this); |
| 889 | 890 | action = new QAction("Show Name", this); |
| 890 | 891 | action->setCheckable(true); |
| 891 | − connect(action, SIGNAL(toggled(bool)), | |
| 892 | − SLOT(setShowName(bool))); | |
| 893 | − connect(this, SIGNAL(showNameChanged(bool)), | |
| 894 | − action, SLOT(setChecked(bool))); | |
| 892 | + connect(action, &QAction::toggled, | |
| 893 | + this, &ConfigList::setShowName); | |
| 894 | + connect(this, &ConfigList::showNameChanged, | |
| 895 | + action, &QAction::setChecked); | |
| 895 | 896 | action->setChecked(showName); |
| 896 | 897 | headerPopup->addAction(action); |
| 897 | 898 | } |
| @@ -936,15 +937,18 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) · 38 unmodified lines | ||
| 936 | 937 | configSettings->beginGroup(objectName()); |
| 937 | 938 | setShowDebug(configSettings->value("/showDebug", false).toBool()); |
| 938 | 939 | configSettings->endGroup(); |
| 939 | − connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | |
| 940 | + connect(configApp, &QApplication::aboutToQuit, | |
| 941 | + this, &ConfigInfoView::saveSettings); | |
| 940 | 942 | } |
| 941 | 943 | |
| 942 | 944 | contextMenu = createStandardContextMenu(); |
| 943 | 945 | QAction *action = new QAction("Show Debug Info", contextMenu); |
| 944 | 946 | |
| 945 | 947 | action->setCheckable(true); |
| 946 | − connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | |
| 947 | − connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool))); | |
| 948 | + connect(action, &QAction::toggled, | |
| 949 | + this, &ConfigInfoView::setShowDebug); | |
| 950 | + connect(this, &ConfigInfoView::showDebugChanged, | |
| 951 | + action, &QAction::setChecked); | |
| 948 | 952 | action->setChecked(showDebug()); |
| 949 | 953 | contextMenu->addSeparator(); |
| 950 | 954 | contextMenu->addAction(action); |
| @@ -1231,11 +1235,13 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) · 280 unmodified lines | ||
| 1231 | 1235 | layout2->setSpacing(6); |
| 1232 | 1236 | layout2->addWidget(new QLabel("Find:", this)); |
| 1233 | 1237 | editField = new QLineEdit(this); |
| 1234 | − connect(editField, SIGNAL(returnPressed()), SLOT(search())); | |
| 1238 | + connect(editField, &QLineEdit::returnPressed, | |
| 1239 | + this, &ConfigSearchWindow::search); | |
| 1235 | 1240 | layout2->addWidget(editField); |
| 1236 | 1241 | searchButton = new QPushButton("Search", this); |
| 1237 | 1242 | searchButton->setAutoDefault(false); |
| 1238 | − connect(searchButton, SIGNAL(clicked()), SLOT(search())); | |
| 1243 | + connect(searchButton, &QPushButton::clicked, | |
| 1244 | + this, &ConfigSearchWindow::search); | |
| 1239 | 1245 | layout2->addWidget(searchButton); |
| 1240 | 1246 | layout1->addLayout(layout2); |
| 1241 | 1247 | |
| @@ -1244,10 +1250,10 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) · 2 unmodified lines | ||
| 1244 | 1250 | list = new ConfigList(split, "search"); |
| 1245 | 1251 | list->mode = listMode; |
| 1246 | 1252 | info = new ConfigInfoView(split, "search"); |
| 1247 | − connect(list, SIGNAL(menuChanged(struct menu *)), | |
| 1248 | − info, SLOT(setInfo(struct menu *))); | |
| 1249 | − connect(list, SIGNAL(menuChanged(struct menu *)), | |
| 1250 | − parent, SLOT(setMenuLink(struct menu *))); | |
| 1253 | + connect(list, &ConfigList::menuChanged, | |
| 1254 | + info, &ConfigInfoView::setInfo); | |
| 1255 | + connect(list, &ConfigList::menuChanged, | |
| 1256 | + parent, &ConfigMainWindow::setMenuLink); | |
| 1251 | 1257 | |
| 1252 | 1258 | layout1->addWidget(split); |
| 1253 | 1259 | |
| @@ -1267,7 +1273,8 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) · 13 unmodified lines | ||
| 1267 | 1273 | if (ok) |
| 1268 | 1274 | split->setSizes(sizes); |
| 1269 | 1275 | configSettings->endGroup(); |
| 1270 | − connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | |
| 1276 | + connect(configApp, &QApplication::aboutToQuit, | |
| 1277 | + this, &ConfigSearchWindow::saveSettings); | |
| 1271 | 1278 | } |
| 1272 | 1279 | |
| 1273 | 1280 | void ConfigSearchWindow::saveSettings(void) |
| @@ -1367,19 +1374,23 @@ ConfigMainWindow::ConfigMainWindow(void) · 93 unmodified lines | ||
| 1367 | 1374 | configList->setFocus(); |
| 1368 | 1375 | |
| 1369 | 1376 | backAction = new QAction(QPixmap(xpm_back), "Back", this); |
| 1370 | − connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); | |
| 1377 | + connect(backAction, &QAction::triggered, | |
| 1378 | + this, &ConfigMainWindow::goBack); | |
| 1371 | 1379 | |
| 1372 | 1380 | QAction *quitAction = new QAction("&Quit", this); |
| 1373 | 1381 | quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); |
| 1374 | − connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); | |
| 1382 | + connect(quitAction, &QAction::triggered, | |
| 1383 | + this, &ConfigMainWindow::close); | |
| 1375 | 1384 | |
| 1376 | 1385 | QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this); |
| 1377 | 1386 | loadAction->setShortcut(Qt::CTRL + Qt::Key_L); |
| 1378 | − connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); | |
| 1387 | + connect(loadAction, &QAction::triggered, | |
| 1388 | + this, &ConfigMainWindow::loadConfig); | |
| 1379 | 1389 | |
| 1380 | 1390 | saveAction = new QAction(QPixmap(xpm_save), "&Save", this); |
| 1381 | 1391 | saveAction->setShortcut(Qt::CTRL + Qt::Key_S); |
| 1382 | − connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); | |
| 1392 | + connect(saveAction, &QAction::triggered, | |
| 1393 | + this, &ConfigMainWindow::saveConfig); | |
| 1383 | 1394 | |
| 1384 | 1395 | conf_set_changed_callback(conf_changed); |
| 1385 | 1396 | |
| @@ -1388,31 +1399,37 @@ ConfigMainWindow::ConfigMainWindow(void) · 2 unmodified lines | ||
| 1388 | 1399 | configname = xstrdup(conf_get_configname()); |
| 1389 | 1400 | |
| 1390 | 1401 | QAction *saveAsAction = new QAction("Save &As...", this); |
| 1391 | − connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); | |
| 1402 | + connect(saveAsAction, &QAction::triggered, | |
| 1403 | + this, &ConfigMainWindow::saveConfigAs); | |
| 1392 | 1404 | QAction *searchAction = new QAction("&Find", this); |
| 1393 | 1405 | searchAction->setShortcut(Qt::CTRL + Qt::Key_F); |
| 1394 | − connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); | |
| 1406 | + connect(searchAction, &QAction::triggered, | |
| 1407 | + this, &ConfigMainWindow::searchConfig); | |
| 1395 | 1408 | singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this); |
| 1396 | 1409 | singleViewAction->setCheckable(true); |
| 1397 | − connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); | |
| 1410 | + connect(singleViewAction, &QAction::triggered, | |
| 1411 | + this, &ConfigMainWindow::showSingleView); | |
| 1398 | 1412 | splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this); |
| 1399 | 1413 | splitViewAction->setCheckable(true); |
| 1400 | − connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); | |
| 1414 | + connect(splitViewAction, &QAction::triggered, | |
| 1415 | + this, &ConfigMainWindow::showSplitView); | |
| 1401 | 1416 | fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this); |
| 1402 | 1417 | fullViewAction->setCheckable(true); |
| 1403 | − connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); | |
| 1418 | + connect(fullViewAction, &QAction::triggered, | |
| 1419 | + this, &ConfigMainWindow::showFullView); | |
| 1404 | 1420 | |
| 1405 | 1421 | QAction *showNameAction = new QAction("Show Name", this); |
| 1406 | 1422 | showNameAction->setCheckable(true); |
| 1407 | − connect(showNameAction, SIGNAL(toggled(bool)), configList, SLOT(setShowName(bool))); | |
| 1423 | + connect(showNameAction, &QAction::toggled, | |
| 1424 | + configList, &ConfigList::setShowName); | |
| 1408 | 1425 | showNameAction->setChecked(configList->showName); |
| 1409 | 1426 | |
| 1410 | 1427 | QActionGroup *optGroup = new QActionGroup(this); |
| 1411 | 1428 | optGroup->setExclusive(true); |
| 1412 | − connect(optGroup, SIGNAL(triggered(QAction*)), configList, | |
| 1413 | − SLOT(setOptionMode(QAction *))); | |
| 1414 | − connect(optGroup, SIGNAL(triggered(QAction *)), menuList, | |
| 1415 | − SLOT(setOptionMode(QAction *))); | |
| 1429 | + connect(optGroup, &QActionGroup::triggered, | |
| 1430 | + configList, &ConfigList::setOptionMode); | |
| 1431 | + connect(optGroup, &QActionGroup::triggered, | |
| 1432 | + menuList, &ConfigList::setOptionMode); | |
| 1416 | 1433 | |
| 1417 | 1434 | ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup); |
| 1418 | 1435 | ConfigList::showNormalAction->setCheckable(true); |
| @@ -1423,13 +1440,16 @@ ConfigMainWindow::ConfigMainWindow(void) · 4 unmodified lines | ||
| 1423 | 1440 | |
| 1424 | 1441 | QAction *showDebugAction = new QAction("Show Debug Info", this); |
| 1425 | 1442 | showDebugAction->setCheckable(true); |
| 1426 | − connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); | |
| 1443 | + connect(showDebugAction, &QAction::toggled, | |
| 1444 | + helpText, &ConfigInfoView::setShowDebug); | |
| 1427 | 1445 | showDebugAction->setChecked(helpText->showDebug()); |
| 1428 | 1446 | |
| 1429 | 1447 | QAction *showIntroAction = new QAction("Introduction", this); |
| 1430 | − connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); | |
| 1448 | + connect(showIntroAction, &QAction::triggered, | |
| 1449 | + this, &ConfigMainWindow::showIntro); | |
| 1431 | 1450 | QAction *showAboutAction = new QAction("About", this); |
| 1432 | − connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); | |
| 1451 | + connect(showAboutAction, &QAction::triggered, | |
| 1452 | + this, &ConfigMainWindow::showAbout); | |
| 1433 | 1453 | |
| 1434 | 1454 | // init tool bar |
| 1435 | 1455 | QToolBar *toolBar = addToolBar("Tools"); |
| @@ -1467,30 +1487,30 @@ ConfigMainWindow::ConfigMainWindow(void) · 31 unmodified lines | ||
| 1467 | 1487 | menu->addAction(showIntroAction); |
| 1468 | 1488 | menu->addAction(showAboutAction); |
| 1469 | 1489 | |
| 1470 | − connect (helpText, SIGNAL (anchorClicked (const QUrl &)), | |
| 1471 | − helpText, SLOT (clicked (const QUrl &)) ); | |
| 1472 | − | |
| 1473 | − connect(configList, SIGNAL(menuChanged(struct menu *)), | |
| 1474 | − helpText, SLOT(setInfo(struct menu *))); | |
| 1475 | − connect(configList, SIGNAL(menuSelected(struct menu *)), | |
| 1476 | − SLOT(changeMenu(struct menu *))); | |
| 1477 | − connect(configList, SIGNAL(itemSelected(struct menu *)), | |
| 1478 | − SLOT(changeItens(struct menu *))); | |
| 1479 | − connect(configList, SIGNAL(parentSelected()), | |
| 1480 | − SLOT(goBack())); | |
| 1481 | − connect(menuList, SIGNAL(menuChanged(struct menu *)), | |
| 1482 | − helpText, SLOT(setInfo(struct menu *))); | |
| 1483 | − connect(menuList, SIGNAL(menuSelected(struct menu *)), | |
| 1484 | − SLOT(changeMenu(struct menu *))); | |
| 1485 | − | |
| 1486 | − connect(configList, SIGNAL(gotFocus(struct menu *)), | |
| 1487 | − helpText, SLOT(setInfo(struct menu *))); | |
| 1488 | − connect(menuList, SIGNAL(gotFocus(struct menu *)), | |
| 1489 | − helpText, SLOT(setInfo(struct menu *))); | |
| 1490 | − connect(menuList, SIGNAL(gotFocus(struct menu *)), | |
| 1491 | − SLOT(listFocusChanged(void))); | |
| 1492 | − connect(helpText, SIGNAL(menuSelected(struct menu *)), | |
| 1493 | − SLOT(setMenuLink(struct menu *))); | |
| 1490 | + connect(helpText, &ConfigInfoView::anchorClicked, | |
| 1491 | + helpText, &ConfigInfoView::clicked); | |
| 1492 | + | |
| 1493 | + connect(configList, &ConfigList::menuChanged, | |
| 1494 | + helpText, &ConfigInfoView::setInfo); | |
| 1495 | + connect(configList, &ConfigList::menuSelected, | |
| 1496 | + this, &ConfigMainWindow::changeMenu); | |
| 1497 | + connect(configList, &ConfigList::itemSelected, | |
| 1498 | + this, &ConfigMainWindow::changeItens); | |
| 1499 | + connect(configList, &ConfigList::parentSelected, | |
| 1500 | + this, &ConfigMainWindow::goBack); | |
| 1501 | + connect(menuList, &ConfigList::menuChanged, | |
| 1502 | + helpText, &ConfigInfoView::setInfo); | |
| 1503 | + connect(menuList, &ConfigList::menuSelected, | |
| 1504 | + this, &ConfigMainWindow::changeMenu); | |
| 1505 | + | |
| 1506 | + connect(configList, &ConfigList::gotFocus, | |
| 1507 | + helpText, &ConfigInfoView::setInfo); | |
| 1508 | + connect(menuList, &ConfigList::gotFocus, | |
| 1509 | + helpText, &ConfigInfoView::setInfo); | |
| 1510 | + connect(menuList, &ConfigList::gotFocus, | |
| 1511 | + this, &ConfigMainWindow::listFocusChanged); | |
| 1512 | + connect(helpText, &ConfigInfoView::menuSelected, | |
| 1513 | + this, &ConfigMainWindow::setMenuLink); | |
| 1494 | 1514 | |
| 1495 | 1515 | QString listMode = configSettings->value("/listMode", "symbol").toString(); |
| 1496 | 1516 | if (listMode == "single") |