Results 1 to 10 of 10

Thread: transparency, setMask, createHeuristicMask, createMaskFromColor, QPixmap

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default transparency, setMask, createHeuristicMask, createMaskFromColor, QPixmap

    Hi all,
    I know there's a lot of stuff on transparency, but I haven't quite found what I'm looking for.

    I've a QLabel. I'd like the baskground to be transparent - that is, it should appear as text 'on the desktop'

    this is what I'm doing:
    Qt Code:
    1. LabelBase(QWidget *parent): QLabel(parent)
    2. {
    3. QPalette p(palette());//get the widget's default palette
    4. p.setColor ( QPalette::WindowText, Qt::darkGreen );
    5. setPalette(p);
    6. }
    7. void LabelBase::update (const QString text)
    8. {
    9. setText(text);
    10. QWidget::setFixedSize(QLabel::sizeHint());
    11.  
    12. QPixmap pixmap = QPixmap::grabWidget ( this );
    13. setPixmap(pixmap);
    14. theMask = pixmap.createHeuristicMask(false);
    15. //theMask = createMaskFromColor(Qt::darkGreen);
    16. setMask(theMask);
    17. }
    To copy to clipboard, switch view to plain text mode 
    (theMask, above, is a QRegion)
    The problem that I can't seem to make a good mask from the text. createHeuristicMask() leaves unmasked 'holes' in the text (the character 'o' is filled, for instance), and createMaskFromColor() doesn't seem to do anything for me. examples are attached.

    So, the question, how can I best make a mask for my text.

    thanks
    K
    Attached Images Attached Images

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.