Hi
I am using Qt on MacOS. My software requirement is that We are displaying text in two line, First line will be in Bold Font and in second line, we are using small font,
small sample code for this:
QString strPath = QString(pEntry->cFilePath,pEntry->nPathLen/2);
QString tmpFileName = "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Lucida Grande'; font-size:11pt; font-weight:200; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; \">";
tmpFileName = tmpFileName + strFileName + "</span></p>\n";
tmpFileName +="<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;\">" + strPath + "</p>\n";
QTreeWidgetItem *pItem = new QTreeWidgetItem;
QLabel *pLabel = new QLabel;
pLabel->setAutoFillBackground(true);
pLabel->setText(tmpFileName);
treeWidget->setItemWidget(pItem,0,pLabel);
This sample code is correctly show the text in QTreeWidgetItem in two line using HTML tag and QLabel. But After adding few hundred QTreeWidgetItem in QTreeWidget, it started disappear the first column text, when I am moving the vertical scrollbar, But when resize the column 1, using draging column, it immedietly update and view the text in QTreeWidget.
I searched this problem in google, i found one problem here link...
http://www.qtcentre.org/archive/index.php/t-589.html
it solution is the use QItemdelegate and customize setModelData,
But program is developed is that fashion that, in this stage we can't use QItemDelegate to change whole program.
I need some help to fix this bug without using QItemDelegate.
I also see the following link:
http://qt-project.org/doc/qt-4.8/qtr...#setItemWidget
But no luck.
Kindly tell me the solution for this as we are stuck at this point.
Note: I have attached the screenshot regarding this Bug. Some Item of QTreeWidgetItem display and some Item of QTreeWidgetItem don't display,
Kindly reply for the solution..
Bookmarks