[SOLVED] QDockWidget missing title text

  • Hello,

    I've been stuck for a while with a problem which doesn't make sense (at least to me)

    I tried extending QDockWidget class, to add extra functionality, and promote it in the QDesigner, my extra functions work perfectly, but when the dock widget is docked, it is missing a title, if it's floating everything appears to be fine.

    Here is have it looks with my extended class:

    And here have it should look, and it does if I don't extend it:

    My header file:
    @#ifndef XTOOLWIDGET_H
    #define XTOOLWIDGET_H

    #include <QDockWidget>
    #include <QEvent>
    #include <QDebug>
    #include <QWidget>

    class XToolWidget : public QDockWidget
    explicit XToolWidget ( QWidget * parent = 0, Qt::WindowFlags flags = 0 );

    void changeEvent(QEvent *event);


    #endif // XTOOLWIDGET_H@

    and the source file:
    @#include "xtoolwidget.h"

    XToolWidget::XToolWidget(QWidget *parent, Qt::WindowFlags flags)
    : QDockWidget(parent, flags)

    void XToolWidget::changeEvent(QEvent *event)
    qDebug() << "Something happened to the ToolWidget";

    It should have been such a simple thing to do, but I wasn't able to find why the title text is missing.


  • Moderators

    You consume all events before they ever reach your base class. So it will never get a paint event!

    Pass events on to QDockWidget and this should work.

  • Thank you!!

    Funny, this is second time I made this mistake, I had the same problem with graphics scene.

    Hopefully, this is the last time I make this mistake.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.