Skip to content

How to prevent text wrapping in QPlainTextEdit? #82

@jameshibbard

Description

@jameshibbard

I have a QPlainTextEdit on which I wish to display a random combination of letters, numbers and special characters (a password, basically).

When the text is only letters and numbers, the output runs from left to right with no breaks (as one would expect). It only wraps when it hits the edge of the QPlainTextEdit.

passOutput.setPlainText(
  'AS0dlkqVDmC5L8mKhNAmVU7Ww2j9LiCFo6k43uR6lngZ0Prr2I1xRF7Y64PF92j87V'
);

qode_001

However, if the text contains certain special characters an undesired line break is inserted. E.g.:

passOutput.setPlainText(
  '2VB#t>ZQyS.*|t`=t=AdB=s9gyNKt%Up9q:fKpL]DKB-5:g),cneAg4(bH:A9hF/cH'
);

qode_002

Notice the line break after the | character.

My question: is there any way to prevent this?

I would like the text containing the special characters to run from left to right and only wrap when the edge of the QPlainTextEdit is reached (like the example containing just letters and numbers).

I tried styling the QPlainTextEdit using word-break: break-all, but it didn't make a difference.

Looking through the QT docs, I did find this: https://doc.qt.io/qt-5/qtextoption.html#WrapMode-enum

Is something like wrap mode available in NodeGUI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions