]>
cloud.milkyroute.net Git - dolphin.git/blob - src/kurlbutton.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
3 * Copyright (C) 2006 by Aaron J. Seigo (<aseigo@kde.org>) *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "kurlbutton_p.h"
23 #include "kurlnavigator.h"
25 KUrlButton::KUrlButton(KUrlNavigator
* parent
) :
28 m_urlNavigator(parent
)
30 setFocusPolicy(Qt::NoFocus
);
31 setSizePolicy(QSizePolicy::Maximum
, QSizePolicy::Fixed
);
32 setMinimumHeight(parent
->minimumHeight());
34 connect(this, SIGNAL(clicked()), parent
, SLOT(requestActivation()));
37 KUrlButton::~KUrlButton()
41 void KUrlButton::setDisplayHintEnabled(DisplayHint hint
,
45 m_displayHint
= m_displayHint
| hint
;
48 m_displayHint
= m_displayHint
& ~hint
;
53 bool KUrlButton::isDisplayHintEnabled(DisplayHint hint
) const
55 return (m_displayHint
& hint
) > 0;
58 void KUrlButton::enterEvent(QEvent
* event
)
60 QPushButton::enterEvent(event
);
61 setDisplayHintEnabled(EnteredHint
, true);
65 void KUrlButton::leaveEvent(QEvent
* event
)
67 QPushButton::leaveEvent(event
);
68 setDisplayHintEnabled(EnteredHint
, false);
72 QColor
KUrlButton::mixColors(const QColor
& c1
,
73 const QColor
& c2
) const
75 const int red
= (c1
.red() + c2
.red()) / 2;
76 const int green
= (c1
.green() + c2
.green()) / 2;
77 const int blue
= (c1
.blue() + c2
.blue()) / 2;
78 return QColor(red
, green
, blue
);
81 #include "kurlbutton_p.moc"