1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
/*
* This file is part of the PulseView project.
*
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
*
* 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 2 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/>.
*/
#include "viewitem.hpp"
#include <climits>
#include <QApplication>
#include <QMenu>
#include <QPalette>
namespace pv {
namespace views {
namespace trace {
const QSizeF ViewItem::LabelPadding(4, 0);
const int ViewItem::HighlightRadius = 3;
ViewItem::ViewItem() :
context_parent_(nullptr),
drag_point_(INT_MIN, INT_MIN),
selected_(false)
{
}
bool ViewItem::is_selectable(QPoint pos) const
{
(void)pos;
return true;
}
bool ViewItem::selected() const
{
return selected_;
}
void ViewItem::select(bool select)
{
selected_ = select;
}
bool ViewItem::is_draggable(QPoint pos) const
{
(void)pos;
return true;
}
bool ViewItem::dragging() const
{
return drag_point_.x() != INT_MIN && drag_point_.y() != INT_MIN;
}
void ViewItem::drag()
{
drag_point_ = drag_point(QRect());
}
void ViewItem::drag_release()
{
drag_point_ = QPoint(INT_MIN, INT_MIN);
}
QRectF ViewItem::label_rect(const QRectF &rect) const
{
(void)rect;
return QRectF();
}
QRectF ViewItem::hit_box_rect(const ViewItemPaintParams &pp) const
{
(void)pp;
return QRectF();
}
QMenu* ViewItem::create_header_context_menu(QWidget *parent)
{
context_parent_ = parent;
return new QMenu(parent);
}
QMenu* ViewItem::create_view_context_menu(QWidget *parent, QPoint &click_pos)
{
(void)parent;
(void)click_pos;
return nullptr;
}
widgets::Popup* ViewItem::create_popup(QWidget *parent)
{
(void)parent;
return nullptr;
}
void ViewItem::delete_pressed()
{
}
QPen ViewItem::highlight_pen()
{
return QPen(QApplication::palette().brush(
QPalette::Highlight), HighlightRadius * 2,
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
}
void ViewItem::paint_label(QPainter &p, const QRect &rect, bool hover)
{
(void)p;
(void)rect;
(void)hover;
}
void ViewItem::paint_back(QPainter &p, ViewItemPaintParams &pp)
{
(void)p;
(void)pp;
}
void ViewItem::paint_mid(QPainter &p, ViewItemPaintParams &pp)
{
(void)p;
(void)pp;
}
void ViewItem::paint_fore(QPainter &p, ViewItemPaintParams &pp)
{
(void)p;
(void)pp;
}
QColor ViewItem::select_text_color(QColor background)
{
return (background.lightness() > 110) ? Qt::black : Qt::white;
}
void ViewItem::hover_point_changed(const QPoint &hp)
{
(void)hp;
}
void ViewItem::mouse_left_press_event(const QMouseEvent* event)
{
(void)event;
}
} // namespace trace
} // namespace views
} // namespace pv
|