Home > Mobile >  How to add a button in Qt property sheet?
How to add a button in Qt property sheet?

Time:09-27

How do I add a button in Qt property sheet?

CodePudding user response:


QtTreePropertyBrowser is this effect is not, this, this is a bit complicated to use, post code, it's helpful for you to see, also can use QTableView function of attribute table with Qt MVC, this is also very complex one or two sentences,
 class DEVProperty: public QtTreePropertyBrowser 
{
Q_OBJECT
Public:
DEVProperty (QWidget * parent=0);
~ DEVProperty ();

Protected slots:
Void variantPropertyValueChanged (QtProperty * property, const QVariant & amp; Value);
Void enumPropertyValueChanged (QtProperty * property, int iSel);
Void btnPropertyValueChanged (QtProperty * property, const QString& Ss);

Private:
//basic type attribute
QtVariantPropertyManager * m_pVarManager;
QtVariantEditorFactory * m_pVarFactory;

//the enumeration value attribute
QtEnumPropertyManager * m_pEnumManger;
QtEnumEditorFactory * m_pEnumFactory;

//button properties
QtButtonPropertyManager * m_pBtnManger;
QtButtonEditorFactory * m_pBtnFactory;

 
DEVProperty: : DEVProperty (QWidget * parent) : QtTreePropertyBrowser (parent), m_item (NULL),
M_icdMan (NULL),
M_ts (NULL),
M_bEditICD (false)
{
M_pVarManager=new QtVariantPropertyManager (this);
M_pVarFactory=new QtVariantEditorFactory (this);
This - & gt; SetFactoryForManager (m_pVarManager m_pVarFactory);
Connect (m_pVarManager, SIGNAL (valueChanged (QtProperty *, QVariant)), and this,
SLOT (variantPropertyValueChanged (QtProperty *, const QVariant & amp;) ));

M_pEnumManger=new QtEnumPropertyManager (this);
M_pEnumFactory=new QtEnumEditorFactory (this);
This - & gt; SetFactoryForManager (m_pEnumManger m_pEnumFactory);
The connect (m_pEnumManger, SIGNAL (valueChanged (QtProperty *, int)), and this,
SLOT (enumPropertyValueChanged (QtProperty *, int)));

M_pBtnManger=new QtButtonPropertyManager (this);
M_pBtnFactory=new QtButtonEditorFactory (this);
This - & gt; SetFactoryForManager (m_pBtnManger m_pBtnFactory);
M_pBtnFactory - & gt; M_fun=& amp; (this - & gt; OnConfig);
M_pBtnFactory - & gt; M_pObj=this;
The connect (m_pBtnManger, SIGNAL (valueChanged (QtProperty *, const QString&) ), and this,
SLOT (btnPropertyValueChanged (QtProperty *, const QString&) ));
};

CodePudding user response:

Can, if you are a QTableWidget, you can directly in the item you need to add, write
QPushButton * BTN=new QPushButton ();
SetCellWidget - & gt; (BTN);
  •  Tags:  
  • Qt
  • Related