-
Notifications
You must be signed in to change notification settings - Fork 30
Remove high dpi scaling option with Qt6 #357
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
base: main
Are you sure you want to change the base?
Conversation
932a006
to
0c77b87
Compare
This removes the --scale command line option. Qt6 seems to have this already integrated to scale according to the nativ display settings: https://doc.qt.io/qt-6.8/highdpi.html Adjusting the scale on a per-application basis is not intended (anymore) according to the documentation. Tested on a (near) high-dpi screen.
0c77b87
to
ea0dc3b
Compare
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.
Pull Request Overview
This PR removes high DPI scaling functionality from the codebase, as Qt6 now handles high DPI scaling automatically according to native display settings. The PR eliminates the manual --scale command line option and related scaling components that are no longer needed.
Key changes:
- Removed scale screen factor component and related UI elements
- Eliminated high DPI scaling methods and command line options
- Updated Qt API usage to align with Qt6 standards (deprecated method replacements)
Reviewed Changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/gui/components/scalescreenfactor.* | Completely removed scale screen factor component files |
src/swiftlauncher/swiftlauncher.* | Removed scale factor UI component and related functionality |
src/gui/guiapplication.* | Removed high DPI scaling methods and command line options |
src/misc/variant.* | Updated Qt API calls to use Qt6-compatible methods |
samples/*/main.cpp | Removed high DPI scaling initialization calls |
Multiple test files | Updated deprecated Qt datetime methods to use QTimeZone::utc() |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -521,24 +522,23 @@ namespace swift::misc | |||
} | |||
} | |||
|
|||
QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType, const QString &typeName) | |||
QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName) |
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.
[nitpick] The function signature has changed to accept QMetaType instead of int, but the function is still being called with QMetaType::fromName(...) at line 415. Consider updating the function name to reflect that it now works with QMetaType objects rather than type IDs.
QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName) | |
QVariant fixQVariantFromDbusArgumentMetaType(const QVariant &variant, QMetaType localUserType, const QString &typeName) |
Copilot uses AI. Check for mistakes.
if (value.userType() != element.m_metaType) | ||
{ | ||
return CStatusMessage(this).error(u"Expected %1 but got %2 for %3") | ||
<< QMetaType::typeName(element.m_metaType) << value.typeName() << element.m_nameWithKey; | ||
<< QMetaType(element.m_metaType).name() << value.typeName() << element.m_nameWithKey; | ||
} | ||
else if (element.m_validator && !element.m_validator(value, reason)) | ||
if (element.m_validator && !element.m_validator(value, reason)) | ||
{ | ||
if (reason.isEmpty()) | ||
{ | ||
return CStatusMessage(this).error(u"%1 is not valid for %2") | ||
<< value.toQString() << element.m_nameWithKey; | ||
} | ||
else | ||
{ | ||
return CStatusMessage(this).error(u"%1 (%2 for %3)") | ||
<< reason << value.toQString() << element.m_nameWithKey; | ||
} | ||
return CStatusMessage(this).error(u"%1 (%2 for %3)") | ||
<< reason << value.toQString() << element.m_nameWithKey; | ||
} | ||
else { return {}; } |
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.
The if-else chain has been restructured, but the final 'else' clause is missing. The code should include an explicit 'else' statement before the final return statement for clarity, or restructure to avoid the dangling return.
Copilot uses AI. Check for mistakes.
q = QColor::fromString("#" + c); | ||
this->setQColor(q); |
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.
[nitpick] QColor::fromString() returns a QColor object by value, but the code assigns it to an existing QColor variable 'q'. This creates an unnecessary assignment. Consider using the return value directly in setQColor() call: 'this->setQColor(QColor::fromString("#" + c));'
q = QColor::fromString("#" + c); | |
this->setQColor(q); | |
this->setQColor(QColor::fromString("#" + c)); |
Copilot uses AI. Check for mistakes.
@@ -251,7 +251,7 @@ namespace swift::gui::components | |||
void CNavigatorDialog::enterEvent(QEnterEvent *event) | |||
{ | |||
// event called when mouse is over, acts as auto-focus | |||
QApplication::setActiveWindow(this); | |||
activateWindow(); |
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.
The replacement of QApplication::setActiveWindow(this) with activateWindow() changes the behavior. QApplication::setActiveWindow() sets the active window globally, while activateWindow() only requests activation. This may not provide the same functionality as the original code.
Copilot uses AI. Check for mistakes.
contextMenu->addAction("Max.data area", QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_D), | ||
this, &CDbMappingComponent::resizeForSelect); | ||
contextMenu->addAction("Max.mapping area", QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_M), | ||
this, &CDbMappingComponent::resizeForMapping); |
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.
The parameter order for QMenu::addAction() has been changed. The new order places the QKeySequence before the receiver and method. Verify this matches the Qt6 API signature for addAction(), as incorrect parameter order could cause compilation errors or runtime issues.
Copilot uses AI. Check for mistakes.
This removes the --scale command line option.
Qt6 seems to have this already integrated to scale according to the native display settings: https://doc.qt.io/qt-6.8/highdpi.html
Adjusting the scale on a per-application basis is not intended (anymore) according to the documentation. Tested on a (near) high-dpi screen.