I am a beginner and am learning C++ and QT

I would like to know how to make an interface like the one in windows media player 11 - one that is completely custom including the minimise and close icons.

What would this involve?

Dani AI

Generated

Short answer: to get a WMP11-style chrome you must replace the native window decoration and draw your own titlebar/buttons (or use platform-specific non-client hooks). was right to warn about the learning curve; take it step-by-step. and pointed in useful directions — you will need custom UI assets and Qt styling for widgets, but changing the minimize/maximize/close chrome itself requires a different approach.

A practical, incremental plan:

  • Create the artwork (button states, borders, scalable center regions).
  • Remove the native frame for your main window and paint the background yourself.
  • Add a small TitleBar widget (icon, text, three buttons) and connect those buttons to the window slots (showMinimized(), toggle maximize/restore, close()).
  • Implement mouse handling in the titlebar to drag the window, and supply resize grips (or use native hit-testing where available).

Example snippets (conceptual):

// constructor of your main widget
setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
setAttribute(Qt::WA_TranslucentBackground);
// simple titlebar drag (inside titlebar widget)
void mousePressEvent(QMouseEvent *e) { if (e->button()==Qt::LeftButton) dragOffset = e->globalPos()-window()->frameGeometry().topLeft(); }
void mouseMoveEvent(QMouseEvent *e) { if (e->buttons() & Qt::LeftButton) window()->move(e->globalPos()-dragOffset); }

Key platform caveats and tips: resizing and proper maximize behavior are the hardest parts — on Windows you can implement native hit-testing (WM_NCHITTEST) or add invisible resize handles. Per-pixel alpha and shadows behave differently across platforms; use Qt features like translucent backgrounds or SVG assets for DPI scaling, and cache pixmaps to avoid repaint cost. Start by replacing only the titlebar; once that works, extend to borders and nonrectangular shapes.

Recommended Answers

All 6 Replies

You know, it seems that introducing GUIs to the beginner programmer is a little bit like opening pandora's box. I mean, I'm not saying that in doing so we release all the evils of programming... It just seems to me that when you are new to a language or programming in general, trying to tackle advanced topics will only bring about pain and suffering (or hours of torture trying to decipher what seems like cryptic code to anyone not familiar with the language syntax and semantics, libraries, etc). My fear is that, in doing so, the new programmer loses motivation and gets turned off learning...

That said, GUIs are probably the most exciting thing to most new programmers. I don't really know what I'm accomplishing in this post, I just guess I want to stress that if your new, it might not be easy, and it might be a leap to accomplish some of the things you might be dreaming of, so just stay motivated (even if progress is slow) and you'll get there eventually...Thats my inspirational/motivational tip for the day. aha :)

Anyway, if your using windows, investigate Win32.

Uhhh, this link is a recent discussion that gets into some books and things about GUIs (scroll through the posts, I think niek and William leave some links). There are also TONS of other discussions on this forumn and the net.

Good luck

Thanks for the advice, although you didn't hint on an answer to my original question.

>you didn't hint on an answer to my original question.
It involves creating your own graphics and piecing them together manually. I'm not familiar with Qt, but it might give you the option of skinning your interface, which simplifies the piecing together part.

I do apologize. Permit me to clarify:

I am a beginner and am learning C++ and QT

I think I went on at length about how this might restrict the types of things you will be able to accomplish...until you get more experience/depending on how experienced you are. If you have never programmed before, I really do not suggest diving face-first into programming GUIs. Nail down the basic language concepts first, learn how to program, then revisit the topic.

Or you could learn VB.Net instead (I'm being facetious...) :)

I would like to know how to make an interface like the one in windows media player 11 - one that is completely custom including the minimise and close icons.

By interface I am assuming you mean a GUI (graphical user interface) application. I mentioned above to investigate Win32 if you are using a windows platform. This will be a starting point for windowed applications (btw the minimize and close icons are standard). I also gave you a link to a discussion where there have been other posts on a similar topic. While your at it, if you actually do learn Win32, I might suggest investigating DirectX or OpenGL...(thats another story for another time). Again, I just want to stress that these topics may seem a little bit foreign if you are a complete beginner, so my humble suggestion would be to build a solid foundation in the language before trying to tackle them...But that's just my opinion and advice; don't let me hold you back.

Now, specifically dealing with music entails myriad other topics to investigate...but I don't think this was what you were getting at? If so, then I must have completely missed the point of your post.

On a side note, there is a sticky thread dedicated to referencing C++ books at the top of this forumn...

What would this involve?

time, practice, problem solving, probably a little bit of math, and an understanding of C++. Some knowledge of computer programming in general might be helpful/interesting as well.

EDIT: Please forgive me, but did I complete misinterpret your question??

No, that answered it pretty well, thanks.

>btw the minimize and close icons are standard

They seem to be in a completely different style to the other ones on windows xp, but I believe they mimic the vista styling

I am interested in "skinning the interface". I have tried googling it but have found nothing useful. Could anyone suggesting anything?

Thanks,

xtr.eme

I think I may have exactly the cure for what ails ya'. If you're using QT, QT offers an excellent feature called QT Style Sheets. They're basically like CSS style sheets for QT Widgets. Check this out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.