Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Having problerm with QTextBlock::isVisible in QTextEdit
Forum Updated to NodeBB v4.3 + New Features

Having problerm with QTextBlock::isVisible in QTextEdit

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    evanxg852000
    wrote on last edited by
    #1

    I am writing a simple editor with a line number panel
    I want to get the first visible block using this snipet in a slot that is connect to update when the text change and blockCount changed
    @
    QTextBlock block=this->TextEditor->document()->begin()
    int total_line=this->TextEditor->document()->blockCount();
    int line_ctr=0;
    while(line_ctr<=total_line){
    line_ctr++;
    if(block.isVisible()){
    first_visible_line=block.blockNumber();
    break;
    }
    block=this->TextEditor->document()->findBlockByNumber(line_ctr);
    }@
    but no matter how first_visible_line is always 1 so block.isVisible() return always true .

    I want to keep QTextEdit because I will be adding syntaxe coloring using QSyntaxHil..
    Otherwise there is QPlainTextEdit::firstVisibleBlock() but I am not sure if QSyntaxHilighter can work on QPlainTextEdit

    Please need help.
    Thanks in advance

    Evan-XG

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Please, don't double post your stuff.
      You already posted the same 7 hours ago with "this thread":http://developer.qt.nokia.com/forums/viewthread/8000/

      If you have additional information, add them to the previous thread.

      --> thread closed

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved