Changeset cf8d6c9 in sasview for src/sas/qtgui/Perspectives


Ignore:
Timestamp:
Jul 31, 2018 7:27:44 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
516ee4b, 18d5c94a, 8e2cd79
Parents:
4453043
git-author:
Piotr Rozyczko <rozyczko@…> (07/31/18 07:25:32)
git-committer:
Piotr Rozyczko <rozyczko@…> (07/31/18 07:27:44)
Message:

Attempt at realigning the tableview display and euqalising font. SASVIEW-889

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    ree7e423 rcf8d6c9  
    6565 
    6666            painter.save() 
    67             painter.translate(textRect.topLeft()) 
    68             painter.setClipRect(textRect.translated(-textRect.topLeft())) 
     67            rect = textRect.topLeft() 
     68            x = rect.x() 
     69            y = rect.y() 
     70            x += 3.0 # magic value for rendering nice display in the table 
     71            y += 2.0 # magic value for rendering nice display in the table 
     72            rect.setX(x) 
     73            rect.setY(y) 
     74            painter.translate(rect) 
     75            painter.setClipRect(textRect.translated(-rect)) 
    6976            # Draw the QTextDocument in the cell 
    7077            doc.documentLayout().draw(painter, context) 
     
    182189            # Prepare document for inserting into cell 
    183190            doc = QtGui.QTextDocument() 
    184  
     191            current_font = painter.font() 
     192            doc.setDefaultFont(current_font) 
    185193            # Convert the unit description into HTML 
    186194            text_html = GuiUtils.convertUnitToHTML(str(options.text)) 
     
    193201            context = QtGui.QAbstractTextDocumentLayout.PaintContext() 
    194202            textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 
    195  
    196203            painter.save() 
    197             painter.translate(textRect.topLeft()) 
    198             painter.setClipRect(textRect.translated(-textRect.topLeft())) 
     204 
     205            rect = textRect.topLeft() 
     206            y = rect.y() 
     207            y += 5.0 # magic value for rendering nice display in the table 
     208            rect.setY(y) 
     209            painter.translate(rect) 
     210            painter.setClipRect(textRect.translated(-rect)) 
    199211            # Draw the QTextDocument in the cell 
    200212            doc.documentLayout().draw(painter, context) 
     
    260272            # Prepare document for inserting into cell 
    261273            doc = QtGui.QTextDocument() 
    262  
     274            current_font = painter.font() 
     275            doc.setDefaultFont(current_font) 
    263276            # Convert the unit description into HTML 
    264277            text_html = GuiUtils.convertUnitToHTML(str(options.text)) 
     
    273286 
    274287            painter.save() 
    275             painter.translate(textRect.topLeft()) 
    276             painter.setClipRect(textRect.translated(-textRect.topLeft())) 
     288            rect = textRect.topLeft() 
     289            y = rect.y() 
     290            y += 5.0 # magic value for rendering nice display in the table 
     291            rect.setY(y) 
     292            painter.translate(rect) 
     293            painter.setClipRect(textRect.translated(-rect)) 
    277294            # Draw the QTextDocument in the cell 
    278295            doc.documentLayout().draw(painter, context) 
Note: See TracChangeset for help on using the changeset viewer.