Hello,
I use a QTextEdit to display some texts, setting it to ReadOnly, but I want the texts cannot be selected, just like QLabel. As well, there should be scrollbar when the dlg is too small.
I am a beginner in qt4, PLZ help me.
thanks~~~
![]()
Hello,
I use a QTextEdit to display some texts, setting it to ReadOnly, but I want the texts cannot be selected, just like QLabel. As well, there should be scrollbar when the dlg is too small.
I am a beginner in qt4, PLZ help me.
thanks~~~
![]()
Last edited by chendy; 31st March 2009 at 16:04.
Have a look at the TextInteractionFlags of QTextEdit: http://doc.trolltech.com/4.5/qtexted...tionFlags-prop
A vertical scrollbar is added automatically when the text is higher than the height of the QTextEdit.
If you want a horizontal scrollbar you have to configure the LineWrapMode: http://doc.trolltech.com/4.5/qtexted...eWrapMode-prop
chendy (1st April 2009)
and you can customize ScrollBarPolicy like this:
and that code gives you always visible scrollbar.Qt Code:
te->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);To copy to clipboard, switch view to plain text mode
Another thing is that you can put QLabel in QScrollArea if you want to have just a QLabel functionality (look at screenshot - left is QTextEdit, right is QScrollArea with QLabel inside)
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
chendy (1st April 2009)
Bookmarks