frosch
2nd September 2006, 12:38
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
void PortCheckboxTable::createWidget(QWidget* parent)
{
HxPort::createWidget(parent);
table = new QTable(1, 1, baseWidget);
table->setEnabled(sensitivity);
table->verticalHeader()->hide();
table->setLeftMargin(0);
table->setSorting(false);
table->setDragEnabled(false);
table->setSelectionMode(QTable::NoSelection);
table->setHScrollBarMode(QScrollView::AlwaysOff);
table->horizontalHeader()->hide();
table->setTopMargin(0);
table->setColumnStretchable(0, true);
initTable();
//for(int i = 0; i < 3; i++ )
// table->setItem( i, 0, new QCheckTableItem( table, "Check me" ) );
layout->addWidget(table);
layout->activate();
baseWidget->adjustSize();
}
void PortCheckboxTable::insertName(const char* name)
{
if( tableWithMessage ){
//table->clearCellWidget(0, 0);
//table->setItem(0, 0, new QCheckTableItem(table, name));
table->numRows();
tableWithMessage = 0;
}
else
{
int newNumRows = table->numRows() + 1;
table->setNumRows(newNumRows);
table->setItem( newNumRows - 1, 0, new QCheckTableItem(table, QString(name)));
}
}
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
void PortCheckboxTable::createWidget(QWidget* parent)
{
HxPort::createWidget(parent);
table = new QTable(1, 1, baseWidget);
table->setEnabled(sensitivity);
table->verticalHeader()->hide();
table->setLeftMargin(0);
table->setSorting(false);
table->setDragEnabled(false);
table->setSelectionMode(QTable::NoSelection);
table->setHScrollBarMode(QScrollView::AlwaysOff);
table->horizontalHeader()->hide();
table->setTopMargin(0);
table->setColumnStretchable(0, true);
initTable();
//for(int i = 0; i < 3; i++ )
// table->setItem( i, 0, new QCheckTableItem( table, "Check me" ) );
layout->addWidget(table);
layout->activate();
baseWidget->adjustSize();
}
void PortCheckboxTable::insertName(const char* name)
{
if( tableWithMessage ){
//table->clearCellWidget(0, 0);
//table->setItem(0, 0, new QCheckTableItem(table, name));
table->numRows();
tableWithMessage = 0;
}
else
{
int newNumRows = table->numRows() + 1;
table->setNumRows(newNumRows);
table->setItem( newNumRows - 1, 0, new QCheckTableItem(table, QString(name)));
}
}