Results 1 to 19 of 19

Thread: Blink Text in QTextEdit

  1. #1
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Blink Text in QTextEdit

    I'm working with Qt 4.6 on Ubuntu platform. I'm not able make text blink in QTextEdit/QLabel. I tried using a timer and signal-slot connection. It works fine. But, is there any other method through which I would be able to achieve this? Could someone help me with this?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Blink Text in QTextEdit

    Blinking text! The early 90s called and want their blinking text back.
    I tried using a timer and signal-slot connection. It works fine.
    So, you have a solution, but I cannot think of anything more annoying (in a UI) than trying to edit text that is blinking. There is no setBlinkingText() function if that is what you are looking for.

  3. #3
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Thanks Chris! But, I wont be editing the text. I'm just using the QTextEdit class to display the text. So, would you recommend the timer-signal-slot method as the apt solution?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Blink Text in QTextEdit

    Yes, subclass QTextEdit/QLabel and give your subclass a setFlashRate() and set a timer based on that (zero might be don't flash) or similar and you should be good to go.

  5. #5
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Blink Text in QTextEdit

    hi,
    Thanks Chris! But, I wont be editing the text. I'm just using the QTextEdit class to display the text.
    Then you can use QLabel instead of using QTextEdit.

    Yes timer is the simple way to implement blink

    hope it helps,
    bala

  6. #6
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    52
    Thanks
    8
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Blink Text in QTextEdit

    hi chris i am unable to find setflashrate() in Qlabel/QtextEdit i am using qt-4.8.2 if it is possible to scroll text in Qlabel plz update us .....

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Blink Text in QTextEdit

    Quote Originally Posted by pradeepreddyg95 View Post
    hi chris i am unable to find setflashrate() in Qlabel/QtextEdit i am using qt-4.8.2 if it is possible to scroll text in Qlabel plz update us .....
    This is a method one is supposed to implement first.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Thanks Bala

  9. #9
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Hi Chris... The blink feature works fine for me. But, the characters occupy varying number of pixels. This makes the blink imperfect. Is there any way to set the pixel size uniformly for all the characters (including a blank space). I tried setPixelSize under QFont class... but I don't get the expected result. Could you please help me with this?

  10. #10
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Blink Text in QTextEdit

    Have you tried with setCursorWidth() ?

  11. #11
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Yes I have tried it. But that changes only the width of the cursor. I want to set the pixel width for the characters.

  12. #12
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Blink Text in QTextEdit


  13. #13
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Thanks Gokul. QFontMetrics class has options only to read the properties of the font. It seems there is no way to set the font properties using this class.

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Blink Text in QTextEdit

    Quote Originally Posted by Vaishnavi View Post
    Hi Chris... The blink feature works fine for me. But, the characters occupy varying number of pixels. This makes the blink imperfect. Is there any way to set the pixel size uniformly for all the characters (including a blank space). I tried setPixelSize under QFont class... but I don't get the expected result. Could you please help me with this?
    Use a fixed width font (e.g. Courier) instead of a proportional one (e.g. Arial).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    Thanks. I have tried this. It doesn't work yet

  16. #16
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Blink Text in QTextEdit

    Hi Chris... The blink feature works fine for me. But, the characters occupy varying number of pixels. This makes the blink imperfect.
    By blink you mean alternating draw text, don't draw text. How does font size have anything to do with this?

  17. #17
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    My requirement is as mentioned below.
    I have a string : "Welcome Good Morning".
    I want only the word "Good" to keep blinking. I'm successful in achieving this. I have done some string manipulations for this.
    While making the text to blink, the word "Good" appears and disappears alternatively. When it disappears, the 4 characters(G,o,o,d) are replaced by 4 blank spaces. In this case, the no.of pixels occupied by a blank space and the no. of pixels occupied by other characters do not seem to match. Hence the appearance is not as expected. The text appears to be moving while blinking. I would like to resolve this issue. I believe this could be resolved if the pixel size for all the characters is set to the same value. I request your help to obtain an appropriate solution.

  18. #18
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Blink Text in QTextEdit

    as already mentioned, using a fixed-space font should resolve that issue.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  19. #19
    Join Date
    Sep 2012
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Blink Text in QTextEdit

    I tried Courier. But it doesn't impose much effect.


    Added after 9 minutes:


    I tried again. Courier works fine. Thanks to all
    Last edited by Vaishnavi; 22nd November 2012 at 09:26.

Similar Threads

  1. how to get the text from QTextEdit
    By qt_user in forum Qt Programming
    Replies: 5
    Last Post: 22nd August 2011, 00:22
  2. How to make an object blink in Qt?
    By thirupathiuppu007 in forum Qt Programming
    Replies: 2
    Last Post: 22nd February 2008, 10:30
  3. QTextEdit + paste rich text as plain text only
    By Yong in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2008, 16:45
  4. QTextEdit -> add Text
    By ape in forum Newbie
    Replies: 16
    Last Post: 19th December 2007, 14:59
  5. Window Blink/Flash
    By VireX in forum Newbie
    Replies: 21
    Last Post: 16th April 2007, 11:17

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
  •  
Qt is a trademark of The Qt Company.