0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Qt Designer with QGIS】mMapLayerComboBoxのフィルター、バグ解消方法

Last updated at Posted at 2024-06-11

Qt DesignerのMapLayerComboBoxにフィルターを設定するとエラーになるバグ?の解消法について、受け売りですが共有します。

方法

Qt Designerでフィルターをかけるのではなく
plugin名.pyに以下コードを追加してください。

プラグイン名.py
from qgis.core import QgsMapLayerProxyModel

def run(self):
#この場合はラインレイヤのみ表示
self.dlg.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.LineLayer)

プラグインを使った際のみ適用される為、エラーが発生しないみたいです。

引用元:https://github.com/qgis/QGIS/issues/38472

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?