Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [SOLVED] QDockWidget missing title text

    General and Desktop
    2
    3
    1280
    Loading More Posts
    • 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.
    • X
      xcoder 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

      Only a biker knows why a dog sticks his head out of a car window.

      1 Reply Last reply Reply Quote 0
      • T
        tobias.hunger 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.

        1 Reply Last reply Reply Quote 0
        • X
          xcoder 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.

          Only a biker knows why a dog sticks his head out of a car window.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post