qt4 - QTextCursor insertText not working -


i'm trying make table in qt using qtexttable. first row working fine when set background , text second row applying formating inserttext function doesn't seem work me. i've tried inserthtml nothing seems work me on row2.

qtexttableformat channelbankformat; channelbankformat.setalignment(qt::alignhcenter); //channelbankformat.setheight(8); channelbankformat.setcolumnwidthconstraints(constraints); channelbankformat.setborder(0);  channelbank->clear(); qtextcursor cursor = channelbank->textcursor(); cursor.begineditblock();  qtexttable *table = cursor.inserttable(2, 5, channelbankformat); qtextcharformat headerformat = cursor.charformat(); headerformat.setfontweight(qfont::bold); headerformat.setfontpointsize(8);  qtextcharformat dataformat = cursor.charformat(); dataformat.setfontpointsize(12);  qtextblockformat centeralignment; centeralignment.setalignment(qt::aligncenter);  (int cellnumber = 1; cellnumber <= 5; ++cellnumber) {     qtexttablecell  cell                = table->cellat(0, cellnumber-1);     qtextcharformat headercellformat    = cell.format();     qtextcursor     cellcursor          = cell.firstcursorposition();      headercellformat.setbackground(qcolor(0 + (cellnumber * 50), 222, 222, 127));     cell.setformat(headercellformat);     cellcursor.clearselection();     cellcursor.inserttext("---",headerformat); } (int cellnumber = 1; cellnumber <= 5; ++cellnumber) {     qtexttablecell  cell                = table->cellat(1, cellnumber-1);     qtextcharformat headercellformat    = cell.format();     qtextcursor     cellcursor          = cell.lastcursorposition();      headercellformat.setbackground(qcolor(0 + (cellnumber * 50), 222, 222, 127));     cell.setformat(headercellformat);     cellcursor.clearselection();     cellcursor.inserttext("---",headerformat); } cursor.endeditblock(); 

found culprit : channelbankformat.setheight(8);


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -