Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: Intense Masking....

  1. #1
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Lightbulb Intense Masking....

    IS there a way I can set masks for each QListView icon and text? So I'll have floating icons on the screen when set to Icon mode. Is there a way to get each icons x & y, width & heigth? Then mask them each time QListView is resized or the icon is moved? Thanks for the info!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Intense Masking....

    Please can you specify or quickly draw a image of what you want achieve. To get the icons you have to ask your model and for the width & hight your delegate. (or QAbstractItemView::visualRect( const QModelIndex & ) etc.)

  3. The following user says thank you to Lykurg for this useful post:

    been_1990 (30th April 2009)

  4. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    This is a mock-code of what I want:
    Qt Code:
    1. for each icon in QListView
    2. get its x(), y(), width() and height()
    3.  
    4. pass it to a QRegion:
    5. QRegion maskedRegion(x(),y(),width(),height(), QRegion::Rectangle);
    6. set its Mask:
    7. setMask(maskedRegion);
    To copy to clipboard, switch view to plain text mode 

    Something similar to these aero buttons

  5. #4
    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: Intense Masking....

    Well, it didn't clarify anything to me, but QPixmap has methods for querying its width and height and you can retrieve position of each of the model indexes with QAbstractItemView::visualRect() (so you don't even need to ask for the pixmap size).
    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.


  6. #5
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    This is the app without masking:


    This is it with masking:

    Images above were edited...

    How can I use QAbstractItemView::visualRect()?
    ui->QListView->what here?

  7. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Intense Masking....

    Don't think you loading legal stuff with your eMule And on your pictures I don't see any significant difference. Only in the second the background of your list view is transparent.. Don't get your intention.

  8. #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: Intense Masking....

    Quote Originally Posted by been_1990 View Post
    This is the app without masking:
    (...)

    This is it with masking:
    (...)
    Please don't use external sites for storing images you refer to in your posts. Use the attachment feature of the forum instead.

    How can I use QAbstractItemView::visualRect()?
    Just as any other method - call it.

    ui->QListView->what here?
    Eeem.... "visualRect()" ?
    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.


  9. #8
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    My intention is just that: mask each index icon so that they stay without the background.
    I used external images because when I clicked the add-image it asked me for an url, so..
    Thanks for all the help guys.. Ill try these out as soon as I can.
    Last edited by been_1990; 29th April 2009 at 15:48.

  10. #9
    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: Intense Masking....

    What does "stay without a background" mean? Icons don't have a background, it's transparent unless you paint it yourself.
    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.


  11. #10
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    How do I get each index? ui->QListView->children()? Sorry if am asking too much, I havent found any tutorial or book that explains exactly this issue. Theres also QAbstractItemView::indexWidget ( const QModelIndex & index ) const thats seems to be related but I didnt quite understand what it does.

  12. #11
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    I mean the app background, not the QListView background or icon background.
    Last edited by been_1990; 29th April 2009 at 17:04.

  13. #12
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    In another attempt to explain what I want, here's a little illustration:


    And I even learned how to use attachment!
    Attached Images Attached Images

  14. #13
    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: Intense Masking....

    You can use QWidget::setMask() although using Qt for the thing you are trying to do is not the smartest idea. I'd use widgets, mask them, bypass the window manager and reimplement their mouse events to handle moving them around.

    Of course nothing will cause those objects to become real desktop icons so if this is what you are trying to obtain then Qt won't help you with that.
    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. The following user says thank you to wysota for this useful post:

    been_1990 (30th April 2009)

  16. #14
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    So I wont be able to use QListView or any other thing to do that... awww.. But I could count files in a folder, get their MIME info, set a widget for each file, implement some click/right-click/double-click function, then set them in an ordered manner. Would that be too much work for something easily done with something else? Probably... Oh wel... I tried.. Thanks for all the help, I'll use then a simple QListView with a boring white background... Thanks!

  17. #15
    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: Intense Masking....

    You don't have to have a boring white background. You can make the background of your listview transparent (if your system supports it) so that your desktop shines through.
    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.


  18. #16
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Intense Masking....

    Under windows you can have a look at Qt::WA_TranslucentBackground.
    It will help you achieve what you want...
    Last edited by wysota; 30th April 2009 at 09:44.

  19. #17
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    I've searched many times here in the forum and on the net, and aparently I cant apply a transparent background, only to the whole app. of course the posts were outdated, but..
    Where can I find Qt::WA_TranslucentBackground documentation? Its not in QtCreator Help. And does it really work?

    @wysota: You can make the background of your listview transparent (if your system supports it)
    Im using Win Vista. Is there any cross platform way? Thanks again.

  20. #18
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Intense Masking....

    Quote Originally Posted by been_1990 View Post
    I've searched many times here in the forum and on the net, and aparently I cant apply a transparent background, only to the whole app. of course the posts were outdated, but..
    Where can I find Qt::WA_TranslucentBackground documentation? Its not in QtCreator Help. And does it really work?
    have a look here.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  21. #19
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Intense Masking....

    Oh... Apparently thats only for QT4.5 and Im using QT4.4.3.. Lets start downloading...

  22. #20
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Intense Masking....

    yes, it's introduced in Qt 4.5.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Issue with masking QWidgets
    By JimDaniel in forum Qt Programming
    Replies: 6
    Last Post: 2nd November 2007, 19:23
  2. Masking password
    By Lebowski in forum Qt Tools
    Replies: 3
    Last Post: 14th April 2006, 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.