All pastes #518393 Raw Edit

view

public cpp v1 · immutable
#518393 ·published 2007-05-29 09:14 UTC
rendered paste body
// HEADER#ifndef POSVIEW_H#define POSVIEW_Hclass posview : public Q3VBox{    Q_OBJECTpublic:    posview( QWidget* parent = 0, const char* name = 0 );    ~posview();    table* tbl_pos;   // subclassed QTableWidget   private:protected:public slots:    void handle_callback( DBI_msg* );    void request_messages();    static posview* get();private slots:    // blah};#endif------------------------// source for callback... reimplemented to send "msg" to my objectvoid client_func_message( DBI_msg* msg ){    posview::get()->handle_callback( msg );}// SOURCE for my class// construtctor posview::posview( QWidget* parent, const char* name ) : Q3VBox( parent, name ){    no_of_cols 4;    tbl_pos   = new table( 0, no_of_cols, this );     // this adds a new row, that I can see     for ( int x = 0; x < no_of_cols; x++ ) {        QTableWidgetItem *temp = new QTableWidgetItem( x );        temp->setText( "test" + QString::number( x ) );        tbl_pos->setItem( 0, x, temp );    }}posview::handle_callback( DBI_msg* req ){    // let's add a row and stick some info from this message in the table    insertRow( 0 );   // this does not work... no new row appears    for ( int x = 0; x < no_of_cols; x++ ) {       QTableWidgetItem* temp = new QTableWidgetItem();       temp->setText( "something" );       tbl_pos->setItem( 0, x, temp );    }     // let's see what we put in:     // this value always increments     cout << "rowCount is " << tbl_pos->rowCount() << endl;      cout << "text in row: " <<     // these values are always "0"     qPrintable( tbl_pos->item( 0, 0 )->text() ) << " " <<     qPrintable( tbl_pos->item( 0, 1 )->text() ) << " " <<     qPrintable( tbl_pos->item( 0, 2 )->text() ) << " " <<     qPrintable( tbl_pos->item( 0, 3 )->text() ) << " " << endl;    // and I still have no rows showing in my table}   /* The  handle_callback() routine above actually has all the right data it needs.  However, the row is never inserted.   "something" is always some valid value, but I figured I would spare the parsing code.  The weird thing is though, for debugging, I checked to see what row 0 has in it for it's values after inserting.  They're always zero, and the rows are never there. To boot, the row (or rows) I created in the constructor and had values of "test1, test2, ..." are now set to 0. :(I checked to make sure the address of my tbl_pos was correct, and sure enough it is.  Alas, no rows.*/