next up previous contents index
Next: QMultiLineEdit Up: Programming Previous: QComboBox   Contents   Index


QTable

QTables are inserted and dimensioned in Qt Designer. In your code you may use the following commands.

Figure 6.5: Commands for tables
pvSetColumnWidth(p,Table1,1,100);                              // set column 1 width
pvSetColumnWidth(p,Table1,2,100);                              // set column 2 width
pvTablePrintf(p,Table1,0,0,"color(255,0,0)%5.2f",fval);        // output text in red
pvTablePrintf(p,Table1,0,3,"%5.2f",fval);                      // output text without color
pvSetTablePixmap(p,Table1,1,0,"error.bmp");                    // insert a pixmap
pvSetTablePixmap(p,Table1,1,1,"ok.bmp");                       // insert a pixmap
pvSetTableCheckBox(p,Table1,2,0,1,"CheckBox");                 // insert a check box
pvSetTableComboBox(p,Table1,2,1,1,"choice1,choice2,choice3");  // insert a combo box with 3 choices
pvTablePrintf(p,Table1,0,-1,"hello");                          // set title of a column
pvTablePrintf(p,Table1,-1,0,"world");                          // set title of a row
pvSetColumnWidth(p,Table1,-1,40);                              // set width of a row title
pvSetTableText(p,Table1,x,y,"text");                           // set text of a table cell
pvEnsureCellVisible(p,Table1,row,col);                         // Scroll table so that cell is visible
pvSetNumRows(p,Table1,num);                                    // Set number of rows
pvSetNumCols(p,Table1,num);                                    // Set number of colums

Figure 6.6: Response from tables
case TABLE_TEXT_EVENT:
  printf("%s\n",text);
  sscanf(text,"(%d,%d,",&x,&y);
  pvGetText(text,str1);
  printf("TABLE_TEXT_EVENT(%d,%d,\"%s\")\n",x,y,str1);
  break;
case TABLE_CLICKED_EVENT:
  printf("%s\n",text);
  sscanf(text,"(%d,%d,%d)",&x,&y,&button);
  printf("TABLE_CLICKED_EVENT(%d,%d,button=%d)\n",x,y,button);
  break;



Rainer Lehrig 2004-02-17