Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

TaurusForm width cannot be reduced if displaying a long text (trimming not triggered) #1142

Open
cpascual opened this issue Aug 13, 2020 · 2 comments

Comments

@cpascual
Copy link
Member

cpascual commented Aug 13, 2020

TaurusLabel auto-trims its text in order to accommodate long texts if the width given to the widget is small.

This can be seen when reducing the size of the label from the following snippet (it correctly trims):

from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.display import TaurusLabel
import sys

app = TaurusApplication(cmd_line_parser=None)
w = TaurusLabel()
w.setModel("eval:long='A l{}ng string'.format('o'*60);long")
w.show()
sys.exit(app.exec_())

But if the label is within a form which started with a large enough size, its trimming mechanism won't be triggered even if the user tries to resize the form.

It can be reproduced by trying to reduce the width of the following form:

from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.panel import TaurusForm
import sys

app = TaurusApplication(cmd_line_parser=None)
w = TaurusForm()
w.setModel(["eval:long='A l{}ng string'.format('o'*60);long"])
w.show()
sys.exit(app.exec_())
@cpascual
Copy link
Member Author

Note that the problem is in the TaurusForm widget, not the label one, because even if one sets the readWidgetClass to None (w[0].setReadWidgetClass(None)) after having initialized the form, this can't be downsized

@cpascual
Copy link
Member Author

On the other hand, note that if you make the text much longer (e.g. by replacing the hardcoded 60 by 600), then the form will initialize with the label already trimmed and therefore it can be resized !

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

No branches or pull requests

1 participant