vieraci
6th December 2009, 11:08
I can't understand why my custom widget is missing some designer functions, like in designer,
the custom widget doesn't have any tab order and it doesn't appear in the tab order list.
I'm thinking it's because I've placed it in a layout which doesn't have a tab order ?
I had to do this because without it, my widget didn't show up when placing it on a form.
DbComboBox::DbComboBox(QWidget *parent)
: QWidget(parent)
{
cb = new QComboBox(this);
cb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
cb->setEditable(true);
cb->installEventFilter(this);
connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int)));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(cb);
layout->setContentsMargins(0,0,0,0);
this->setLayout(layout);
}
Also QComboBox public methods aren't available, when I compile my project with an instance of this part and access a method:
m_ui->myComboBox->currentText
compiler says
/home/vince/projects/Qt/myProject/plugins/DbComboBoxExtension/dbcombobox.h:56: error: ‘QString DbComboBox::currentText’ is private
Can someone please point out why it isn't behaving ?
the custom widget doesn't have any tab order and it doesn't appear in the tab order list.
I'm thinking it's because I've placed it in a layout which doesn't have a tab order ?
I had to do this because without it, my widget didn't show up when placing it on a form.
DbComboBox::DbComboBox(QWidget *parent)
: QWidget(parent)
{
cb = new QComboBox(this);
cb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
cb->setEditable(true);
cb->installEventFilter(this);
connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int)));
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(cb);
layout->setContentsMargins(0,0,0,0);
this->setLayout(layout);
}
Also QComboBox public methods aren't available, when I compile my project with an instance of this part and access a method:
m_ui->myComboBox->currentText
compiler says
/home/vince/projects/Qt/myProject/plugins/DbComboBoxExtension/dbcombobox.h:56: error: ‘QString DbComboBox::currentText’ is private
Can someone please point out why it isn't behaving ?