File indexing completed on 2024-05-05 05:37:10
0001 /* 0002 * SPDX-FileCopyrightText: 2008 Aaron Seigo <aseigo@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef TITLECOMBOBOX_H 0008 #define TITLECOMBOBOX_H 0009 0010 #include <KLocalizedString> 0011 0012 #include <QComboBox> 0013 #include <QPainter> 0014 0015 #include <QDebug> 0016 0017 class TitleComboBox : public QComboBox 0018 { 0019 public: 0020 explicit TitleComboBox(QWidget *parent = nullptr) 0021 : QComboBox(parent) 0022 { 0023 } 0024 0025 protected: 0026 void paintEvent(QPaintEvent *event) override 0027 { 0028 QComboBox::paintEvent(event); 0029 0030 if (currentIndex() != -1) { 0031 return; 0032 } 0033 0034 QPainter p(this); 0035 /*QFont bold = p.font(); 0036 bold.setBold(true); 0037 p.setFont(bold);*/ 0038 p.setPen(palette().color(QPalette::Disabled, QPalette::WindowText)); 0039 int frameWidth = style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth); 0040 QRect r = rect().adjusted(frameWidth, frameWidth, frameWidth, frameWidth); 0041 p.drawText(QStyle::visualRect(layoutDirection(), rect(), r), i18n("Data Engines")); 0042 } 0043 }; 0044 0045 #endif