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