mac: QMessageBox setMinimumHeight / Width doesn't work??



  • my dialog from xcode looks the way i want it:
    0_1557209237926_Screen Shot 2019-05-06 at 11.06.12 PM.png
    Nice and large, buttons spaced exactly how the spec requires.
    When i attempt to implement in Qt, it auto resizes like this:
    0_1557209288500_Screen Shot 2019-05-06 at 11.05.48 PM.png
    now, at the constructor of the dialog i call this:

    i_qDlg.setMinimumHeight(200);
    i_qDlg.setMinimumWidth(480);
    

    yet these calls are totally ignored? why?


  • Lifetime Qt Champion

    Hi,

    Can you show the full code you are using to setup and show this dialog ?



  • missing some but here's the gist:

    QtDefaultWindowFlags are:
    		  Qt::Window 
    		| Qt::CustomizeWindowHint	//	this flag prevents user resizing
    		| Qt::WindowTitleHint
    		| Qt::Dialog;
    
    
    QMessageBox		i_qDlg;
    
    i_qDlg(
    	QMessageBox::NoIcon, 
    	QString(), QString(), 
    	QMessageBox::NoButton, NULL, 
    	QtDefaultWindowFlags()),
    
    i_qDlg.setText(i_quick3CheckRec.titleStr);
    i_qDlg.setInformativeText(i_quick3CheckRec.messageStr);
    i_qDlg.setMinimumHeight(200);
    i_qDlg.setMinimumWidth(482);
    
    QHBoxLayout		*layoutP = NULL;
    
    {
    	QList<QHBoxLayout *>		list(i_qDlg.findChildren<QHBoxLayout *>());
    	
    	CF_ASSERT(list.size() == 1);
    	layoutP = list[0];
    }
    
    for (int _indexS: KQuick3_Result_NUMTYPES) {
    	DialogItemIndex		itemS = Q3C_ItemID_Button_1 - _indexS;
    	const SuperString&	buttonStr(i_quick3CheckRec.buttonRecA[_indexS].buttonStr);
    
    	if (buttonStr.empty()) {
    			layoutP->addSpacing(80);
    		//	i_pushButtonA[_indexS] = i_qDlg.addButton("", QMessageBox::ActionRole);
    		//	i_pushButtonA[_indexS]->hide();
    	} else {
    		i_pushButtonA[_indexS] = i_qDlg.addButton(buttonStr, QMessageBox::ActionRole);
    	}
    }
    
    i_qDlg.Run();
    


  • i just need to write my own dialog, and not use QMessageBox


Log in to reply
 

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