Results 1 to 4 of 4

Thread: QPlainTextEdit: find first visible text block?

  1. #1
    Join Date
    Jul 2012
    Posts
    228
    Thanks
    19
    Thanked 14 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QPlainTextEdit: find first visible text block?

    I want to get the first visible textblock in the textedit. There is a function for that, but it is protected:

    http://qt-project.org/doc/qt-4.8/qpl...stVisibleBlock

    why is it protected? How do i do this?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QPlainTextEdit: find first visible text block?

    How do i do this?
    you can access it in a subclass:
    Qt Code:
    1. class MyPlainTextEdit : public QPlainTextEdit{
    2. //constructors, Q_OBJECT macro etc...
    3. //...
    4. public:
    5. QTextBlock firstBlock() const{
    6. return QPlainTextEdit::firstVisibleBlock();
    7. }
    8. };
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2012
    Posts
    228
    Thanks
    19
    Thanked 14 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPlainTextEdit: find first visible text block?

    yes, this is what i do now. thank you. But it is a little wired, why is it protected? Maybe they do not want me to use that function?

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QPlainTextEdit: find first visible text block?

    Maybe they do not want me to use that function?
    I don't think so, it is "protected" not "private" after all. They just didn't want it to be a part of the public interface, I'm not very well acquainted with text editing interfaces in Qt but I guess they had some reasons

Similar Threads

  1. QPlainTextEdit::find() highlighting
    By cic1988 in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2014, 15:21
  2. Text block centering in Qt4.4 QTextEdit
    By mla1290 in forum Qt Programming
    Replies: 3
    Last Post: 10th July 2008, 18:46
  3. Replies: 6
    Last Post: 1st July 2008, 21:34
  4. How to block the textedit'd text to be copied
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 2nd November 2007, 11:54
  5. How do I find out which widgets/canvas items are visible?
    By Tommytrojan in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 14:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.