Skip to content

Commit 72b52b7

Browse files
committed
Fix Qt deprecations
1 parent becc09e commit 72b52b7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/mainwindow.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void MainWindow::load_config(QString filename) {
159159
QString key = words.takeFirst() + ' ' + words.takeFirst();
160160

161161
int val = 0;
162-
for (const auto &word : qAsConst(words)) {
162+
for (const auto &word : std::as_const(words)) {
163163
if (word == "post_clocksync") { val |= lsl::post_clocksync; }
164164
if (word == "post_dejitter") { val |= lsl::post_dejitter; }
165165
if (word == "post_monotonize") { val |= lsl::post_monotonize; }
@@ -341,7 +341,7 @@ std::vector<lsl::stream_info> MainWindow::refreshStreams() {
341341
// Then add knownStreams (only in list if resolved).
342342
const QBrush good_brush(QColor(0, 128, 0)), bad_brush(QColor(255, 0, 0));
343343
ui->streamList->clear();
344-
for (auto& m : qAsConst(missingStreams)) {
344+
for (auto& m : std::as_const(missingStreams)) {
345345
auto *item = new QListWidgetItem(m, ui->streamList);
346346
item->setCheckState(Qt::Checked);
347347
item->setForeground(bad_brush);
@@ -433,7 +433,7 @@ void MainWindow::startRecording() {
433433
}
434434

435435
std::vector<std::string> watchfor;
436-
for (const QString &missing : qAsConst(missingStreams)) {
436+
for (const QString &missing : std::as_const(missingStreams)) {
437437
std::string query;
438438
// Convert missing to query expected by lsl::resolve_stream
439439
// name='BioSemi' and hostname=AASDFSDF
@@ -595,13 +595,17 @@ QString MainWindow::find_config_file(const char *filename) {
595595
<< QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)
596596
<< QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)
597597
<< exeInfo.path();
598-
for (const auto &path : qAsConst(cfgpaths)) {
598+
for (const auto &path : std::as_const(cfgpaths)) {
599599
QString cfgfilepath = path + QDir::separator() + defaultCfgFilename;
600600
qInfo() << cfgfilepath;
601601
if (QFileInfo::exists(cfgfilepath)) return cfgfilepath;
602602
}
603-
QMessageBox::warning(this, "No config file not found",
604-
QStringLiteral("No default config file could be found"), "Continue with default config");
603+
QMessageBox msgBox;
604+
msgBox.setWindowTitle("Config file not found");
605+
msgBox.setText("Config file not found.");
606+
msgBox.setInformativeText("Continuing with default config.");
607+
msgBox.setStandardButtons(QMessageBox::Ok);
608+
msgBox.exec();
605609
return "";
606610
}
607611

0 commit comments

Comments
 (0)