以下是我的代码:
def browseR(self, iface):
self.iface = iface
filename, filter_string = QFileDialog.getOpenFileName(None, "Open RED Band", "", "GeoTIFF(*.tif)")
if filename is not None:
self.iface.addRasterLayer(filename, str.split(os.path.basename(filename), ".") [0])