Migrate deprecated APIs (#418)

* migrate deprecated QLayout::setMargin -> QLayout::setContentMargins

* migrate deprecated QRegExp -> QRegularExpression

* remove deprecated QDesktopWidget header

* migrage deprecated QDesktopWidget::width, height -> QScreen::geometry
This commit is contained in:
Cyano Hao 2024-05-10 17:31:10 +08:00 committed by GitHub
parent 2e5e68d50d
commit e67a9992c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 21 additions and 21 deletions

View File

@ -35,6 +35,7 @@
#include <QJsonObject> #include <QJsonObject>
#include "widgets/signalmessagedialog.h" #include "widgets/signalmessagedialog.h"
#include <QApplication> #include <QApplication>
#include <QRegularExpression>
Debugger::Debugger(QObject *parent) : QObject(parent), Debugger::Debugger(QObject *parent) : QObject(parent),
mForceUTF8(false), mForceUTF8(false),
@ -2461,7 +2462,7 @@ MemoryModel::MemoryModel(int dataPerLine, QObject *parent):
void MemoryModel::updateMemory(const QStringList &value) void MemoryModel::updateMemory(const QStringList &value)
{ {
int maxDataPerLine=-1; int maxDataPerLine=-1;
QRegExp delimiter("(\\s+)"); QRegularExpression delimiter("(\\s+)");
QList<PMemoryLine> newModel; QList<PMemoryLine> newModel;
for (int i=0;i<value.length();i++) { for (int i=0;i<value.length();i++) {
QString line = value[i].trimmed(); QString line = value[i].trimmed();

View File

@ -25,7 +25,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QStringList> #include <QStringList>
#include <QAbstractNativeEventFilter> #include <QAbstractNativeEventFilter>
#include <QDesktopWidget>
#include <QDir> #include <QDir>
#include <QScreen> #include <QScreen>
#include <QLockFile> #include <QLockFile>

View File

@ -28,7 +28,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QStandardPaths> #include <QStandardPaths>
#include <QScreen> #include <QScreen>
#include <QDesktopWidget>
#include <QRegularExpression> #include <QRegularExpression>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
@ -6443,19 +6442,23 @@ void Settings::UI::doLoad()
mProblemOrder = intValue("problem_order",6); mProblemOrder = intValue("problem_order",6);
//dialogs //dialogs
mCPUDialogWidth = intValue("cpu_dialog_width",977*qApp->desktop()->width()/1920); QRect geometry = qApp->primaryScreen()->geometry();
mCPUDialogHeight = intValue("cpu_dialog_height",622*qApp->desktop()->height()/1080); int width = geometry.width();
mCPUDialogSplitterPos = intValue("cpu_dialog_splitter",500*qApp->desktop()->width()/1920); int height = geometry.height();
mSettingsDialogWidth = intValue("settings_dialog_width",977*qApp->desktop()->width()/1920);
mSettingsDialogHeight = intValue("settings_dialog_height",622*qApp->desktop()->height()/1080);
mSettingsDialogSplitterPos = intValue("settings_dialog_splitter",300*qApp->desktop()->width()/1920);
mNewProjectDialogWidth = intValue("new_project_dialog_width", 900*qApp->desktop()->width()/1920); mCPUDialogWidth = intValue("cpu_dialog_width", 977 * width / 1920);
mNewProjectDialogHeight = intValue("new_project_dialog_height", 600*qApp->desktop()->height()/1080); mCPUDialogHeight = intValue("cpu_dialog_height", 622 * height / 1080);
mNewClassDialogWidth = intValue("new_class_dialog_width", 642*qApp->desktop()->width()/1920); mCPUDialogSplitterPos = intValue("cpu_dialog_splitter", 500 * width / 1920);
mNewClassDialogHeight = intValue("new_class_dialog_height", 300*qApp->desktop()->height()/1080); mSettingsDialogWidth = intValue("settings_dialog_width", 977 * width / 1920);
mNewHeaderDialogWidth = intValue("new_header_dialog_width", 642*qApp->desktop()->width()/1920); mSettingsDialogHeight = intValue("settings_dialog_height", 622 * height / 1080);
mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300*qApp->desktop()->height()/1080); mSettingsDialogSplitterPos = intValue("settings_dialog_splitter", 300 * width / 1920);
mNewProjectDialogWidth = intValue("new_project_dialog_width", 900 * width / 1920);
mNewProjectDialogHeight = intValue("new_project_dialog_height", 600 * height / 1080);
mNewClassDialogWidth = intValue("new_class_dialog_width", 642 * width / 1920);
mNewClassDialogHeight = intValue("new_class_dialog_height", 300 * height / 1080);
mNewHeaderDialogWidth = intValue("new_header_dialog_width", 642 * width / 1920);
mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300 * height / 1080);
} }
#ifdef ENABLE_VCS #ifdef ENABLE_VCS

View File

@ -63,7 +63,6 @@
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <QModelIndex> #include <QModelIndex>
#include <QDesktopWidget>
SettingsDialog::SettingsDialog(QWidget *parent) : SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),

View File

@ -44,7 +44,7 @@ CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
mListView->setItemDelegate(mDelegate); mListView->setItemDelegate(mDelegate);
setLayout(new QVBoxLayout()); setLayout(new QVBoxLayout());
layout()->addWidget(mListView); layout()->addWidget(mListView);
layout()->setMargin(0); layout()->setContentsMargins(0, 0, 0, 0);
mListView->setFocus(); mListView->setFocus();
mShowKeywords=true; mShowKeywords=true;

View File

@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <QDesktopWidget>
#include <qsynedit/document.h> #include <qsynedit/document.h>
#include "cpudialog.h" #include "cpudialog.h"
#include "ui_cpudialog.h" #include "ui_cpudialog.h"

View File

@ -39,7 +39,7 @@ HeaderCompletionPopup::HeaderCompletionPopup(QWidget* parent):QWidget(parent)
mListView->setItemDelegate(mDelegate); mListView->setItemDelegate(mDelegate);
setLayout(new QVBoxLayout()); setLayout(new QVBoxLayout());
layout()->addWidget(mListView); layout()->addWidget(mListView);
layout()->setMargin(0); layout()->setContentsMargins(0, 0, 0, 0);
mListView->setFocus(); mListView->setFocus();

View File

@ -38,7 +38,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDrag> #include <QDrag>
#include <QMimeData> #include <QMimeData>
#include <QDesktopWidget>
#include <QTextEdit> #include <QTextEdit>
#include <QMimeData> #include <QMimeData>

View File

@ -16,7 +16,7 @@
*/ */
#include "regexsearcher.h" #include "regexsearcher.h"
#include <QRegExp> #include <QRegularExpression>
namespace QSynedit { namespace QSynedit {