qconnectorblob::qconnectorblob(QWidget *parent, bool type,
QNodeWidget *myPWidget, long myID, long connectToID) :
QRadioButton(parent)
{
setAcceptDrops(true);
this->setAutoExclusive(false);
mNodeWidget = myPWidget;
mtype = type;
//Resize for Android
this->resize(40,40);
我要更新「this」的大小嗎? 父窗口小部件? 「這個」小部件? 還是兩者兼而有之?我怎樣才能以40x40的尺寸導致重繪事件?Qt:resize(int,int)無法正常工作
只是嘗試這樣做,但小窗口「精靈/圖像」不改變它的大小:
//Resize for Android
this->setFixedSize(40,40);
this->setMinimumSize(40,40);
this->setMaximumSize(40,40);
this->resize(40,40);
this->repaint();
Setfixedsize設置最小和最大尺寸。如果你使用佈局檢查:http://stackoverflow.com/questions/11000083/cant-resize-widgets-in-qvboxlayout也嘗試使用resizeEvent,而不是paintEvent。 – Chernobyl 2014-10-12 11:15:27