ユーザーインターフェイスのコードを開発する際に問題が発生しています。私はYoctoを配備したLinuxディストリビューションでQt 4.8を使用しています。ここ 私のコードの本当に簡単なスニペット:'QAbstractItemViewPrivate'値の仮想テーブルのリンカシンボルが見つかりません
// MyWidget.h
class MyWidget : public QWidget
{
Q_OBJECT
public:
MyWidget(QWidget* parent);
~MyWidget();
signals:
void request_GoToNext(QString); //!< Go to next panel
private slots:
void onNext(QModelIndex index);
private:
QTableView *tableView;
QStandardItemModel *dataModel;
}
// MyWidget.cpp
MyWidget::MyWidget(QWidget *parent) : QWidget(parent)
{
this->tableView = new QTableView(this);
this->dataModel = new QStandardItemModel();
// "Fill-in" data model with the list of files in a specific directory
...
connect(this->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(onNext(QModelIndex)), Qt::UniqueConnection);
}
MyWidget::~MyWidget()
{
disconnect(this->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(onNext(QModelIndex)));
this->dataModel->clear();
delete this->tableView;
delete this->dataModel;
}
void MyWidget::onNext(QModelIndex index)
{
emit this->request_GoToNext(this->dataModel->item(index.row(), index.column())->text());
}
信号を発するとき、問題はその起源を持っている「request_GoToNext」、それが原因セグメンテーションフォールトにアプリケーションがクラッシュしたり、デバッグの停止を行います。 QtCreatorで、アプリケーションが失敗しているようだポイントは、ファイルqabstractitemview.cppにこの機能では、より具体的である、ということである私が見ることができます:私に
QStyleOptionViewItemV4 QAbstractItemViewPrivate::viewOptionsV4() const
{
Q_Q(const QAbstractItemView);
QStyleOptionViewItemV4 option = q->viewOptions();
if (wrapItemText)
option.features = QStyleOptionViewItemV2::WrapText;
option.locale = q->locale();
option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
option.widget = q;
return option;
}
それは本当に奇妙に聞こえます。 信号を出力した後、アプリケーションは現在のパネルを削除して別のビルドを作成する必要があります: 'qDebug'コールを設定して、現在のパネル(およびその子)を削除して新しいパネルを作成しますが、パネル。 MyWidgetに関連するすべてのものを削除した後、プログラムがスロット 'onNext'を「終了」するようです。
また、QtCreatorのtehのアプリケーションの出力に私はこのメッセージを読むことができます
「QAbstractItemViewPrivate」の値のための仮想テーブルのためのリンカシンボルを見つけることができません
NB - 観察 私はコードが書き換えた場合このように私のスロットの内側
void MyWidget::onNext(QModelIndex index)
{
QObject::startTimer(1);
emit this->request_GoToNext(this->dataModel->item(index.row(), index.column())->text());
}
void MyWidget::timerEvent(QTimerEvent *event)
{
QObject::killeTimer(event->timerId());
emit this->request_GoToNext(this->dataModel->item(index.row(), index.column())->text());
}
すべてがうまくいきます!だから、それは私にスロットコールを「終了」することに関連しているようです。他のいくつかのテストをした後、あなたの助け