KFile
kurldropdownbutton.cpp
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 #include "kurldropdownbutton_p.h"
00020 #include "kurlnavigator.h"
00021
00022 #include <kglobalsettings.h>
00023
00024 #include <QtGui/QPainter>
00025 #include <QtGui/QKeyEvent>
00026
00027 KUrlDropDownButton::KUrlDropDownButton(KUrlNavigator* parent) :
00028 KUrlButton(parent)
00029 {
00030 setText("...");
00031 }
00032
00033 KUrlDropDownButton::~KUrlDropDownButton()
00034 {
00035 }
00036
00037 QSize KUrlDropDownButton::sizeHint() const
00038 {
00039 int width = fontMetrics().width(text()) + 4 * BorderWidth;
00040 if (width < minimumWidth()) {
00041 width = minimumWidth();
00042 }
00043 return QSize(width, KUrlButton::sizeHint().height());
00044 }
00045
00046 void KUrlDropDownButton::paintEvent(QPaintEvent* event)
00047 {
00048 Q_UNUSED(event);
00049
00050 QPainter painter(this);
00051 drawHoverBackground(&painter);
00052
00053
00054 painter.setPen(foregroundColor());
00055 painter.drawText(rect(), Qt::AlignCenter, text());
00056 }
00057
00058 #include "kurldropdownbutton_p.moc"