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. [SOLVED] QDockWidget missing title text

[SOLVED] QDockWidget missing title text

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views
  • 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 Offline
    X Offline
    xcoder
    wrote on 29 Nov 2012, 11:52 last edited by
    #1

    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
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on 29 Nov 2012, 13:46 last edited by
      #2

      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
      0
      • X Offline
        X Offline
        xcoder
        wrote on 30 Nov 2012, 15:14 last edited by
        #3

        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
        0

        1/3

        29 Nov 2012, 11:52

        • Login

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