diff --git a/include/mainwindow.h b/include/mainwindow.h index bd88cb3a..88439457 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -194,7 +194,7 @@ private slots: void on_actionExport_Stitched_Map_Image_triggered(); void on_actionExport_Map_Timelapse_Image_triggered(); - void on_comboBox_ConnectionDirection_currentIndexChanged(const QString &arg1); + void on_comboBox_ConnectionDirection_currentTextChanged(const QString &arg1); void on_spinBox_ConnectionOffset_valueChanged(int offset); void on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName); void on_pushButton_AddConnection_clicked(); diff --git a/include/ui/regionmapeditor.h b/include/ui/regionmapeditor.h index cba14251..1dee23f7 100644 --- a/include/ui/regionmapeditor.h +++ b/include/ui/regionmapeditor.h @@ -118,8 +118,8 @@ private slots: void on_action_Import_CityMap_ImageTiles_triggered(); void on_tabWidget_Region_Map_currentChanged(int); void on_pushButton_RM_Options_delete_clicked(); - void on_comboBox_RM_ConnectedMap_activated(const QString &); - void on_comboBox_RM_Entry_MapSection_activated(const QString &); + void on_comboBox_RM_ConnectedMap_textActivated(const QString &); + void on_comboBox_RM_Entry_MapSection_textActivated(const QString &); void on_spinBox_RM_Entry_x_valueChanged(int); void on_spinBox_RM_Entry_y_valueChanged(int); void on_spinBox_RM_Entry_width_valueChanged(int); diff --git a/include/ui/shortcut.h b/include/ui/shortcut.h index 58980a3b..8989401d 100644 --- a/include/ui/shortcut.h +++ b/include/ui/shortcut.h @@ -2,6 +2,7 @@ #define SHORTCUT_H #include +#include #include #include diff --git a/include/ui/tileseteditor.h b/include/ui/tileseteditor.h index 1af92f35..a65cb75d 100644 --- a/include/ui/tileseteditor.h +++ b/include/ui/tileseteditor.h @@ -79,7 +79,7 @@ private slots: void on_actionRedo_triggered(); - void on_comboBox_metatileBehaviors_activated(const QString &arg1); + void on_comboBox_metatileBehaviors_textActivated(const QString &arg1); void on_lineEdit_metatileLabel_editingFinished(); diff --git a/src/config.cpp b/src/config.cpp index 1d0d55bf..35c1507f 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -37,7 +37,6 @@ void KeyValueConfigBase::load() { } QTextStream in(&file); - in.setCodec("UTF-8"); QList configLines; QRegularExpression re("^(?[^=]+)=(?.*)$"); while (!in.atEnd()) { diff --git a/src/core/parseutil.cpp b/src/core/parseutil.cpp index e45e8b10..79464b8b 100644 --- a/src/core/parseutil.cpp +++ b/src/core/parseutil.cpp @@ -34,7 +34,6 @@ QString ParseUtil::readTextFile(const QString &path) { return QString(); } QTextStream in(&file); - in.setCodec("UTF-8"); QString text = ""; while (!in.atEnd()) { text += in.readLine() + '\n'; @@ -65,9 +64,9 @@ QList ParseUtil::parseAsm(const QString &filename) { // There should not be anything else on the line. // gas will raise a syntax error if there is. } else { - int index = trimmedLine.indexOf(QRegExp("\\s+")); + int index = trimmedLine.indexOf(QRegularExpression("\\s+")); const QString macro = trimmedLine.left(index); - QStringList params(trimmedLine.right(trimmedLine.length() - index).trimmed().split(QRegExp("\\s*,\\s*"))); + QStringList params(trimmedLine.right(trimmedLine.length() - index).trimmed().split(QRegularExpression("\\s*,\\s*"))); params.prepend(macro); parsed.append(params); } @@ -227,15 +226,16 @@ QString ParseUtil::readCIncbin(const QString &filename, const QString &label) { text = readTextFile(root + "/" + filename); - QRegExp *re = new QRegExp(QString( + QRegularExpression re(QString( "\\b%1\\b" "\\s*\\[?\\s*\\]?\\s*=\\s*" "INCBIN_[US][0-9][0-9]?" "\\(\\s*\"([^\"]*)\"\\s*\\)").arg(label)); - int pos = re->indexIn(text); + QRegularExpressionMatch match; + qsizetype pos = text.indexOf(re, 0, &match); if (pos != -1) { - path = re->cap(1); + path = match.captured(1); } return path; diff --git a/src/core/regionmap.cpp b/src/core/regionmap.cpp index 7d3c8a7e..f8dbcac1 100644 --- a/src/core/regionmap.cpp +++ b/src/core/regionmap.cpp @@ -134,7 +134,6 @@ bool RegionMap::readLayout() { bool mapNamesQualified = false, mapEntriesQualified = false; QTextStream in(&file); - in.setCodec("UTF-8"); while (!in.atEnd()) { QString line = in.readLine(); if (line.contains(QRegularExpression(".*sMapName.*="))) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 94584ac1..52c987b8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -425,7 +425,7 @@ void MainWindow::on_lineEdit_filterBox_textChanged(const QString &arg1) void MainWindow::applyMapListFilter(QString filterText) { - mapListProxyModel->setFilterRegExp(QRegExp(filterText, Qt::CaseInsensitive, QRegExp::FixedString)); + mapListProxyModel->setFilterRegularExpression(QRegularExpression(filterText, QRegularExpression::CaseInsensitiveOption)); if (filterText.isEmpty()) { ui->mapList->collapseAll(); } else { @@ -629,7 +629,7 @@ bool MainWindow::setMap(QString map_name, bool scrollTreeView) { if (scrollTreeView) { // Make sure we clear the filter first so we actually have a scroll target - mapListProxyModel->setFilterRegExp(QString()); + mapListProxyModel->setFilterRegularExpression(QString()); ui->mapList->setCurrentIndex(mapListProxyModel->mapFromSource(mapListIndexes.value(map_name))); ui->mapList->scrollTo(ui->mapList->currentIndex(), QAbstractItemView::PositionAtCenter); } @@ -2694,7 +2694,7 @@ void MainWindow::showExportMapImageWindow(ImageExporterMode mode) { } } -void MainWindow::on_comboBox_ConnectionDirection_currentIndexChanged(const QString &direction) +void MainWindow::on_comboBox_ConnectionDirection_currentTextChanged(const QString &direction) { editor->updateCurrentConnectionDirection(direction); } diff --git a/src/project.cpp b/src/project.cpp index e754d5ac..860c1087 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -642,8 +642,8 @@ void Project::setNewMapLayout(Map* map) { layout->name = QString("%1_Layout").arg(map->name); layout->width = QString::number(getDefaultMapSize()); layout->height = QString::number(getDefaultMapSize()); - layout->border_width = DEFAULT_BORDER_WIDTH; - layout->border_height = DEFAULT_BORDER_HEIGHT; + layout->border_width = QString::number(DEFAULT_BORDER_WIDTH); + layout->border_height = QString::number(DEFAULT_BORDER_HEIGHT); layout->border_path = QString("data/layouts/%1/border.bin").arg(map->name); layout->blockdata_path = QString("data/layouts/%1/map.bin").arg(map->name); layout->tileset_primary_label = tilesetLabels["primary"].value(0, "gTileset_General"); @@ -1512,10 +1512,10 @@ void Project::loadTilesetAssets(Tileset* tileset) { QString path = tileset->palettePaths.value(i); QString text = parser.readTextFile(path); if (!text.isNull()) { - QStringList lines = text.split(QRegExp("[\r\n]"), Qt::SkipEmptyParts); + QStringList lines = text.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts); if (lines.length() == 19 && lines[0] == "JASC-PAL" && lines[1] == "0100" && lines[2] == "16") { for (int j = 0; j < 16; j++) { - QStringList rgb = lines[j + 3].split(QRegExp(" "), Qt::SkipEmptyParts); + QStringList rgb = lines[j + 3].split(QRegularExpression(" "), Qt::SkipEmptyParts); if (rgb.length() != 3) { logWarn(QString("Invalid tileset palette RGB value: '%1'").arg(lines[j + 3])); palette.append(qRgb((j - 3) * 16, (j - 3) * 16, (j - 3) * 16)); @@ -2327,13 +2327,13 @@ bool Project::readEventScriptLabels() { } QString Project::fixPalettePath(QString path) { - path = path.replace(QRegExp("\\.gbapal$"), ".pal"); + path = path.replace(QRegularExpression("\\.gbapal$"), ".pal"); return path; } QString Project::fixGraphicPath(QString path) { - path = path.replace(QRegExp("\\.lz$"), ""); - path = path.replace(QRegExp("\\.[1248]bpp$"), ".png"); + path = path.replace(QRegularExpression("\\.lz$"), ""); + path = path.replace(QRegularExpression("\\.[1248]bpp$"), ".png"); return path; } @@ -2445,7 +2445,7 @@ void Project::loadEventPixmaps(QList objects) { QString dimensions_label = gfx_info.value(11); QString subsprites_label = gfx_info.value(12); QString gfx_label = parser.readCArray("src/data/object_events/object_event_pic_tables.h", pic_label).value(0); - gfx_label = gfx_label.section(QRegExp("[\\(\\)]"), 1, 1); + gfx_label = gfx_label.section(QRegularExpression("[\\(\\)]"), 1, 1); QString path = parser.readCIncbin("src/data/object_events/object_event_graphics.h", gfx_label); if (!path.isNull()) { diff --git a/src/ui/customattributestable.cpp b/src/ui/customattributestable.cpp index b8c2de6c..6723ea0f 100644 --- a/src/ui/customattributestable.cpp +++ b/src/ui/customattributestable.cpp @@ -24,7 +24,7 @@ CustomAttributesTable::CustomAttributesTable(Event *event, QWidget *parent) : buttonsFrame->layout()->addWidget(addButton); buttonsFrame->layout()->addWidget(deleteButton); buttonsFrame->layout()->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed)); - buttonsFrame->layout()->setMargin(0); + buttonsFrame->layout()->setContentsMargins(0, 0, 0, 0); layout->addWidget(buttonsFrame); this->table = new QTableWidget(this); diff --git a/src/ui/filterchildrenproxymodel.cpp b/src/ui/filterchildrenproxymodel.cpp index faff6a23..a08c150c 100644 --- a/src/ui/filterchildrenproxymodel.cpp +++ b/src/ui/filterchildrenproxymodel.cpp @@ -9,7 +9,7 @@ FilterChildrenProxyModel::FilterChildrenProxyModel(QObject *parent) : bool FilterChildrenProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { // custom behaviour : - if(filterRegExp().isEmpty() == false) + if(filterRegularExpression().pattern().isEmpty() == false) { // get source-model index for current row QModelIndex source_index = sourceModel()->index(source_row, this->filterKeyColumn(), source_parent) ; @@ -27,7 +27,7 @@ bool FilterChildrenProxyModel::filterAcceptsRow(int source_row, const QModelInde // check current index itself QString key = sourceModel()->data(source_index, filterRole()).toString(); QString parentKey = sourceModel()->data(source_parent, filterRole()).toString(); - return key.contains(filterRegExp()) || parentKey.contains(filterRegExp()); + return key.contains(filterRegularExpression()) || parentKey.contains(filterRegularExpression()); } } // parent call for initial behaviour diff --git a/src/ui/mapimageexporter.cpp b/src/ui/mapimageexporter.cpp index 216c7db8..24aaa66a 100644 --- a/src/ui/mapimageexporter.cpp +++ b/src/ui/mapimageexporter.cpp @@ -4,7 +4,6 @@ #include "editcommands.h" #include -#include #include #include #include diff --git a/src/ui/newtilesetdialog.cpp b/src/ui/newtilesetdialog.cpp index 0639fab3..3b510dea 100644 --- a/src/ui/newtilesetdialog.cpp +++ b/src/ui/newtilesetdialog.cpp @@ -11,8 +11,8 @@ NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) : this->setFixedSize(this->width(), this->height()); this->project = project; //only allow characters valid for a symbol - QRegExp expression("[_A-Za-z0-9]+$"); - QRegExpValidator *validator = new QRegExpValidator(expression); + QRegularExpression expression("[_A-Za-z0-9]+$"); + QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression); this->ui->nameLineEdit->setValidator(validator); connect(this->ui->nameLineEdit, &QLineEdit::textChanged, this, &NewTilesetDialog::NameOrSecondaryChanged); diff --git a/src/ui/noscrollcombobox.cpp b/src/ui/noscrollcombobox.cpp index 068154d2..fb3abb4d 100644 --- a/src/ui/noscrollcombobox.cpp +++ b/src/ui/noscrollcombobox.cpp @@ -10,7 +10,7 @@ NoScrollComboBox::NoScrollComboBox(QWidget *parent) // Make speed a priority when loading comboboxes. setMinimumContentsLength(24);// an arbitrary limit - setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); // Allow items to be searched by any part of the word, displaying all matches. setEditable(true);// can set to false manually when using diff --git a/src/ui/regionmapeditor.cpp b/src/ui/regionmapeditor.cpp index 6d19cb25..a95cb068 100644 --- a/src/ui/regionmapeditor.cpp +++ b/src/ui/regionmapeditor.cpp @@ -550,13 +550,13 @@ void RegionMapEditor::on_tabWidget_Region_Map_currentChanged(int index) { } } -void RegionMapEditor::on_comboBox_RM_ConnectedMap_activated(const QString &mapsec) { - this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName.value(mapsec)); +void RegionMapEditor::on_comboBox_RM_ConnectedMap_textActivated(const QString &mapsec) { + this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(mapsec)); onRegionMapLayoutSelectedTileChanged(this->currIndex);// re-draw layout image this->hasUnsavedChanges = true;// sometimes this is called for unknown reasons } -void RegionMapEditor::on_comboBox_RM_Entry_MapSection_activated(const QString &text) { +void RegionMapEditor::on_comboBox_RM_Entry_MapSection_textActivated(const QString &text) { this->activeEntry = text; this->region_map_entries_item->currentSection = activeEntry; updateRegionMapEntryOptions(activeEntry); diff --git a/src/ui/tileseteditor.cpp b/src/ui/tileseteditor.cpp index 58f41b24..1054feab 100644 --- a/src/ui/tileseteditor.cpp +++ b/src/ui/tileseteditor.cpp @@ -149,8 +149,8 @@ void TilesetEditor::setVersionSpecificUi() { void TilesetEditor::setMetatileLabelValidator() { //only allow characters valid for a symbol - QRegExp expression("[_A-Za-z0-9]*$"); - QRegExpValidator *validator = new QRegExpValidator(expression); + QRegularExpression expression("[_A-Za-z0-9]*$"); + QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression); this->ui->lineEdit_metatileLabel->setValidator(validator); } @@ -463,7 +463,7 @@ void TilesetEditor::on_checkBox_yFlip_stateChanged(int checked) this->metatileLayersItem->clearLastModifiedCoords(); } -void TilesetEditor::on_comboBox_metatileBehaviors_activated(const QString &metatileBehavior) +void TilesetEditor::on_comboBox_metatileBehaviors_textActivated(const QString &metatileBehavior) { if (this->metatile) { Metatile *prevMetatile = new Metatile(*this->metatile);