hello,
i have a question. i have build kind of a qt
widget, when the widget is constructed the
"createWidget" method is called. in this
method also an attribute of the class is
initialized (the attribute *table).

everything works fine - the widget is displayed.
but when i called a method, which accesses the
attribute "table" (e.g. the method "insertName")
a error appears: the pointer is empty?!

damn, why isn't the pointer stored in the variable
"table"?!

greeting and thanks

Qt Code:
  1. void PortCheckboxTable::createWidget(QWidget* parent)
  2. {
  3. HxPort::createWidget(parent);
  4.  
  5. table = new QTable(1, 1, baseWidget);
  6. table->setEnabled(sensitivity);
  7. table->verticalHeader()->hide();
  8. table->setLeftMargin(0);
  9. table->setSorting(false);
  10. table->setDragEnabled(false);
  11. table->setSelectionMode(QTable::NoSelection);
  12. table->setHScrollBarMode(QScrollView::AlwaysOff);
  13. table->horizontalHeader()->hide();
  14. table->setTopMargin(0);
  15. table->setColumnStretchable(0, true);
  16.  
  17. initTable();
  18.  
  19. //for(int i = 0; i < 3; i++ )
  20. // table->setItem( i, 0, new QCheckTableItem( table, "Check me" ) );
  21. layout->addWidget(table);
  22. layout->activate();
  23. baseWidget->adjustSize();
  24. }
  25.  
  26. void PortCheckboxTable::insertName(const char* name)
  27. {
  28. if( tableWithMessage ){
  29. //table->clearCellWidget(0, 0);
  30. //table->setItem(0, 0, new QCheckTableItem(table, name));
  31. table->numRows();
  32. tableWithMessage = 0;
  33. }
  34. else
  35. {
  36. int newNumRows = table->numRows() + 1;
  37. table->setNumRows(newNumRows);
  38. table->setItem( newNumRows - 1, 0, new QCheckTableItem(table, QString(name)));
  39. }
  40. }
To copy to clipboard, switch view to plain text mode