Plasma
titlecombobox.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TITLECOMBOBOX_H
00021 #define TITLECOMBOBOX_H
00022
00023 #include <QComboBox>
00024 #include <QPainter>
00025
00026 #include <KDebug>
00027 #include <KLocale>
00028
00029 class TitleComboBox : public QComboBox
00030 {
00031 public:
00032 TitleComboBox(QWidget *parent = 0)
00033 : QComboBox(parent)
00034 {
00035 }
00036
00037 protected:
00038 void paintEvent(QPaintEvent *event)
00039 {
00040 QComboBox::paintEvent(event);
00041
00042 if (currentIndex() != -1) {
00043 return;
00044 }
00045
00046 QPainter p(this);
00047
00048
00049
00050 p.setPen(palette().color(QPalette::Disabled, QPalette::WindowText));
00051 int frameWidth = style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth);
00052 QRect r = rect().adjusted(frameWidth, frameWidth, frameWidth, frameWidth);
00053 p.drawText(QStyle::visualRect(layoutDirection(), rect(), r), i18n("Data Engines"));
00054 }
00055 };
00056
00057 #endif
00058