Skip to content
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

Cannot select and copy godot version from the about window #24317

Closed
QbieShay opened this issue Dec 13, 2018 · 10 comments · Fixed by #35375
Closed

Cannot select and copy godot version from the about window #24317

QbieShay opened this issue Dec 13, 2018 · 10 comments · Fixed by #35375

Comments

@QbieShay
Copy link
Contributor

Godot version:
11d7738

Issue description:
Every time i open an issue, the Godot version is required. The current way of finding out your own Godot version is either:

  1. Open the about window and manually copy the commit hash (very annoying without 2 screens)
  2. Git log
  3. Check my last opened issue for the Godot version

Proposal:
Allow the Godot version in the "about" window for selecting and copying (or add a "copy to clipboard" button)

@akien-mga
Copy link
Member

The "usual" way to make this work is to replace the Label with a non-editable LineEdit, and then override the LineEdit's styles with that of Label (to fake a selectable Label).

It's a bit annoying though, so it might be worth adding support for selection in Label directly... should be discussed with @reduz to confirm that it'd be a good idea.

@QbieShay
Copy link
Contributor Author

I imagine it might be worth to have a "selectable label" class instead, so that the common use case remains untouched, but for when selection is needed there is a more specific node that handles that (I doubt that is easy to implement in GDScript..)

@starry-abyss
Copy link
Contributor

Would also be great to have this in the project manager as well

@KoBeWi
Copy link
Member

KoBeWi commented Aug 21, 2019

Is this still relevant now that we have Godot version printed in the console?

@akien-mga
Copy link
Member

It's less needed now, but it would still be good to have more stuff that can be selected and copy pasted in the editor generally-speaking.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 15, 2019

The "usual" way to make this work is to replace the Label with a non-editable LineEdit, and then override the LineEdit's styles with that of Label (to fake a selectable Label).

RichTextLabel supports selecting too.

@strattonbrazil
Copy link

strattonbrazil commented Jan 20, 2020

I took a quick look as this (as a "junior" ticket).

LineEdit has some rendering issues the copyright characters, so it didn't seem like a good fit, but I may have given up too early.

I tried RichTextLabel that seems promising, but either due to the API or my inexperience with it I can't match the dynamic centering. RichTextLabel will not provide a minimum size without a fixed width. This is needed for the layout to center the logo and the label. I can hard-code the minimum width, but if it's too low it wraps and if it's too high it it pushes the logo to the left. I could update RichTextLabel to support getting the content width (without wrapping) or some way to force no wrapping when computing the width, but wanted to follow-up here first to make sure either of these suggestions makes sense since it's a bigger change.

long_width

@Calinou
Copy link
Member

Calinou commented Jan 20, 2020

@strattonbrazil Thanks for looking into it 🙂

This can also be implemented by making the version label a dedicated LinkButton node, with a pressed action that copies the text (with a tooltip to suggest the action). This is what I did in my version-click-to-copy branch, but there are alignment issues with the rest of the text. Once I figure out a solution for this bug, I'll open a pull request.

@strattonbrazil
Copy link

@Calinou sounds good. Here's my change for reference.

-       Label *about_text = memnew(Label);
-       about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
+       RichTextLabel *about_text = memnew(RichTextLabel);
+       about_text->set_custom_minimum_size(Size2(500, 1));
+       about_text->set_selection_enabled(true);
+       about_text->set_scroll_active(false);

That doesn't fix the style box, but it makes it selectable:
some_selection

@KoBeWi
Copy link
Member

KoBeWi commented Jan 20, 2020

That doesn't fix the style box, but it makes it selectable:

You could probably add an override for the stylebox to make it invisible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants