[SOLVED] QDockWidget missing title text
-
wrote on 29 Nov 2012, 11:52 last edited by
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:
!http://morf.lv/modules/zlTeam/images/missing_title.png!And here have it should look, and it does if I don't extend it:
!http://morf.lv/modules/zlTeam/images/original_title.png!My header file:
@#ifndef XTOOLWIDGET_H
#define XTOOLWIDGET_H#include <QDockWidget>
#include <QEvent>
#include <QDebug>
#include <QWidget>class XToolWidget : public QDockWidget
{
public:
explicit XToolWidget ( QWidget * parent = 0, Qt::WindowFlags flags = 0 );protected:
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";
event->accept();
}@It should have been such a simple thing to do, but I wasn't able to find why the title text is missing.
Thanks
Raivis -
wrote on 29 Nov 2012, 13:46 last edited by
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.
-
wrote on 30 Nov 2012, 15:14 last edited by
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.
1/3