tags:

views:

457

answers:

5
+1  Q: 

Qt Custom Window

Hi,

Pardon me, I am a newbie :)

Is it possible in Qt to create a custom window without borders but still draggable without holding down the Alt Key? I created a borderless window but in order to be able to drag it (on Linux) you have to hold down the alt key.

I was planning to create a window with rounded corners. Any one have any idea how to make this possible? Although, I think implementing the mouseMove, mousePress or something is a possible solution but I need some other solution.

Thanks

+5  A: 

There is just one way to make the window manager move the window: Add a drag bar. If there is no drag bar, then your app must move the window itself by setting the new position (i.e. you must handle the mouse click+move events yourself).

The feature to move the window by pressing Alt is also a function of your window manager, not Qt.

Aaron Digulla
See the Shaped Clock example: http://doc.trolltech.com/4.5/widgets-shapedclock.html
Caleb Huitt - cjhuitt
@cjhuitt: That should be an answer!
Aaron Digulla
@Aaron: Solved my problem. Thanks@Cabel Huitt: The Shaped Clock example was very helpful. Thanks
Dawking
+2  A: 

Yes, there is a rounded window example somewhere using a clock which does this. Basically, you need to manage the mouse clicks yourself as Aaron says.

cheez
A: 

Qt has no weaknesses, it can do ANYTHING, and what you are proposing is a piece of cake. Detect that the mouse is held down on your window, then grab the events for the mouse moving around so you can move your window in sync with it. When user releases mouse button your task is over.

So, that deserved a -2 rating? Goodness, I should of just kept my mouth shut.

Vance Tower
Stackoverflow seems to prefer a neutral way of speaking :)
Magnus Hoff
A: 

Thanks guys for the replies. The shaped-clock example was really helpful

Dawking
Welcome to Stackoverflow :) The answers are sorted by votes, so the way we reply like this is either to edit your question and add it there, or add it as a comment to the answer that helped you. In any event, you should upvote helpful answers and mark an answer as accepted (the green check-mark) if it answers your question.
Magnus Hoff
A: 

It's just because you're talking like a boss. "piece of cake" for you but maybe everybody, haven't the same level ? ;) before to be a good programmer you was a niewbie like dawking, so please be nice, and try to give a response much clear as possible. And if you read again, he says that he's aware about the window's moving, so... you're response is a little useless. But thank you to reply ;)

zaeeea