+ // draw line with small text string for separator
+ if (opt.text.left(2) == "--") {
+ painter->save();
+
+ // set options for the separator, the first 8/18 of the vertical space
+ QStyleOptionMenuItem sopt = opt;
+ sopt.state = QStyle::State_Active | QStyle::State_Enabled;
+ sopt.checked = false;
+ sopt.text = QString();
+ sopt.rect.setHeight(sopt.rect.height() * 8 / 18);
+ sopt.menuRect.setHeight(sopt.menuRect.height() * 8 / 18);
+
+ // use the style with an empty text to paint the background
+ painter->eraseRect(sopt.rect);
+ combo->style()->drawControl(QStyle::CE_MenuItem, &sopt, painter, combo->view());
+
+ // draw the centered text, small and bold
+ QPen pen;
+ pen.setWidth(1);
+ pen.setColor(sopt.palette.text().color());
+ painter->setPen(pen);
+ QFont font = sopt.font;
+ font.setBold(true);
+ font.setWeight(QFont::Black);
+ font.setPointSize(sopt.font.pointSize() * 8 / 10);
+ painter->setFont(font);
+ QRect brect;
+ painter->drawText(sopt.rect, Qt::AlignCenter, "Modules", &brect);
+
+ // draw the horizontal line
+ QColor lcol = sopt.palette.text().color();
+ lcol.setAlpha(127);
+ painter->setPen(lcol);
+ painter->drawLine(sopt.rect.x(), sopt.rect.y() + sopt.rect.height() / 2 ,
+ brect.left() - 1, sopt.rect.y() + sopt.rect.height() / 2);
+ painter->drawLine(brect.right() + 1, sopt.rect.y() + sopt.rect.height() / 2,
+ sopt.rect.right(), sopt.rect.y() + sopt.rect.height() / 2);
+
+ painter->restore();
+
+ // move rect down 8/20 of the original height
+ opt.rect.setTop(sopt.rect.y() + sopt.rect.height());
+ opt.menuRect = opt.rect;
+ }
+