I would like to have a constructor of class to have a lambda as a parameter:
class MyComboBox : public QComboBox
{
public:
explicit QgsFlagCheckableComboBox<Flag>( std::function< QString( Flag ) > &readable, QWidget *parent = nullptr );
};
I have some flags in a class, which also have a static method:
class QgsField
{
Q_GADGET
public:
enum class ConfigurationFlag : int
{
Searchable = 1 << 1,
Readable = 1 << 2,
};
Q_ENUM( ConfigurationFlag )
Q_DECLARE_FLAGS( ConfigurationFlags, ConfigurationFlag )
Q_FLAG( ConfigurationFlags )
static QString readableConfigurationFlag( QgsField::ConfigurationFlag flag );
};
I am trying to construct MyComboBox:
std::function<QString (QgsField::ConfigurationFlag)> readable = [](QgsField::ConfigurationFlag flag) {return QgsField::readableConfigurationFlag(flag);};
QComboBox *cb = new MyComboBox<QgsField::ConfigurationFlag>(readable, parent );
This fails:
Undefined symbols for architecture x86_64: "QgsFlagCheckableComboBoxQgsField::ConfigurationFlag::QgsFlagCheckableComboBox(std::__1::function<QString (QgsField::ConfigurationFlag)>&, QWidget*)
- Is there a way to pass the static method directly without going through a lambda (by definition the base class can change)?
- Why is it currently failing?
Aucun commentaire:
Enregistrer un commentaire