Reputation: 804
I for the life of me can't figure out how to do this.
I have two QPlainTextEdits, with word wrapping off.
I fill one using myTextEdit->document()->setPlainText(myText);
Now myTextEdit has a horizontal scroll bar.
Now I want my other textEdit to be able to scroll the exact same amount as myTextEdit, despite how many words are in it. How can i set the width within the scroll area of my other text edit to match that of myTextEdit?
I want the document widths to be the same, but myTextEdit->document()->size() has been of no use. Can anyone help?
Upvotes: 2
Views: 902
Reputation: 2214
Assuming you already have a function (SLOT?) called when first text edit is changed:
myOtherTextEdit->horizontalScrollBar()->setMaximum(myFirstTextEdit->horizontalScrollBar()->maximum());
Upvotes: 1
Reputation:
Have you tried using signal and slots to link the widget sizes with setFixedSize()?
Upvotes: 0