[Qt-interest] QMenu, QAction and QAbstractItemModel
mario
dodiesis at gmail.com
Thu Feb 12 17:45:05 CET 2009
On Thu, Feb 12, 2009 at 5:16 PM, Scott Aron Bloom
<Scott.Bloom at sabgroup.com> wrote:
> Pelase give a better description...
>
> How would you join a QMenu with a model? What type of model? A
> QAbstractItemModel?
Actually a SqlRelModel...
temporary solved:
// QMenu * m_pMenu
QAbstractItemModel* m;
QAction* a;
for ( int i = 0; i< m->rowCount() ; i++ )
{
int id = m->data ( m->index(i,0) ).toInt();
QString title = m->data ( m->index(i,1) ).toString();
a = new QAction( title , m_pMenu);
a->setData( id );
m_pMenu->addAction(a);
}
Every times the model changes... I clear and repopulate the QMenu *.
I was looking for something similar to the combobox:
void QComboBox::setModel ( QAbstractItemModel * model )
void QComboBox::setModelColumn ( int visibleColumn )
> I just have no idea what you are asking.
lol!
Tnx!
--
Mario Signorino | www.sgrunt.net
More information about the Qt-interest-old
mailing list