Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.3
-
None
Description
When using an HTML table in a tooltip, then there is extra space added between the bottom of the table and the bottom of the tooltip box. This only happens if a column in the table contains a relatively long string.
The following example reproduces the problem. Note that only the tool tip with the long string ("This is a long name 1") exhibits the problem. The tool tip with the shorter string ("Name 1") does not have this issue.
#include <QtGui>
class MainWindow : public QMainWindow
{
public:
MainWindow(QWidget *parent = 0)
: QMainWindow(parent)
QString tooltip( bool long_names )
{ QTextDocument doc ; QTextCursor cursor( &doc ) ; QTextTable *table ; QTextTableFormat format_table ; QTextTableCell cell ; QTextCursor cellCursor ; table = cursor.insertTable( 2, 2 ) ; format_table.setCellSpacing( 0 ) ; format_table.setCellPadding( 3 ) ; format_table.setBorder( 1 ) ; table->setFormat( format_table ) ; cell = table->cellAt( 0, 0 ) ; cellCursor = cell.firstCursorPosition(); cellCursor.insertText( ( long_names == true ) ? "This is a long name 1" : "Name 1" ) ; cell = table->cellAt( 0, 1 ) ; cellCursor = cell.firstCursorPosition(); cellCursor.insertText( "Value 1" ) ; cell = table->cellAt( 1, 0 ) ; cellCursor = cell.firstCursorPosition(); cellCursor.insertText( ( long_names == true ) ? "This is a long name 2" : "Name 2" ) ; cell = table->cellAt( 1, 1 ) ; cellCursor = cell.firstCursorPosition(); cellCursor.insertText( "Value 2" ) ; return( doc.toHtml() ) ; }} ;
int main(int argc, char **argv)
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}