@@ -44,27 +44,33 @@ void QgsWelcomePageItemDelegate::paint( QPainter* painter, const QStyleOptionVie
44
44
{
45
45
color = QColor ( 255 , 255 , 255 , 60 );
46
46
ctx.palette .setColor ( QPalette::Text, optionV4.palette .color ( QPalette::Active, QPalette::HighlightedText ) );
47
+
48
+ QStyle *style = QApplication::style ();
49
+ style->drawPrimitive ( QStyle::PE_PanelItemViewItem, &option, painter, NULL );
47
50
}
48
51
else if ( option.state & QStyle::State_Enabled )
49
52
{
50
53
color = QColor ( 100 , 100 , 100 , 30 );
51
54
ctx.palette .setColor ( QPalette::Text, optionV4.palette .color ( QPalette::Active, QPalette::Text ) );
55
+
56
+ QStyle *style = QApplication::style ();
57
+ style->drawPrimitive ( QStyle::PE_PanelItemViewItem, &option, painter, NULL );
52
58
}
53
59
else
54
60
{
55
61
color = QColor ( 100 , 100 , 100 , 30 );
56
62
ctx.palette .setColor ( QPalette::Text, optionV4.palette .color ( QPalette::Disabled, QPalette::Text ) );
57
63
}
58
64
59
- QStyle *style = QApplication::style ();
60
- style->drawPrimitive ( QStyle::PE_PanelItemViewItem, &option, painter, NULL );
61
-
62
65
painter->setRenderHint ( QPainter::Antialiasing );
63
66
painter->setPen ( QColor ( 0 , 0 , 0 , 0 ) );
64
67
painter->setBrush ( QBrush ( color ) );
65
68
painter->drawRoundedRect ( option.rect .left () + 5 , option.rect .top () + 5 , option.rect .width () - 10 , option.rect .height () - 10 , 8 , 8 );
66
69
67
- doc.setHtml ( QString ( " <span style='font-size:18px;font-weight:bold;'>%1</span><br>%2<br>%3" ).arg ( index.data ( QgsWelcomePageItemsModel::TitleRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::PathRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::CrsRole ).toString () ) );
70
+ int titleSize = QApplication::fontMetrics ().height () * 1.1 ;
71
+ int textSize = titleSize * 0.85 ;
72
+
73
+ doc.setHtml ( QString ( " <div style='font-size:%1px;'><span style='font-size:%2px;font-weight:bold;'>%3</span><br>%4<br>%5</div>" ).arg ( textSize ).arg ( titleSize ).arg ( index.data ( QgsWelcomePageItemsModel::TitleRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::PathRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::CrsRole ).toString () ) );
68
74
doc.setTextWidth ( 800 );
69
75
70
76
QPixmap icon = qvariant_cast<QPixmap>( index.data ( Qt::DecorationRole ) );
@@ -84,7 +90,10 @@ QSize QgsWelcomePageItemDelegate::sizeHint( const QStyleOptionViewItem & option,
84
90
{
85
91
QTextDocument doc;
86
92
87
- doc.setHtml ( QString ( " <span style='font-size:18px;font-weight:bold;'>%1</span><br>%2<br>%3" ).arg ( index.data ( QgsWelcomePageItemsModel::TitleRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::PathRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::CrsRole ).toString () ) );
93
+ int titleSize = QApplication::fontMetrics ().height () * 1.1 ;
94
+ int textSize = titleSize * 0.85 ;
95
+
96
+ doc.setHtml ( QString ( " <div style='font-size:%1px;'><span style='font-size:%2px;font-weight:bold;'>%3</span><br>%4<br>%5</div>" ).arg ( textSize ).arg ( titleSize ).arg ( index.data ( QgsWelcomePageItemsModel::TitleRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::PathRole ).toString () ).arg ( index.data ( QgsWelcomePageItemsModel::CrsRole ).toString () ) );
88
97
doc.setTextWidth ( 800 );
89
98
90
99
QPixmap icon = qvariant_cast<QPixmap>( index.data ( Qt::DecorationRole ) );
0 commit comments