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

Thread: how to implement this MainWindow just like iTunes

  1. #1
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Question how to implement this MainWindow just like iTunes

    how to implement this MainWindow just like iTunes ?

    I mean, no caption, just put menu bar in the main window, we can resize the main window from the four directions, please see the itunes.

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    Would you care to provide more details? From what I see iTunes window has a title and is in all means a regular classical main window.

  3. #3
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    As you know, default for main window there is icon + title at the left-most, min/max/close buttons at the right-most, border lines at four directions' boder which you can resize the window.

    at the bottom of the windows title and icon there is MenuBar then Tool Bar

    But when you run the iTunes, you can see these are different.
    So could you tell me how to impelment the mainwindow like the iTunes.
    I have try to setWindowFlags( Qt::FramelessWindowHint ), but in this case I can't get
    the resize indicator at the four direction's border, at the same time all the relative system's hint menu will be lost.
    Attached Images Attached Images

  4. #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: how to implement this MainWindow just like iTunes

    Isnt this I tunes like a custom shaped widget ??
    With menus drawn with transparent background ?? and close/maximize/minimize buttons custom made ??

    hope am not wrong

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    Quote Originally Posted by aamer4yu View Post
    Isnt this I tunes like a custom shaped widget ??
    With menus drawn with transparent background ?? and close/maximize/minimize buttons custom made ??
    This is my impression as well...

  6. #6
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    yes I can customise the titlebar, but there are still two problems,
    1. how can I show system context menus for eg min/max/ restore/move etc. you know when applicaton at the system task bar, right-click system menu will popup, but when I use setWindowFlags(Qt::FramelessWindowHint| Qt::WindowSystemMenuHint); OS context menu is not right.

    2. after setWindowFlags(Qt::FramelessWindowHint), my application don't repsone system (window+M ) keys which should make my application minimise.

  7. #7
    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: how to implement this MainWindow just like iTunes

    1. how can I show system context menus for eg min/max/ restore/move etc. you know when applicaton at the system task bar, right-click system menu will popup, but when I use setWindowFlags(Qt::FramelessWindowHint| Qt::WindowSystemMenuHint); OS context menu is not right.
    You can catch the QWidget::contextMenuEvent() I guess. The menu you are talking about is shown on right click of title bar, and also left mouse button click near the left most area of the title bar. I dont think it shud be difficult to mimick the same

    2. after setWindowFlags(Qt::FramelessWindowHint), my application don't repsone system (window+M ) keys which should make my application minimise.
    No idea right now. Didnt try it yet

  8. #8
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    I have tried many ways, still can't implement this function, Anybody know?

  9. #9
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    I am wondering how the iTunes implement this with Qt
    1. iTunes can response system shortcut key : windows + M combined key to minimise
    2. iTunes response system context menu very well

  10. #10
    Join Date
    Jul 2008
    Posts
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to implement this MainWindow just like iTunes

    I have also been wondering how to do something like this. I want to use MainWindow, but I want to be able to draw my own titlebar, min, max, close buttons, and menus etc. All using custom graphics I made in photoshop/gimp. Is there any good tutorials/explanation about how to accomplish this?

  11. #11
    Join Date
    Apr 2006
    Location
    Denmark / Norway
    Posts
    67
    Thanks
    3
    Thanked 12 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: how to implement this MainWindow just like iTunes

    Quote Originally Posted by marf View Post
    I have also been wondering how to do something like this. I want to use MainWindow, but I want to be able to draw my own titlebar, min, max, close buttons, and menus etc. All using custom graphics I made in photoshop/gimp. Is there any good tutorials/explanation about how to accomplish this?
    2 paths to choose:
    1. Stylesheets, see Qt Style Sheets
    2. QStyle, see QStyle - creating custom styles


    As for both it's a bit try-and-learn. There are some limitations on both.

    What you can do to achieve a similar look to itunes is :
    a) set your QMainWindow borderless, use a stylesheet on the QMenuBar. create a subclassed QMenu object and create a "title-like" stylesheet for that one. When creating the menubar, add your menuitems, then add a stretch, add your logo/title, add stretch, add padding after the stretch that is the same as the menuitems before... Lot of tuning hassle and work, but in theory it should work.

    b) reimplement the drawing of a mainwindow entirely, and write it all by hand


    c) QStyle as mentioned above.

    for the windows+m issue, when using a borderless window, you might have to call: QWidget::activateWindow() on your mainwindow to get keyboard focus.

    cheers,
    Leif

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    Search the forum for "skins" or something similar. There has been a thread about a solution to completely modify the look of a window, including its title bar.

  13. #13
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    Quote Originally Posted by luf View Post
    2 paths to choose:
    1. Stylesheets, see Qt Style Sheets
    2. QStyle, see QStyle - creating custom styles


    As for both it's a bit try-and-learn. There are some limitations on both.

    What you can do to achieve a similar look to itunes is :
    a) set your QMainWindow borderless, use a stylesheet on the QMenuBar. create a subclassed QMenu object and create a "title-like" stylesheet for that one. When creating the menubar, add your menuitems, then add a stretch, add your logo/title, add stretch, add padding after the stretch that is the same as the menuitems before... Lot of tuning hassle and work, but in theory it should work.

    b) reimplement the drawing of a mainwindow entirely, and write it all by hand


    c) QStyle as mentioned above.

    for the windows+m issue, when using a borderless window, you might have to call: QWidget::activateWindow() on your mainwindow to get keyboard focus.
    ---------------------------------------------------------------------------------------


    cheers,
    Leif
    Unfortunately even if I call activateWindow(), windows+m still doesn't work.

  14. #14
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    anyone has an idea for this now??

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    What problem are you currently facing and what did you already try to solve it?

  16. #16
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    My problem is :
    set my MainWindow as frameless, then use setMask make main windows like iTunes
    but now my app can't response to Windows + M combined shortcut keys to minimize window, and system context menu can't be shown now.

    Actually I just want to get a window face which likes iTunes' and can response to system context menu and combined Windows+M shortcut keys correctly.

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    As for Windows+M, you can emulate it using a shortcut and QWidget API.

  18. #18
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    but when should I emulate this thing, I don't know when user click that keys you know

  19. #19
    Join Date
    May 2008
    Posts
    58
    Thanks
    2

    Default Re: how to implement this MainWindow just like iTunes

    still nobody how to do this?

  20. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to implement this MainWindow just like iTunes

    Have you seen QShortCut docs?

Similar Threads

  1. Replies: 1
    Last Post: 11th September 2007, 13:34
  2. What's the best way to implement a MainWindow
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 5th February 2007, 17:46

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.