File indexing completed on 2025-02-16 11:40:30
0001 /*************************************************************************** 0002 * Copyright (C) 2015 Zoltan Padrah * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 ***************************************************************************/ 0009 0010 #include "diagnosticstyle.h" 0011 0012 #include <QPainter> 0013 #include <QWidget> 0014 0015 void DiagnosticStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const 0016 { 0017 BaseStyle::drawControl(element, option, painter, widget); 0018 if (widget && painter) { 0019 // draw a border around the widget 0020 painter->setPen(QColor("red")); 0021 painter->drawRect(widget->rect()); 0022 0023 // show the classname of the widget 0024 QBrush translucentBrush(QColor(255, 246, 240, 100)); 0025 painter->fillRect(widget->rect(), translucentBrush); 0026 painter->setPen(QColor("darkblue")); 0027 // QFont textFont = painter->font(); 0028 // textFont.setPointSize( 8 ); 0029 // painter->setFont(textFont); 0030 QString text(widget->metaObject()->className()); 0031 text.append(":"); 0032 text.append(widget->objectName()); 0033 painter->drawText(widget->rect(), 0034 Qt::AlignLeft | Qt::AlignTop, 0035 // Qt::AlignRight | Qt::AlignBottom, 0036 text); 0037 } 0038 } 0039 0040 #include "moc_diagnosticstyle.cpp"