正常调用没问题,但是一旦关联起来例如
connect(qcombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(ChangeDriveInfo(int)));
此时再调用clear()方法,就会崩溃。
解决办法是在调用clear()方法时先调用
disconnect(qcombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(ChangeDriveInfo(int)));
调用完clear()方法后再次调用
connect(qcombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(ChangeDriveInfo(int)));