Results 1 to 1 of 1

Thread: MVC - Abstract Widget Base Class - setupUI

  1. #1
    Join Date
    Jun 2008
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default MVC - Abstract Widget Base Class - setupUI

    Hello,

    I try to realize some kind of MVC.

    My Mainwindow offers the slider, button etc to build up a graphical model.
    Here you also can find an display area, included by an GroupBox with included layout named displayLayout.

    I want to set up the posibillity to watch the model in this displayLayout area on one hand in 2D (by including an Painter Widget or an labelWidget which shows the an 2d image) and on the other hand in 3d (area with included QGLWidget).

    When the model gets changed, i just want to say something like of "display->update()", without the need to know, if 2d or 3d mode is on or not. To do so, i set up an abstract interface base class called display. Class Display2d and Class Display3d are derived from Display. I want to include this base class by

    Display* showSomething = new Disaply(GroupBox);
    displayLayout->addWidget(showSomething);

    2d just shows an image. 3D comes with own view control, as rotate and scale sliders to interact with the GL stuff. To realize the 3d interaction, i´ve use designer to create the slider within an ui_Display3dUI.

    Now comes the problem. My clases are:

    1. (abstract) class Display : public QWidget
    2. class Display3d : public Display, private Ui:isplay3dUI, public QGLWidget
    3. 2d comes later

    In constructor Display3d() i need to set up the UI stuff, by caling
    setupUI(this);
    and get the error:
    `QWidget' is an ambiguous base of `Display3d'

    My suggestion:
    Base Display is typof QWidget,
    Display3d is typeof Display and typeof QWidget, since QGWidget is derived from QWidget and
    Display3d as child of Display is also an QWidget.
    setupui( this ) can´f figure it out, which typof "this" is.

    Anybody some hints?
    Is it a good idea to derive QWidgets on my own, or should i use an already set up mechanism from qt? Are there any?

    Thanks a lot in advance and thanks for your attention.
    Last edited by SenSej; 13th October 2008 at 10:51.

Similar Threads

  1. Replies: 4
    Last Post: 19th March 2008, 17:47
  2. Connecting to a base class signal?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 26th October 2007, 22:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.