Dialog is visible only above parent widget

  • I have some application with custom window frames. It was achived by using some default template BaseWindow witch sets Qt::FramelessWindowHint and handels move, resize e.t.c. here its code http://pastebin.com/1Uzqmgaw
    I have two windows witch inherets this class. First one is main window inhereted from BaseWindow<QWidget>, second one is a dialog(for example settings dialog) inhereted from BaseWindow<QDialog>
    The problem:
    If in ctor of BaseWindow class i use parent class initilizer i.e

    template <class T>
    BaseWindow<T>::BaseWindow(TitleMode titleMode, ResizeMode resizeMode, QWidget* parent) : T(parent)

    than dialog is visible only above parent.
    Can any one explain why this happend?
    I'm using Qt 4.8. Windows.

  • My comment might not be a reason it does not work for you, but every QObject derived class require Q_OBJECT macro at least if you have any signal/slot defined in it.
    I never tried to write template with such macro and believe it is not supported and will be not handled properly by mocing.
    It might be possible manually create required code instead, but I doubt this solution will be portable.

    In other words my impression is templates are no-no with QObject derived classes.

Log in to reply

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