这种内建的对话框人家一般不允许resizing,如果不信可以用下面的代码调用试试:
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- QColorDialog* pCD = new QColorDialog();
- pCD->resize(QSize(700,700));
- QColor clr = pCD->getColor();
- delete pCD;
- return a.exec();
- }
Qt的源码中已经清晰地讲述了不能resizing,下面摘自Qt源码之qcolordialog.cpp,请注意源码中的comment
- void QColorDialogPrivate::init(const QColor &initial)
- {
- Q_Q(QColorDialog);
- q->setSizeGripEnabled(false);
- q->setWindowTitle(QColorDialog::tr("Select Color"));
- nativeDialogInUse = (platformColorDialogHelper() != 0);
- nextCust = 0;
- QVBoxLayout *mainLay = new QVBoxLayout(q);
- // there's nothing in this dialog that benefits from sizing up
- mainLay->setSizeConstraint(QLayout::SetFixedSize);
- QHBoxLayout *topLay = new QHBoxLayout();
- mainLay->addLayout(topLay);
- /* more to go */
- }