d47081
(D47081)
October 28, 2024, 2:53pm
1
Is it possible to simply make title and description selectable for libadwaita StatusPage
widget?
I can use custom widget with Label
configured, but maybe some option available I forgot to set
Here is what do I mean:
StatusPage::builder()
.description(description) // not selectable
.icon_name("dialog-error-symbolic")
.title(title) // not selectable
.build()
Builder implementation (accept GString
, not Widget
):
impl StatusPageBuilder {
// ..
pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
Self {
builder: self.builder.property("child", child.clone().upcast()),
}
} // could be useful, if no alternatives for native title/description
pub fn description(self, description: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("description", description.into()),
}
} // GString
// ..
d47081
(D47081)
November 21, 2024, 6:17pm
2
I think that selectable option should be implemented once, because users can’t copy error message from AdwStatusPage
(as it maybe created for these needs)
Currently, don’t know any other option but downcast and hope the widget tree will not be changed once; this code looks like something I not ready to apply:
fn selectable(this: adw::StatusPage) -> adw::StatusPage {
this.child()
.and_downcast::<gtk::ScrolledWindow>()
.unwrap()
.child()
.and_downcast::<gtk::Viewport>()
.unwrap()
.child()
.and_downcast::<gtk::Box>()
.unwrap()
.first_child()
.and_downcast::<adw::Clamp>()
.unwrap()
.child()
.and_downcast::<gtk::Box>()
.unwrap()
.last_child()
.and_downcast::<gtk::Label>()
.unwrap()
.set_selectable(true);
this
}
Another thought,
implement ‘copy-to-clipboard’ button as the child widget
UPD I can just set selectable Label
as the children widget, finally
system
(system)
Closed
December 21, 2024, 6:18pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.