2012-04-19 22:42:35 +02:00
|
|
|
/* ============================================================
|
2017-08-11 12:26:50 +02:00
|
|
|
* QupZilla - Qt web browser
|
|
|
|
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
2012-04-19 22:42:35 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#ifndef LOCATIONCOMPLETERDELEGATE_H
|
|
|
|
#define LOCATIONCOMPLETERDELEGATE_H
|
|
|
|
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2012-04-19 22:42:35 +02:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
class LocationCompleterView;
|
2012-04-19 22:42:35 +02:00
|
|
|
|
2014-02-19 22:12:32 +01:00
|
|
|
class QUPZILLA_EXPORT LocationCompleterDelegate : public QStyledItemDelegate
|
2012-04-19 22:42:35 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-04-22 17:09:43 +02:00
|
|
|
explicit LocationCompleterDelegate(LocationCompleterView* parent = 0);
|
2012-04-19 22:42:35 +02:00
|
|
|
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
|
|
|
2014-03-01 13:02:57 +01:00
|
|
|
void setShowSwitchToTab(bool enable);
|
2017-08-11 12:26:50 +02:00
|
|
|
void setOriginalText(const QString &originalText);
|
2012-12-04 14:29:27 +01:00
|
|
|
|
2012-04-19 22:42:35 +02:00
|
|
|
private:
|
2014-03-01 13:02:57 +01:00
|
|
|
bool drawSwitchToTab() const;
|
|
|
|
|
2016-04-24 10:17:13 +02:00
|
|
|
void viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect,
|
2016-12-26 19:40:55 +01:00
|
|
|
const QString &text, const QColor &color,
|
2014-05-29 20:59:02 +02:00
|
|
|
const QString &searchText = QString()) const;
|
2012-08-25 13:08:21 +02:00
|
|
|
|
2012-04-19 22:42:35 +02:00
|
|
|
mutable int m_rowHeight;
|
|
|
|
mutable int m_padding;
|
2012-12-04 14:29:27 +01:00
|
|
|
bool m_drawSwitchToTab;
|
2017-08-11 12:26:50 +02:00
|
|
|
QString m_originalText;
|
2012-04-19 22:42:35 +02:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
LocationCompleterView* m_view;
|
2012-04-19 22:42:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCATIONCOMPLETERDELEGATE_H
|