Thanks! I already had the derived class, so the extension was easy…
Scott From: Interest [mailto:[email protected]] On Behalf Of Thompson, Adam B. Sent: Saturday, September 10, 2016 7:44 AM To: [email protected] Subject: Re: [Interest] QPlainTextEdit insert spaces vs tabs Scott, I’ve needed to address this issue before, myself. My solution was to subclass QPlainTextEdit and override QPlainTextEdit::keyPressEvent. In it, if QKeyEvent::key matches Qt::Key_Tab, I insert the desired number of spaces in place of a tab and accept the event (QEvent::accept). If you don’t want to subclass QPlainTextEdit, I believe you should be able to create an object to install as an event filter on the editor. In it, you would compare the QEvent::type to QEvent::KeyPress and handle the logic in a similar fashion. That’s based on my limited Qt experience, so take that with a grain of salt. I hope that helps. Adam Thompson Computer Scientist, Nuclear Engineering Oak Ridge National Laboratory +1.865.241.8062 From: Interest <[email protected]<mailto:[email protected]>> on behalf of Scott Aron Bloom <[email protected]<mailto:[email protected]>> Date: Friday, September 9, 2016 at 12:11 PM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [Interest] QPlainTextEdit insert spaces vs tabs I have a request that has come in from a customer, and for the life of me I cant find the option. The customer would like to be able to insert spaces rather than tabs when editing a document, the editor has been implemented using QPlainTextEdit. I can change the tabstop, and have looked through the QTextDocument options as well… Any ideas? Scott
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
