Hi,

I am trying to embed QColorDialog in a QWidget. After I add the QColorDialog, it shows up correctly, but the layouting doesn't work correctly.
When I stretch the QWidget by dragging from the bottom right corner, the QColorDialog doesn't occupy the entire resized QWidget. It only stays in the center.
The minimal code to reproduce this is as follows:

Qt Code:
  1. #include <QApplication>
  2. #include <QWidget>
  3. #include <QColorDialog>
  4. #include <QHBoxLayout>
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. QWidget *w = new QWidget(nullptr);
  9.  
  10. QColorDialog *cDialog = new QColorDialog(w);
  11. cDialog->setWindowFlags(Qt::Widget);
  12. cDialog->setOptions(QColorDialog::DontUseNativeDialog
  13. | QColorDialog::NoButtons);
  14.  
  15. QHBoxLayout *hl = new QHBoxLayout(w);
  16. hl->addWidget(cDialog);
  17. w->setLayout(hl);
  18.  
  19. w->show();
  20. return a.exec();
  21. }
To copy to clipboard, switch view to plain text mode 

If I replace the QColorDialog with QFontDialog, this works correctly. Please see the attached screenshot that shows the issue
Capture-QColorDialog_in_QWidget.jpg

Can anyone help me fix the issue?

Thanks,
Ashish