-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[scide][qtcollider] Fix Qt deprecations #4649
[scide][qtcollider] Fix Qt deprecations #4649
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can you please use https://doc.qt.io/qt-5/qtglobal.html#QT_VERSION instead of comments?
@@ -950,8 +948,7 @@ int MultiEditor::insertTab(Document* doc, int insertIndex) { | |||
tabIdx = mTabs->insertTab(insertIndex, icon, doc->title()); | |||
mTabs->setTabData(tabIdx, QVariant::fromValue<Document*>(doc)); | |||
|
|||
mDocModifiedSigMap.setMapping(tdoc, doc); | |||
connect(tdoc, SIGNAL(modificationChanged(bool)), &mDocModifiedSigMap, SLOT(map())); | |||
connect(tdoc, &QTextDocument::modificationChanged, [=](const bool status) { onDocModified(doc); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strongly prefer explicit captures for lambdas, and you can simplify the parameter list since you don't use status
-- [this, doc](bool) { onDocModified(doc); }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this - I've brushed up on new(er) Meyers advice and now understand the reasons for this, thanks for the catch!
@@ -163,8 +163,7 @@ MainWindow::MainWindow(Main* main): mMain(main), mClockLabel(0), mDocDialog(0) { | |||
connect(main->sessionManager(), SIGNAL(saveSessionRequest(Session*)), this, SLOT(saveSession(Session*))); | |||
connect(main->sessionManager(), SIGNAL(switchSessionRequest(Session*)), this, SLOT(switchSession(Session*))); | |||
connect(main->sessionManager(), SIGNAL(currentSessionNameChanged()), this, SLOT(updateWindowTitle())); | |||
// A system for easy evaluation of pre-defined code: | |||
connect(&mCodeEvalMapper, SIGNAL(mapped(QString)), this, SIGNAL(evaluateCode(QString))); | |||
// A system for easy evaluation of pre-defined code:; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray semicolon
qSort deprecated in Qt 5.2
2ff6c99
to
0a867b9
Compare
QSignalMapper deprecated. Lambda-based connections introduced in 5.0
QSignalMapper deprecated. No call to mCodeEvalMapper.map() ever made, safe to remove
setTabStop replaced with setTabStopDistance in 5.10
QFontMetrics::width replaced by QFontMetrics::horizontalAdvance in 5.11
screenGeometry deprecated. QGuiApplication::primaryScreen()->geometry available since Qt 5.0
QPixmap::grabWidget deprecated - QWidget::grab available since Qt 5.0
0a867b9
to
09bc2dd
Compare
thanks for the review @brianlheim! Hopefully should all be implemented now. One question about the compile-time check - do we need to worry about people using different Qt runtime libs than the ones we compile against? |
no, we bundle qt libraries for the windows and mac artefacts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested, works as advertised, thanks :)
Purpose and Motivation
Qt has started issuing deprecation warnings - this PR addresses as many of them as possible while maintaining compatibility.
These aren't particularly high priority, but just to get ahead of it where possible.
Everything here uses 5.0 compatible fixes.For those that need a more recent Qt version, I've added TODO notes with the code to uncomment when the time comes - some things need 5.10, etc. and I wasn't sure we were ready to enforce that.EDIT: Compile-time checks of Qt versions switch in newer code where required.
Commit history outlines the details - most of them relate the use of QSignalMapper, which hasn't been necessary since 5.0 with C++11.
Features affected/to test:
Types of changes
To-do list