Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDockWidget and QML
Forum Updated to NodeBB v4.3 + New Features

QDockWidget and QML

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 4.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ixSci
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ixSci
      wrote on last edited by
      #2

      Created "suggestion":http://qt-project.org/forums/viewthread/16116/

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved