Skip to content

Commit

Permalink
Merge pull request #118 from mojotx/qt6_awesomeness
Browse files Browse the repository at this point in the history
Qt6 awesomeness
  • Loading branch information
mrkite authored Apr 6, 2021
2 parents 801e14c + 59f523a commit 06e7344
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Terrafirma.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets opengl openglwidgets

TARGET = terrafirma
TEMPLATE = app
Expand Down
2 changes: 1 addition & 1 deletion findchests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ void FindChests::chestSelected(QModelIndex const& current, QModelIndex const& pr
}

void FindChests::searchTextChanged(const QString &newText) {
filter->setFilterRegExp(newText);
filter->setFilterRegularExpression(newText);
filter->setFilterCaseSensitivity(Qt::CaseInsensitive);
}
2 changes: 1 addition & 1 deletion glmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void GLMap::mouseReleaseEvent(QMouseEvent *event) {
}

void GLMap::wheelEvent(QWheelEvent *event) {
zoom += event->delta() / 90.0;
zoom += event->angleDelta().y() / 90.0;
if (zoom > 32.0) zoom = 32.0;
else if (zoom < 2.0) zoom = 2.0;

Expand Down
2 changes: 1 addition & 1 deletion hilitedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void HiliteDialog::addChild(const QSharedPointer<TileInfo> &tile,
}

void HiliteDialog::searchTextChanged(const QString &newText) {
filter.setFilterRegExp(newText);
filter.setFilterRegularExpression(newText);
filter.setFilterCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
}

Expand Down
3 changes: 2 additions & 1 deletion l10n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ void L10n::setLanguage(QString lang) {
}

QList<QString> L10n::getLanguages() {
return languages.toList();
QList<QString> qList(languages.begin(), languages.end());
return qList;
}

QString L10n::xlateItem(const QString &key) {
Expand Down
5 changes: 3 additions & 2 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* The main window for terrafirma
*/

#include <QActionGroup>
#include <QMessageBox>
#include <QStandardPaths>
#include <QDir>
Expand Down Expand Up @@ -238,7 +239,7 @@ void MainWindow::scanWorlds() {
w->setText(name);
w->setData(it.filePath());
if (key < 9) {
w->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1 + key++));
w->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_1 + key++));
w->setShortcutContext(Qt::ApplicationShortcut);
}
connect(w, &QAction::triggered, this, &MainWindow::openWorld);
Expand Down Expand Up @@ -328,7 +329,7 @@ QString MainWindow::playerName(const QString &path) {

QByteArray key;
for (int i = 0; i < 8; i++) {
key.append(keystr.at(i));
key.append(keystr.at(i).unicode());
key.append(static_cast<char>(0));
}

Expand Down
7 changes: 5 additions & 2 deletions uvrules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <QDebug>
#include <QRandomGenerator>
#include "./uvrules.h"
#include "./world.h"

Expand Down Expand Up @@ -250,7 +251,8 @@ void UVRules::fixWall(const QSharedPointer<World> &world, int x, int y) {
set = (lazureTiles[x % 2][y % 2] - 1) * 2;
break;
default:
set = (qrand() % 3) * 2;
QRandomGenerator *rp = QRandomGenerator::system();
set = (rp->generate() % 3 ) * 2;
break;
}

Expand Down Expand Up @@ -494,7 +496,8 @@ quint8 UVRules::fixTile(const QSharedPointer<World> &world, int x, int y) {
mask |= (bl == c) ? 0x0c00 : (bl == -2) ? 0x0800 : 0;
mask |= (br == c) ? 0x0300 : (br == -2) ? 0x0200 : 0;

int set = (qrand() % 3) * 2;
QRandomGenerator *rp = QRandomGenerator::system();
int set = (rp->generate() % 3) * 2;
if (world->info[c]->large)
set = (phlebasTiles[y % 4][x % 3] - 1) * 2;

Expand Down

0 comments on commit 06e7344

Please sign in to comment.