Skip to content
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

Merged

Conversation

jrsurge
Copy link
Member

@jrsurge jrsurge commented Nov 19, 2019

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:

  • Document modifications still update the icon in QTabWidget (Windows doesn't have an icon for this, so Mac and Linux need checking).
  • Document modifications still update the icons in split view
  • Window reporting geometry:
Window.availableBounds; // should be screen size - a bit for toolbars etc
Window.screenBounds; // should be screen size

Types of changes

  • Bug fix (?)

To-do list

  • Code is tested
  • This PR is ready for review

@jrsurge jrsurge added comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead env: SCIDE labels Nov 19, 2019
Copy link
Contributor

@mossheim mossheim left a 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); });
Copy link
Contributor

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); }

Copy link
Member Author

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:;
Copy link
Contributor

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
@jrsurge jrsurge force-pushed the topic/remove-qt-deprecations branch from 2ff6c99 to 0a867b9 Compare November 28, 2019 19:01
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
@jrsurge jrsurge force-pushed the topic/remove-qt-deprecations branch from 0a867b9 to 09bc2dd Compare November 28, 2019 19:31
@jrsurge
Copy link
Member Author

jrsurge commented Nov 28, 2019

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?

@mossheim
Copy link
Contributor

no, we bundle qt libraries for the windows and mac artefacts.

Copy link
Contributor

@mossheim mossheim left a 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 :)

@mossheim mossheim merged commit 7390719 into supercollider:develop Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead env: SCIDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants