collect2: ld returned 1 exit status的问题
定义了一个win类:
win::win(QWidget *parent):QListWidget(parent)
{
setViewMode(QListWidget::ListMode);
setSelectionMode(QAbstractItemView::SingleSelection);
for( int i=0; i<10; i++ )
{
QListWidgetItem *item = new QListWidgetItem();
QToolButton *btn=new QToolButton();
btn->setText("23");
setItemWidget(item, btn);
}
}
然后:
void MainWindow::createcombobox()
{
ui->comboBox->setStyleSheet("QComboBox {min-height:16px;min-width:16px;padding-right: 16px;} "
"QComboBox QAbstractItemView::item{min-height:50px;min-width:150px}");
win *view = new win(this);
ui->comboBox_2->setModel(view->model());
ui->comboBox_2->setView(view);
}
编译的时候就出现如题的问题。求指教!!!
[解决办法]
for( int i=0; i<10; i++ )
{
QListWidgetItem *item = new QListWidgetItem();
QToolButton *btn=new QToolButton();
btn->setText("23");
addItem(item);加一句
setItemWidget(item, btn);
}