How to disable text entry
-
I have a small issue with my C++ code .
My base class is QTextEdit - to that class I add QWidget - user access to application.
Works as desired.The "problem" is - the added widget DOES NOT fully covers the underlying "add text feature " to the original display.
The user can enter any text into the form at any point.I would like to disable the "flashing " | mark thus disable the random position text entry marker at the same time.
I cannot simply remove the "newFile" code - it is used to keep track of the MDI subwindows.
Addy reasonable suggestion how to do this - disable the text entry - would be appreciated
//orignal createMdiChild MdiChild *child = createMdiChild(); //QTextEdit child->setLayout(new QVBoxLayout); DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(); // insert widget child->layout()->addWidget(DDD); child->newFile(); // create child as file - need file name child->show(); // show added widget and original child
-
@AnneRanch said in How to disable text entry:
MdiChild *child = createMdiChild(); //QTextEdit
https://doc.qt.io/qt-5/qtextedit.html#readOnly-prop
Is this what you are looking for?
Edit:
I read it a few times. Not getting what you need. Would a picture help? -
Here is a screenshot with no text entries , but the flashing "|" symbol - upper left corner - is where text can be added
Here is after "k" was pressed for a while
Obviously goofy thing to let user do.
Which object can I make "read only"?
There may be an occasion to have "plain" child submenu , no widget added, so adding text would be OK.
Hence it should be controlled outside child class.
-
As simple as this
child->setReadOnly(true);Thanks for resolving the problem.