0

I am writing a QDialog to allow exporting data from the rest of my program. The dialog asks as series of questions depending on the previous answers given. There are three different types of question that can be asked, with a QComboBox, QList or a QCheckbox. When displaying the QComboBox, it's fine, but when displaying the other two, it causes the other widgets to be painted black.

https://i.stack.imgur.com/AnhpW.jpg [Works] https://i.stack.imgur.com/zfdL2.jpg [Doesn't work]

ExportOption* option = new ExportOption(question, type, nullptr);
ui_->optionsLayout_->insertWidget(shownOptions_.size(), option);
adjustSize();

This only happens when the dialog needs to resize, if there is enough room to begin with, it isn't displayed black. Also, it is fixed whenever the dialog redraws for resizing or any other reason, but if I manually call update\repaint on the dialog or it's children, nothing seems to happen.

I assume it's something fairly simple that I'm missing.

I am using Qt5.1 on Windows.

5
  • Can you show your adjustSize() method?
    – ksimons
    Oct 8, 2013 at 6:00
  • The adjustSize() method is the one provided by QWidget.
    – dempzorz
    Oct 8, 2013 at 6:36
  • Ah sorry. Haven't done QWidget in years, not since QML emerged.
    – ksimons
    Oct 8, 2013 at 7:03
  • Are you adding / removing widgets when you change the type of dialog you want to display? If so, try creating a dialog with all the widgets and just hide and show the ones you need, as required. Oct 8, 2013 at 7:45
  • It might come to that. I was hoping not to go down that path though, because the dialog is not supposed to be aware of the model that is driving it (It can export a few different things). An ExportOption is created and added to the layout every time an answer is given, which itself is just a widget that contains a label and the type of widget needed.
    – dempzorz
    Oct 8, 2013 at 7:49

1 Answer 1

0

Thanks for the help guys, but it turned out to be an errant stylesheet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.