Toss for several days, finally the book's third chapter and the fourth chapter to see a probably.
The function call relationships inside are complex.
A part of the function relationship is organized as follows:
The cell Relationship Cleanup data (role) returns the value that should be displayed or the value of the alignment or formula ->value () cell, and if it is old, re-get the value to Cachedvalue and return to the input with the ' start and = ' Beginning of the special treatment - >formula () Gets the cell's edit role ->data (edit role) ->evalexpression () evaluates the value of the expression Setformula (formula)// Set cell formula-- setData (Editrole, Formula) to edit role call SetData, qtablewidgetitem::setdata (role value) to cell Assigns a value to the given value with the given formula ->setdirty () If the value of Editrole is set to the old
Problem:
?? where the data () is called
Qt::D isplayrole
Where did Qt::textalignmentrole come from?
?? The difference between text () and data () in Qtablewigetitem
?? What's the use of setting the value to the old one?
Spreadsheet Relationship Cleanup spreadsheet () |->qtablewidget::setitemprototype (new cell)//Set the type of each cell |-> SelectionMode ()//Set selection mode qt comes with |->somethingchanged ()//slot function | | ->recalculate ()//recalculation | | | ->cell ()//Convert cell to cell form | | | ->qtablewidget::item () | | | ->cell::setdirty ()//Set all values to be old | | | ->viewport ()->update () update?? | | | | ->modified ()//Signal | | ->clear ()//clear the entire table |->setrowcount (0) |->setcolumncount (0) |->setrowcount (RowCount);// Set how many lines qt comes with |->setcolumncount (ColumnCount);//Set how many columns qt comes with setautorecalculate ()//If Auto-count is true, call the operator below
There are some problems I haven't figured out yet. Marked with a question mark.
For these modules, from small to large to tidy up a bit:
The smallest is that the qtablewigetitem is the representation of the cells of the two-dimensional table qtablewidget, but what is entered shows nothing, no function
And then the Cell is the extension of the Qtablewigetitem added to the special input format processing and expression calculation function
And then the spreadsheet extended from the two-dimensional table qtablewidget uses the cell, adding copy, paste, find, sort, save, read function.
Finally, the function of MainWindow is the interface button and function docking.
"QT" C + + GUI QT4 Learning Note 5