Results 1 to 20 of 25

Thread: Skinned dialogs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Skinned dialogs

    Hi all,
    probably my question is very platform dependent but I'd like to know how can I have a skinned frame for my dialogs, just like Microsoft Messenger.
    Thanks for any tips on that
    Bye

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    This is not platform specific - try to subclass QStyle. The style example shows how to implement norwegian wood, try starting from that.

  3. #3
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    thanks, I already use QStyle for customize widgets but I guess there's no way to customize application frame.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

  5. #5
    Join Date
    Aug 2006
    Posts
    83

    Default Re: Skinned dialogs

    There is a way. U have to use native support and in there draw primitive element PE_CustomBase and than in drawPrimitive draw anything on it.

  6. #6
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    thanks for answering, this sounds very interesting to me, but I cannot figure it out how to do that.
    One way could be to draw my window frameless and the draw by myself the window caption, but maybe there's a better way to do that
    thanks,
    bye

  7. #7
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Skinned dialogs

    One way could be to draw my window frameless and the draw by myself the window caption, but maybe there's a better way to do that
    This is how microsoft does it. (Windows media player, Live messenger, Office 12, etc). So still a dirty hack, but now endorsed by microsoft!

  8. #8
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    Thanks for your answer, I'll try to do that. However I thought there someone had already tried to have such kind of dialogs in Qt.
    Bye

  9. #9
    Join Date
    Feb 2007
    Posts
    28
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Skinned dialogs

    Hi, Did you find a solution, im trying to do the same thing, with resizing support?
    Any example that i could find to do this?

  10. #10
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Skinned dialogs

    Making your dialogs frameless, then drawing your own frame, is the best way. I have never done this directly, but I have done similar things writing an X11 window manager. Here's a brief overview:

    1) Create a widget called WindowFrame
    2) Give it a 3x3 grid layout
    3) Put your dialog in the center
    4) In WindowFrame:aintEvent(), draw corner pixmaps in the corner, and tilable edge pixmaps on the edges
    5) To make it resizable, implement mousePressEvent() and mouseMoveEvent()

    The inclusion of titlebar and title buttons I leave an an exercise to the reader.

  11. #11
    Join Date
    Feb 2007
    Posts
    28
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Skinned dialogs

    Hi, Thanks for the suggestions. I did what you say and it work.
    The only problem that i had now is clipping the transparent part of the borders, so its actually round, and not black(it show transparent color as black)
    I read that i can accomplish this with a mask, but i don't know how to add a mask to the widget, just to the particular corners.
    All the different borders are separate images, and i have to join them some how, and then apply the mask to the widget
    Any help with this???
    thanks in advance!
    CJC

  12. #12
    Join Date
    Feb 2007
    Posts
    28
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Skinned dialogs

    HI, i kind of fix my issue.
    I should use .geometry and not frameRect()
    Thanks for all the help
    CJC

  13. #13
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    could anyone post the code for resizing the frameless widget?
    i tried this, but till today i've no idea how to implement this by myself...

  14. #14
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Skinned dialogs

    Quote Originally Posted by kernel_panic View Post
    could anyone post the code for resizing the frameless widget?
    i tried this, but till today i've no idea how to implement this by myself...
    How about QSizeGrip?
    J-P Nurmi

  15. #15
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    thanks
    one question: with qsizegrip ic can only resize to bottom-left, how can i let it resize to left or right or bottom only?

  16. #16
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Skinned dialogs

    Quote Originally Posted by kernel_panic View Post
    one question: with qsizegrip ic can only resize to bottom-left, how can i let it resize to left or right or bottom only?
    One can place QSizeGrip to any corner and it will automatically adjust its behavior. For horizontal and vertical resize mode you will need something custom:
    1. catch the point of mouse press event
    2. resize the window on the fly in mouse move event
    I suggest taking a sneak into QSizeGrip sources for more detailed implementation hints.
    J-P Nurmi

  17. The following user says thank you to jpn for this useful post:

    kernel_panic (25th June 2007)

  18. #17
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    i've made up two Skin-Classes (QSkinWidget and QSkinMainWindow) with the behavior like real widgets and windows (moving, resizing, title...) I will put them into the "Software Sektion". Thanks for all help.

  19. #18
    Join Date
    Feb 2007
    Posts
    28
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Skinned dialogs

    Hi, Is there a way to acomplish this with style sheets?
    I have my frameless widget, now, is there a way to make its border round using style sheets?
    Any help will me much appreciated
    Thanks
    CJC

  20. #19
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Skinned dialogs

    Not with style sheets. Better create a custom style for this, but you will have to do the drawing.

    Another, way simpler solution is to create a QRegion and apply it as a mask on the dialog. But this will affect the children too( everything that passes outside the bounds will get cut ).

    regards

  21. #20
    Nabeel Guest

    Default Re: Skinned dialogs

    Hi, This post of mine is very beneficial and informative, however there are some specific facts or information that I require. If anyone can help me in this matter then please send me a private message. Best Regards,

Similar Threads

  1. Using special characters in QT dialogs
    By hvengel in forum Qt Tools
    Replies: 2
    Last Post: 10th April 2007, 00:32
  2. How to chain dialogs
    By seneca in forum Qt Programming
    Replies: 12
    Last Post: 14th January 2006, 22:04

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.