DJSymbolTable::DJSymbolTable( int type, QWidget* parent, const QSize symbolSize ) :QTableWidget(parent),m_type(type) { djDebug() << "DJSymbolTable constructor"; setSelectionMode( QAbstractItemView::NoSelection ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); setGridStyle( Qt::NoPen ); setShowGrid( false ); setSymbolSize( symbolSize ); switch ( m_type ) { case PLAYER_SYMBOL_WIDGET: { setDirPath( ":/BaseRes/image/face" ); createSymbolItems(); break; } case MEMBER_SYMBOL_WIDGET: { setDirPath( "images/member" ); createSymbolItems(); break; } default: djDebug() << "symbol type error"; break; } connect( this, SIGNAL(itemClicked(QTableWidgetItem *)),SLOT(handleItemClicked(QTableWidgetItem *))); connect( this, SIGNAL(itemDoubleClicked(QTableWidgetItem *)),SLOT(handleItemDoubleClicked(QTableWidgetItem *))); djDebug() << "DJSymbolTable constructor end"; }
/* * Adds the given symbol to the symbol table supplied. * * This is a wrapper around createHashElement that also sets the * symbols size, since when we add to the hash table we know all the elements * needed to set the size. * * Parameters: * table: hash table for element to be created in * symbol: pointer to symbol to add to hash table. * * Returns: 0 on success * 1 current lex level and symbol's lex level differ * 2 element on hash table has symbol set to NULL * 3 element's symbol list head lex level same as symbol's * 4 symbol's lex level lower than element's symbol list head * 5 could not create a name for null key */ int addToSymbolTable(struct hash *table, Symbol *symbol) { int retval = 0; retval = createHashElement(table, symbol->name, symbol); /* For symbol which are record types we do not call setSymbolSize() * as at this point in the program we have lost the information we * need to accureately calculate size */ setSymbolSize(symbol); return retval; }
void specCanvasItem::setSymbolSize(int w, int h) { if(h < 0) setSymbolSize(QSize(w, w)) ; else setSymbolSize(QSize(w, h)) ; }