mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Various fixes for functionality deprecated or removed in QT6.
This commit is contained in:
parent
fe92aaeb3d
commit
988918a038
@ -44,7 +44,9 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
||||
// Setup application information
|
||||
setApplicationVersion(CUTTER_VERSION_FULL);
|
||||
setWindowIcon(QIcon(":/img/cutter.svg"));
|
||||
setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
setAttribute(Qt::AA_UseHighDpiPixmaps); // always enabled on Qt >= 6.0.0
|
||||
#endif
|
||||
setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
// WARN!!! Put initialization code below this line. Code above this line is mandatory to be run
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "JsonModel.h"
|
||||
|
||||
#include <QIODevice>
|
||||
|
||||
JsonModel::JsonModel(QObject *parent) : QAbstractItemModel(parent)
|
||||
{
|
||||
mRootItem = new JsonTreeItem;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#ifdef APPIMAGE
|
||||
static QDir appimageRoot()
|
||||
@ -76,7 +77,7 @@ QString Cutter::writableLocation(QStandardPaths::StandardLocation type)
|
||||
|
||||
QStringList Cutter::getTranslationsDirectories()
|
||||
{
|
||||
auto result = locateAll(QStandardPaths::DataLocation, "translations",
|
||||
auto result = locateAll(QStandardPaths::AppDataLocation, "translations",
|
||||
QStandardPaths::LocateDirectory);
|
||||
result << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
return result;
|
||||
|
@ -12,6 +12,7 @@
|
||||
# include <QDesktopServices>
|
||||
# include <QtNetwork/QNetworkReply>
|
||||
# include <QtNetwork/QNetworkRequest>
|
||||
# include <QStandardPaths>
|
||||
|
||||
# include <QProgressDialog>
|
||||
# include <QPushButton>
|
||||
@ -57,7 +58,12 @@ void UpdateWorker::download(QString filename, QString version)
|
||||
downloadFile.open(QIODevice::WriteOnly);
|
||||
|
||||
QNetworkRequest request;
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
|
||||
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
# elif QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute,
|
||||
QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy);
|
||||
# endif
|
||||
QUrl url(QString("https://github.com/rizinorg/cutter/releases/"
|
||||
"download/v%1/%2")
|
||||
.arg(version)
|
||||
|
@ -47,7 +47,7 @@ void ColorThemeComboBox::updateFromConfig(bool interfaceThemeChanged)
|
||||
}
|
||||
}
|
||||
setMinimumContentsLength(maxThemeLen);
|
||||
setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
||||
setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
}
|
||||
|
||||
void ColorThemeComboBox::onCurrentIndexChanged(int index)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "core/MainWindow.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QtWidgets/QShortcut>
|
||||
#include <QShortcut>
|
||||
|
||||
CutterDockWidget::CutterDockWidget(MainWindow *parent, QAction *) : CutterDockWidget(parent) {}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void CutterGraphView::initFont()
|
||||
setFont(Config()->getFont());
|
||||
QFontMetricsF metrics(font());
|
||||
baseline = int(metrics.ascent());
|
||||
charWidth = metrics.width('X');
|
||||
charWidth = metrics.maxWidth();
|
||||
charHeight = static_cast<int>(metrics.height());
|
||||
charOffset = 0;
|
||||
mFontMetrics.reset(new CachedFontMetrics<qreal>(font()));
|
||||
|
@ -64,7 +64,7 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main)
|
||||
// Setup the disassembly content
|
||||
auto *layout = new QHBoxLayout;
|
||||
layout->addWidget(mDisasTextEdit);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
mDisasScrollArea->viewport()->setLayout(layout);
|
||||
splitter->addWidget(mDisasScrollArea);
|
||||
mDisasScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
|
||||
|
@ -1600,9 +1600,11 @@ void GraphGridLayout::optimizeLayout(GraphGridLayout::LayoutState &state) const
|
||||
};
|
||||
|
||||
auto copyVariablesToPositions = [&](const std::vector<int> &solution, bool horizontal = false) {
|
||||
#ifndef NDEBUG
|
||||
for (auto v : solution) {
|
||||
assert(v >= 0);
|
||||
}
|
||||
#endif
|
||||
size_t variableIndex = blockMapping.size();
|
||||
for (auto &blockIt : *state.blocks) {
|
||||
auto &block = blockIt.second;
|
||||
|
@ -1168,7 +1168,7 @@ void HexWidget::updateMetrics()
|
||||
{
|
||||
QFontMetricsF fontMetrics(this->monospaceFont);
|
||||
lineHeight = fontMetrics.height();
|
||||
charWidth = fontMetrics.width(QLatin1Char('F'));
|
||||
charWidth = fontMetrics.maxWidth();
|
||||
|
||||
updateCounts();
|
||||
updateAreasHeight();
|
||||
|
@ -166,7 +166,8 @@ void ProcessesWidget::onActivated(const QModelIndex &index)
|
||||
for (QJsonValue value : processesValues) {
|
||||
QString status = value.toObject()["status"].toString();
|
||||
if (pid == value.toObject()["pid"].toInt()) {
|
||||
if (QString(RZ_DBG_PROC_ZOMBIE) == status || QString(RZ_DBG_PROC_DEAD) == status) {
|
||||
if (QString(QChar(RZ_DBG_PROC_ZOMBIE)) == status
|
||||
|| QString(QChar(RZ_DBG_PROC_DEAD)) == status) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("Unable to switch to the requested process."));
|
||||
msgBox.exec();
|
||||
|
@ -88,7 +88,7 @@ void RegistersWidget::setRegisterGrid()
|
||||
registerEditValue = qobject_cast<QLineEdit *>(regValueWidget);
|
||||
}
|
||||
// decide to highlight QLine Box in case of change of register value
|
||||
if (regValue != registerEditValue->text() && registerEditValue->text() != 0) {
|
||||
if (regValue != registerEditValue->text() && !registerEditValue->text().isEmpty()) {
|
||||
registerEditValue->setStyleSheet("border: 1px solid green;");
|
||||
} else {
|
||||
// reset stylesheet
|
||||
|
Loading…
Reference in New Issue
Block a user