Results 1 to 20 of 28

Thread: how to implement this MainWindow just like iTunes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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
    Aug 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to implement this MainWindow just like iTunes

    Do you mean that you want to make the caption unified to the tool bar? Please try to use setUnifiedTitleAndToolBarOnMac(true) in your main window. Hope this can help.

  13. #13
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to implement this MainWindow just like iTunes

    setWindowFlags(Qt::FramelessWindowHint| Qt::WindowSystemMenuHint);
    Before version 4.4.0 this code has worked as I espected, it created a frameless window but with titlebar menu and all the combinations like ctrl+m has been working good.
    Now sinse Qt 4.4.0 when the flag Qt::WindowSystemMenuHint is put the system frame of the window is back and without it you will not have the title bar menu and the shortcuts. Nasty uh...

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.