Results 1 to 2 of 2

Thread: grab() QTextEdit is different between linux and windows

  1. #1
    Join Date
    May 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question grab() QTextEdit is different between linux and windows

    I've changed the background color of QTextEdit throught setStyleSheet().
    Qt Code:
    1. QTextEdit tempEdit;
    2. tempEdit.setStyleSheet( "background-color:black;" );
    To copy to clipboard, switch view to plain text mode 

    and render()
    Qt Code:
    1. QPixmap resultPixmap( QSize(640, 480) );
    2. tempEdit.render(&resultPixmap);
    To copy to clipboard, switch view to plain text mode 
    or grab()
    Qt Code:
    1. tempEdit.grab().save("temp.png");
    To copy to clipboard, switch view to plain text mode 

    It worked perfectly at Ubuntu 18. (temp.png was saved just the way it looked)
    But background color was NOT changed at windows 10. It keeps white background. never changed.

    setPalette() is not what I want. I want change the currently looking style of QTextEdit.

    Can I get an advice?
    ---
    QT version is 5.12.0
    Last edited by world.kang; 7th May 2019 at 11:06.

  2. #2
    Join Date
    May 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: grab() QTextEdit is different between linux and windows

    Resolved myself.
    At ubuntu it's ok to to with before.
    Qt Code:
    1. tempEdit.grab().save("temp.png");
    To copy to clipboard, switch view to plain text mode 
    But at windows grab should be done from viewport
    Qt Code:
    1. tempEdit.viewport()->grab().save("temp.png");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 0
    Last Post: 16th January 2018, 17:14
  2. Deployment Procedure On Windows On Linux and Windows
    By Harshith J.V. in forum Installation and Deployment
    Replies: 4
    Last Post: 9th July 2009, 12:27
  3. Grab keyboard events in Windows
    By durbrak in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 20:56
  4. QTextEdit hasFocus() not working on linux
    By vermarajeev in forum Qt Programming
    Replies: 13
    Last Post: 28th December 2006, 12:05
  5. Replies: 4
    Last Post: 10th May 2006, 23:37

Tags for this Thread

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.