[education/rkward/kf5] rkward: Adapt rkloadlibsdialog to frameless style

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit 13d5d8fe025edefbeb7364307b879308314c9885 by Thomas Friedrichsmeier, on behalf of Carl Schwan.
Committed on 01/04/2024 at 11:45.
Pushed by tfry into branch 'kf5'.

Adapt rkloadlibsdialog to frameless style

M  +22   -6    rkward/dialogs/rkloadlibsdialog.cpp
M  +3    -0    rkward/misc/rkprogresscontrol.cpp

https://invent.kde.org/education/rkward/-/commit/13d5d8fe025edefbeb7364307b879308314c9885

diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index c10f171f2..12fcd6edb 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -330,7 +330,6 @@ LoadUnloadWidget::LoadUnloadWidget (RKLoadLibsDialog *dialog) : RKLoadLibsDialog
 	LoadUnloadWidget::parent = dialog;
 	
 	QVBoxLayout *mvbox = new QVBoxLayout (this);
-	mvbox->setContentsMargins (0, 0, 0, 0);
 	
 	QHBoxLayout *hbox = new QHBoxLayout ();
 	mvbox->addLayout (hbox);
@@ -614,8 +613,19 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : RKLoad
 	
 	QVBoxLayout *vbox = new QVBoxLayout(this);
 	vbox->setContentsMargins(0, 0, 0, 0);
+	vbox->setSpacing(0);
 	QHBoxLayout *filterbox = new QHBoxLayout();
+	filterbox->setContentsMargins(
+		style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
+		style()->pixelMetric(QStyle::PM_LayoutTopMargin),
+		style()->pixelMetric(QStyle::PM_LayoutRightMargin),
+		style()->pixelMetric(QStyle::PM_LayoutBottomMargin)
+	);
+	filterbox->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
 	vbox->addLayout(filterbox);
+	auto horizontalSeparator = new QFrame(this);
+	horizontalSeparator->setFrameShape(QFrame::HLine);
+	vbox->addWidget(horizontalSeparator);
 
 	packages_view = new QTreeView (this);
 	packages_status = new RKRPackageInstallationStatus(this, packages_view);
@@ -632,11 +642,7 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : RKLoad
 	packages_view->setIndentation (0);
 	packages_view->setMinimumHeight (packages_view->sizeHintForRow (0) * 15);	// force a decent height
 	QString dummy("This is to force a sensible min width for the packages view (empty on construction)");
-#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
 	packages_view->setMinimumWidth(packages_view->fontMetrics().horizontalAdvance(dummy)*2);
-#else
-	packages_view->setMinimumWidth(packages_view->fontMetrics().width(dummy)*2);
-#endif
 	vbox->addWidget (packages_view);
 
 	QLabel *label = new QLabel (i18n ("Show only packages matching:"), this);
@@ -650,11 +656,22 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : RKLoad
 	connect (rkward_packages_only, &QCheckBox::stateChanged, this, &InstallPackagesWidget::filterChanged);
 	filterChanged ();
 
+	horizontalSeparator = new QFrame(this);
+	horizontalSeparator->setFrameShape(QFrame::HLine);
+	vbox->addWidget(horizontalSeparator);
+
 	filterbox->addWidget (label);
 	filterbox->addWidget (filter_edit);
 	filterbox->addWidget (rkward_packages_only);
 
 	auto settingsbox = new QHBoxLayout();
+	settingsbox->setContentsMargins(
+		style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
+		style()->pixelMetric(QStyle::PM_LayoutTopMargin),
+		style()->pixelMetric(QStyle::PM_LayoutRightMargin),
+		style()->pixelMetric(QStyle::PM_LayoutBottomMargin)
+	);
+	settingsbox->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
 	vbox->addLayout(settingsbox);
 	settingsbox->addWidget(new QLabel(i18n("Install packages to:")));
 	libloc_selector = new QComboBox();
@@ -1190,7 +1207,6 @@ RKPluginMapSelectionWidget::RKPluginMapSelectionWidget (RKLoadLibsDialog* dialog
 	model = 0;
 
 	QVBoxLayout *vbox = new QVBoxLayout (this);
-	vbox->setContentsMargins (0, 0, 0, 0);
 	vbox->addWidget (new QLabel (i18n ("Installed plugin groups (.pluginmap files)"), this));
 	selector = new RKMultiStringSelectorV2 (QString (), this);
 	selector->setAlwaysAddAtBottom (true);
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 14120b30e..5baf38d44 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -408,13 +408,16 @@ RKInlineProgressControl::RKInlineProgressControl(QWidget *display_area, bool all
 	wrapper->setAutoFillBackground(true);
 	auto layout = new QVBoxLayout(wrapper);
 	layout->setContentsMargins(0,0,0,0);
+	layout->setSpacing(0);
 	message_widget = new KMessageWidget();
+	message_widget->setPosition(KMessageWidget::Position::Header);
 	message_widget->setWordWrap(true);
 	message_widget->setCloseButtonVisible(false);  // we want a button, instead, for consistency with cancel
 	if (allow_cancel) {
 		setCloseAction(i18n("Cancel"));
 	}
 	output_display = new QTextEdit();
+	output_display->setProperty("_breeze_force_frame", false);
 	layout->addWidget(message_widget);
 	layout->addWidget(output_display);
 	wrapper->resize(display_area->size());



More information about the rkward-tracker mailing list