Skip to content

Commit

Permalink
fix: the dual screen expandsion position when scaled
Browse files Browse the repository at this point in the history
fix the dual screen expandsion position when scaled

Log: fix the dual screen expandsion position when scaled
Bug: https://pms.uniontech.com/bug-view-273083.html
  • Loading branch information
starhcq authored and deepin-bot[bot] committed Oct 14, 2024
1 parent b1b6815 commit 57d7d52
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ int main(int argc, char *argv[])
DGuiApplicationHelper::setUseInactiveColorGroup(false);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

QStringList factors = QString(qgetenv("QT_SCREEN_SCALE_FACTORS")).split(";", QString::SkipEmptyParts);

if(factors.size() > 0){
bool ok = false;
double factor = factors.at(0).toDouble(&ok);

if(ok && factor > 0){
QDBusInterface scaleFactor("com.deepin.daemon.Display", "/com/deepin/XSettings", "com.deepin.XSettings");
if (scaleFactor.isValid()) {
qDebug()<< "com.deepin.XSettings is available";
QDBusReply<double> replay = scaleFactor.call(QStringLiteral("GetScaleFactor"));
double factor = replay.value();
if (factor > 0) {
qDebug() << "scaleFactor available value: " << factor;
qputenv("QT_SCALE_FACTOR", QString::number(1 / factor, 'g', 2).toLatin1());
}
} else {
qDebug()<< "com.deepin.XSettings is not available";
}

// 平板模式
Expand Down

0 comments on commit 57d7d52

Please sign in to comment.