[education/rkward] /: Limit minimum width setting for rk.with.progress() and similar dialogs.

Thomas Friedrichsmeier null at kde.org
Sat Sep 27 14:05:06 BST 2025


Git commit 205fceb8c11b60a75c17c6add633722a8a395495 by Thomas Friedrichsmeier.
Committed on 27/09/2025 at 10:57.
Pushed by tfry into branch 'master'.

Limit minimum width setting for rk.with.progress() and similar dialogs.

M  +2    -1    ChangeLog
M  +6    -2    rkward/misc/rkprogresscontrol.cpp

https://invent.kde.org/education/rkward/-/commit/205fceb8c11b60a75c17c6add633722a8a395495

diff --git a/ChangeLog b/ChangeLog
index a53174db0..7c199053d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
---- Version 0.8.2 - UNRELEASED
+--- Version 0.8.3 - UNRELEASED
+- Fixed: Width of "progress" dialogs (showing R output) would exceed screen size depending on configuration
 
 --- Version 0.8.2 - Oct-01-2025
 - Fixed: Package installation dialog now works with options(pkgType="both"), and this is now the default on Windows and Mac
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 4d5296a6f..2c4136dcb 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -1,6 +1,6 @@
 /*
 rkprogresscontol - This file is part of RKWard (https://rkward.kde.org). Created: Sun Sep 10 2006
-SPDX-FileCopyrightText: 2006-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2006-2025 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
 SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
 SPDX-License-Identifier: GPL-2.0-or-later
 */
@@ -11,6 +11,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QHBoxLayout>
+#include <QScreen>
 #include <QScrollBar>
 #include <QTimer>
 #include <QVBoxLayout>
@@ -232,7 +233,10 @@ RKProgressControlDialog::RKProgressControlDialog(const QString &text, const QStr
 	output_text->setPlainText(QString());
 	output_text->setUndoRedoEnabled(false);
 	output_text->setLineWrapMode(QTextEdit::NoWrap);
-	output_text->setMinimumWidth(QFontMetrics(output_text->font()).averageCharWidth() * RKSettingsModuleR::getDefaultWidth());
+	// default width depends on options("width"), but limit, in case users have set very large values
+	const int min_width = qMin(QFontMetrics(output_text->font()).averageCharWidth() * RKSettingsModuleR::getDefaultWidth(),
+	                           static_cast<int>(qApp->primaryScreen()->geometry().width() * .75));
+	output_text->setMinimumWidth(min_width);
 	detailsboxlayout->addWidget(output_text);
 	detailsboxlayout->setStretchFactor(output_text, 10);
 



More information about the rkward-tracker mailing list