7

I use custom Qt widgets like QgsMapLayerComboBox for my QGIS plugin, laying the whole thing out in Qt Designer. Using those requires fixing headings in .ui file as described here. Unfortunately I have to fix headers every time I save my .ui file.

So the question is: is it possible to make Qt Designer reference qgis.gui headers by default?

2

I think it's not possible IIRC, it's a bug reported.

I have wrote this script for myself:

#!/bin/sh
if [ $# -eq 1 ]
then
    sed -i.bak -e 's|<header>.*</header>|<header>qgis.gui</header>|g' $1
    rm $1.bak
else
    echo "Usage: fix_widgets_ui.sh ui_file.ui"
fi

Regards

  • Thanks! Do I have to manually launch this every time I save the .ui? p.s. I'm using windows – Basile Oct 28 '17 at 14:21
  • 1
    Yes, I don't know if you can launch it automatically after each save. The script it's compatible (no GNU or BSD sed specific) with *BSD, linux and OS X. I haven't tested with windows. I think it sould be run with OSGEO4W installation (msys) – lbartoletti Oct 30 '17 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.