QDockWidget and QML
-
Hi there!
I'm trying to use QML based widget as the dock widget. My QML widget has custom title and body and they are combined to just one widget.
For now I've found the only way to use it: I set it as the header and handle mouse events to correctly recognize my custom header by which it should be dragged. It works fine but I have one problem: I need to resize it. I can resize it horizontally or vertically but not in a both ways since Qt imposes the very weird constraints on the developer. You just can't resize header in a both way because it is checked in the QDockWidget code and forbid you to do so:
@void QDockWidgetLayout::setGeometry(const QRect &geometry)
{
...
int titleHeight = this->titleHeight();if (verticalTitleBar) { _titleArea = QRect(QPoint(fw, fw), QSize(titleHeight, geometry.height() - (fw * 2))); } else { _titleArea = QRect(QPoint(fw, fw), QSize(geometry.width() - (fw * 2), titleHeight)); }
}@
then I decide to move it by body and just remove the header. But Qt happily forbade to do it too! One the one hand you cant just remove header on the other hand you can't drag by anything but header. Great:
@
bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
{
...
if (event->button() != Qt::LeftButton ||
!titleArea.contains(event->pos()) || ...
return false;
}
@Could please anybody suggest something about how I can achieve the goal described above? Maybe someone has solved a similar issue?
And for the maintainers(if someone reads this forum) do we have a chance to change that behavior by providing patch? I mean will it be merged if someone change that weird behavior by allowing to resize header in a both ways? Perhaps with some flag set. -
Created "suggestion":http://qt-project.org/forums/viewthread/16116/