Frage

I have class which inherits QTabWidget. Inside the generated tab I want to display some text.The text should not be editable by the user.But during the application execution there can be a case/s which will cause the text change. Which class should I use for text? Thought about QTextEdit - but it doesn`t look like best idea - since the user should not change the text.Also thought about QLabel - but it also is not good - since the application displays text not label.

War es hilfreich?

Lösung

QTextEdit can be set to read-only with its property readOnly. I use QTextEdit to display a long read-only text, because it can scroll. I also have read-write text, and by choosing the same widget for all long text, my user interface looks even.

http://qt-project.org/doc/qt-4.8/qtextedit.html#readOnly-prop

An other alternative is QWebView if you plan to have complexly formatted text.

http://qt-project.org/doc/qt-4.8/qwebview.html

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top