Results 1 to 17 of 17

Thread: Paint Windows Frames

  1. #1
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Paint Windows Frames

    Hi all. I want to draw my own window frames, as it done in winamp, for example.

    I saw documentation for QGraphicsWidget, but I got some problems. First, my window is invisible - may be I should set some WindowFlags in constructor? And the second, setupUI method takes QWidget - so I cannot use QDesigner.

    I didnt find something like paintWindowFrame in QWidget.
    Is it possible to use QGraphicsProxyWidget here? Can anyone give me a link, how to use it for drawing QWidget's frame?

    I can do
    Qt Code:
    1. Qt::WindowFlags flags = this->windowFlags();
    2. flags |= Qt::SplashScreen;
    3. this->setWindowFlags(flags);
    To copy to clipboard, switch view to plain text mode 
    And then draw window borders myself. But in such way, it is nessesary to process all events as move, resize (8 cases!) and so on manually. Is it not complicated, but needs lot of code.

  2. #2
    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: Paint Windows Frames

    It's not possible to paint window decrations using Qt. All you can do is to get rid of the system decorations and emulate all of 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.


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

    Iskander (2nd September 2009)

  4. #3
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    wysota, thank you.

  5. #4
    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: Paint Windows Frames

    May be this QSkinObject example help you

  6. #5
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    aamer4yu, thanks, I'll look at it.

  7. #6
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    aamer4yu, I tried to use qskinobject, but when I enable skins in example, widgets start blinking.

    I almost finished emulation of moving and resizig, but when Qt::SplashScreen flag, there is no application on a task bar. How to remove system windows decorations, and save precense on a task bar?
    Last edited by Iskander; 3rd September 2009 at 14:23.

  8. #7
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: Paint Windows Frames

    You can inherit from QDialog and overload the paint method.

    Best Regards
    NoRulez

  9. #8
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    Quote Originally Posted by NoRulez View Post
    You can inherit from QDialog and overload the paint method.

    Best Regards
    NoRulez
    Of course I inherits from QWidget and all my windows inherts from my "skinned widget". But in paint method it is impossible to draw system windows borders.

  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: Paint Windows Frames

    Quote Originally Posted by Iskander View Post
    But in paint method it is impossible to draw system windows borders.
    Didn't I tell you that like... 7 posts ago? They are called "system borders" for a reason. All you can do is disable them by passing Qt::FramelessWindowHint hint to your widget.
    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
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    Quote Originally Posted by wysota View Post
    Didn't I tell you that like... 7 posts ago?
    yes, my previos post was answer for NoRulez.
    Quote Originally Posted by wysota View Post
    They are called "system borders" for a reason.
    ok
    Quote Originally Posted by wysota View Post
    All you can do is disable them by passing Qt::FramelessWindowHint hint to your widget.
    Yes, I've done it in 0 post. How to stay on a task bar, while setting the flag?

  12. #11
    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: Paint Windows Frames

    Quote Originally Posted by Iskander View Post
    How to stay on a task bar, while setting the flag?
    You can't. At least not without diving into native API although I think in this particular case it wouldn't help.
    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.


  13. #12
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default

    Quote Originally Posted by wysota View Post
    You can't. At least not without diving into native API although I think in this particular case it wouldn't help.
    So should I do something like this?
    Qt Code:
    1. #if defined(Q_WS_WIN)
    2. ....
    3. #endif
    4.  
    5. #if defined(Q_WS_X11)
    6. ....
    7. #endif
    To copy to clipboard, switch view to plain text mode 
    sadly.

    And, as I understand, under linux behaviour depends from current DE settings...

    May be it is possible to use QDesktopServices, do you know?

    Well, I think about creating a widget out of display region, and in focusInEvent make my "skinned" widget focused, but I think, it's too dirty hack...
    Last edited by wysota; 4th September 2009 at 09:34.

  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: Paint Windows Frames

    What would desktop services have to do with that? What is exactly that you want to obtain?
    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. #14
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    Sorry for my english.

    I want to use my own systems borders(1). So I set Qt::FramelessWindowHint flag.
    But there is no my apllication on the task panel in that way.(2)
    I want something like winamp - but skin systems does not requiered.


    I read QDesktopServices docs, and not found anything, relative to my problem, it serves for desctop enviroment, not for task bar, so sorry for my question

  16. #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: Paint Windows Frames

    Try searching for a solution in WinAPI docs but I doubt you will be able to get the taskbar entry back after disabling system borders. You can try something else though... Don't disable the borders but instead mask them out using QWidget::setMask(). You should not lose the taskbar entry then but the borders wouldn't be visible and you could provide your own ones inside the client area.
    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.


  17. #16
    Join Date
    Aug 2009
    Location
    Almaty, Kazakhstan
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint Windows Frames

    wysota, thank you! setMask(rect()) works fine!

  18. #17
    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: Paint Windows Frames

    Quote Originally Posted by Iskander View Post
    wysota, thank you! setMask(rect()) works fine!
    Just note that things such as maximizing the window will probably work incorrectly.
    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.


Similar Threads

  1. Qt Jambi, deploying app on Mac & Windows fails
    By ChrisColon in forum Installation and Deployment
    Replies: 2
    Last Post: 16th February 2009, 22:05
  2. Replies: 5
    Last Post: 15th January 2009, 09:03
  3. Opening text file fails after autostartup on windows
    By yogourta in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2008, 03:52
  4. Windows not appearing in XP.
    By beardybloke in forum Qt Programming
    Replies: 7
    Last Post: 24th October 2007, 17:32
  5. Qt and windows vista
    By munna in forum General Discussion
    Replies: 8
    Last Post: 11th January 2006, 22:33

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.