Results 1 to 3 of 3

Thread: Dots in complex window mask

  1. #1
    Join Date
    Jul 2010
    Location
    Moscow
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Dots in complex window mask

    Hi all!

    I need to create transparent window with non-transparent text on it. Text is changing dynamically, so I create QPixmap object for mask every time i get new text.
    When I set window mask, besides text on screen appear strange dots (attached screenshot). I saw this effect on Linux (Qt 4.6.2) and Windows (Qt 4.6.0).
    I tried to save mask as png file, and it was correct, without dots.
    Have anyone ideas how to fix it? Or is it a Qt bug?

    simplified paint event for my widget:

    Qt Code:
    1. void Widget::paintEvent(QPaintEvent *)
    2. {
    3. QPixmap mask;
    4. mask = QPixmap(800, 600);
    5. QString text[16][32];
    6. QPainter maskPainter(&mask);
    7. maskPainter.setBrush(Qt::black);
    8. maskPainter.setPen(Qt::black);
    9. maskPainter.fillRect(-1,-1, mask.width()+1, mask.height()+1, Qt::white);
    10. maskPainter.setFont(QFont("Liberation Sans", 21, QFont::Bold));
    11. for (int i = 0; i < 16; i++)
    12. {
    13. text[i][0] = "X";
    14. text[i][31] = "X";
    15. }
    16. for (int j = 0; j < 32; j++)
    17. {
    18. text[0][j] = "X";
    19. text[15][j] = "X";
    20. }
    21. for (int i = 0; i < 16; i++)
    22. {
    23. for (int j = 0; j < 32; j++)
    24. {
    25. maskPainter.drawText(800*j/32,600*i/16,800/32,600/16, Qt::AlignBottom|Qt::AlignCenter, text[i][j]);
    26. }
    27. }
    28. resize(mask.width(), mask.height());
    29. clearMask();
    30. setMask(mask);
    31. }
    To copy to clipboard, switch view to plain text mode 

    Thanks.
    Attached Images Attached Images
    Last edited by HapKoM; 9th July 2010 at 08:45.

  2. #2
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dots in complex window mask

    Does your window have a QSizeGrip by default, or you added one maybe ? It really looks like a sizeGrip

  3. #3
    Join Date
    Jul 2010
    Location
    Moscow
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dots in complex window mask

    I solved this problem by using QBitmap instead of QPixmap It works correct now.

Similar Threads

  1. Replies: 2
    Last Post: 6th July 2010, 14:21
  2. Replies: 0
    Last Post: 13th April 2010, 19:27
  3. PDF export of Dots: bugs?
    By giusepped in forum Qwt
    Replies: 1
    Last Post: 14th June 2009, 14:52
  4. complex calculations with qt
    By gt.beta2 in forum Newbie
    Replies: 5
    Last Post: 7th February 2009, 23:55
  5. How to make three dots?
    By y.shan in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2008, 10:29

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.