Widgets within a QGraphicsScene are blank



  • I'm trying to add a QgraphicsView(QColorDialog) widget onto a Palette dialog, but the QGraphicsscene corresponding to the QColorDialog widget is always blank and it would be of great help if readers could help me correct my mistake

    Qt-4.8.4-Linux(CentOS)

    1. The GraphicsView widget which will be included in the Pallette Dialog
      @ClrWidget::ClrWidget(QWidget *parent) :
      QGraphicsView(parent)
      {
      setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      setFrameStyle(QFrame::NoFrame);

    setScene(new QGraphicsScene(this));

    _dialog = new QColorDialog();
    _dialog->setOption(QColorDialog::NoButtons, true);
    setMinimumSize(_dialog->size());
    setMaximumSize(_dialog->size());

    QGraphicsProxyWidget *proxyWidget = new QGraphicsProxyWidget();
    proxyWidget->setWidget(_dialog);
    //scene()->addItem(proxyWidget);
    //scene()->setSceneRect(proxyWidget->geometry());

    scene()->addWidget(_dialog);
    scene()->setSceneRect(_dialog->geometry());
    }@

    1. Palette Dialog Constructor
      @
      PaletteDialog::PaletteDialog(QWidget *parent)
      : QDialog(parent),
      ui(new Ui::PaletteDialog),
      {
      //PaletteDialog sets up the ClrWidget
      ui->setupUi(this);
      ...
      }@


  • Hi,

    in your code you don't use ClrWidget.

    Is QColorWidget a Qt class?



  • Hi mcosta,
    I probably wasn't clear in my earlier posting, probably being a new user shows up. I've edited my earlier post and below is some more detail.

    ClrWidget is essentially a QColorDialog and I'm using this custom widget(promoted from QWidget to ClrWidget) within a Pallette Creator(PC) dialog(defined as PC.ui )

    Within PC.cpp,
    @PCDlg::PCDlg(QWidget* parent) : QDialog(parent) :
    QDialog(parent)
    , ui(new Ui::PCDlg),
    , d(new PCDlg(this))
    {
    ui->setupUi(this);
    @

    I'm not able to understand why the custom widget(ClrWidget) does not show up within the PC dialog.
    I'm using Qt-4.8.4 on Linux


Log in to reply
 

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