thnks karan i understood the concept but if i used Qt::FramelessWindowHint i cant move the widget ... if possible can you post few lines of code for better understanding ..
thnks karan i understood the concept but if i used Qt::FramelessWindowHint i cant move the widget ... if possible can you post few lines of code for better understanding ..
try this sample code
Qt Code:
... ... { if (event->buttons() & Qt::LeftButton) { move(event->globalPos() - m_dragPosition); event->accept(); } } { if (event->button() == Qt::LeftButton) { m_dragPosition = event->globalPos() - frameGeometry().topLeft(); event->accept(); } } ... ...To copy to clipboard, switch view to plain text mode
Hope this will help you..
CHEERS
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
pradeepreddyg95 (19th August 2013)
karankumar1609, thanks for such a detailed response.
I came across this thread wondering if there was any way to do it while still keeping the underlying platform's window decoration style. Any idea if that's possible?
And just dumping this related Qt feature/idea here for lack of a better place: We could add QWidget::addTitleBarWidget(QWidget* w, Position p = RightOfWindowTitle, Alignment a = Right) and then when m_TitleBarWidgets size goes from 0 to 1 then we setup the Qt::FramelessWindowHint, window moving, and listening to windowTitleChanged like karankumar1609 described; then, when m_TitleBarWidgets size goes back to 0 then undo those changes. But without being able to keep the underlying platform's window decoration style, this change/feature might be rejected![]()
And how to make it so that when you move the window, it decreases? And how do I make it so that only the one button gets caught when I hold the left mouse button from above, and not around the widget?
Bookmarks