1
/***************************************************************************
2
* Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org> *
4
* This program is free software; you can redistribute it and/or *
5
* modify it under the terms of the GNU General Public License as *
6
* published by the Free Software Foundation; either version 2 of *
7
* the License or (at your option) version 3 or any later version *
8
* accepted by the membership of KDE e.V. (or its successor approved *
9
* by the membership of KDE e.V.), which shall act as a proxy *
10
* defined in Section 14 of version 3 of the license. *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
19
***************************************************************************/
21
#include "BreadcrumbItem.h"
23
#include <QtCore/QStringBuilder>
24
#include <QtWidgets/QPushButton>
26
#include "../AbstractViewBase.h"
27
#include "BreadcrumbItemButton.h"
29
BreadcrumbItem::BreadcrumbItem(QWidget *parent)
31
, m_hasChildren(false)
32
, m_associatedView(nullptr)
34
m_button = new BreadcrumbItemButton(this);
37
connect(m_button, SIGNAL(clicked()), this, SLOT(emitActivated()));
40
BreadcrumbItem::~BreadcrumbItem()
44
BreadcrumbItem *BreadcrumbItem::childItem() const
49
AbstractViewBase *BreadcrumbItem::associatedView() const
51
return m_associatedView;
54
bool BreadcrumbItem::hasChildren() const
59
void BreadcrumbItem::setChildItem(BreadcrumbItem *child)
61
// Only give an arrow if it has never had children. If it has, it will
64
m_button->setText(m_button->text() % ' ' % QString::fromUtf8("➜"));
68
// Setting a null crumb pointer would technically make this false...
72
void BreadcrumbItem::setAssociatedView(AbstractViewBase *view)
74
m_associatedView = view;
77
void BreadcrumbItem::setText(const QString &text)
79
m_button->setText(text);
82
void BreadcrumbItem::setIcon(const QIcon &icon)
84
m_button->setIcon(icon);
87
void BreadcrumbItem::setActive(bool active)
89
m_button->setActive(active);
92
void BreadcrumbItem::emitActivated()
97
#include "BreadcrumbItem.moc"