X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fheader.cpp;h=0e9445ea239e7a9879e1b88f24e1610b6a09b591;hb=c063290ac7189bdd15221450f598504f43286b43;hp=bfb75532aa58ad7508db13b1243ce051613e131c;hpb=adf3aaf490ad6f04f7a92a5bc01581f3075b1e9e;p=pulseview.git
diff --git a/pv/view/header.cpp b/pv/view/header.cpp
index bfb7553..0e9445e 100644
--- a/pv/view/header.cpp
+++ b/pv/view/header.cpp
@@ -14,8 +14,7 @@
* 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
#include "header.hpp"
@@ -39,17 +38,16 @@
#include
using boost::make_filter_iterator;
+
+using std::count_if;
using std::dynamic_pointer_cast;
-using std::max;
-using std::make_pair;
-using std::min;
-using std::pair;
using std::shared_ptr;
using std::stable_sort;
using std::vector;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
const int Header::Padding = 12;
const int Header::BaselineOffset = 5;
@@ -105,18 +103,16 @@ void Header::paintEvent(QPaintEvent*)
// would be clipped away.
const QRect rect(0, 0, width() - BaselineOffset, height());
- vector< shared_ptr > items(
- view_.list_by_type());
+ vector< shared_ptr > items(view_.list_by_type());
stable_sort(items.begin(), items.end(),
- [](const shared_ptr &a, const shared_ptr &b) {
- return a->visual_v_offset() < b->visual_v_offset(); });
+ [](const shared_ptr &a, const shared_ptr &b) {
+ return a->point(QRect()).y() < b->point(QRect()).y(); });
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
- for (const shared_ptr r : items)
- {
+ for (const shared_ptr r : items) {
assert(r);
const bool highlight = !item_dragging_ &&
@@ -139,8 +135,7 @@ void Header::contextMenuEvent(QContextMenuEvent *event)
const vector< shared_ptr > items(
view_.list_by_type());
- if (std::count_if(items.begin(), items.end(), item_selected) > 1)
- {
+ if (count_if(items.begin(), items.end(), item_selected) > 1) {
menu->addSeparator();
QAction *const group = new QAction(tr("Group"), this);
@@ -154,15 +149,15 @@ void Header::contextMenuEvent(QContextMenuEvent *event)
menu->exec(event->globalPos());
}
-void Header::keyPressEvent(QKeyEvent *e)
+void Header::keyPressEvent(QKeyEvent *event)
{
- assert(e);
+ assert(event);
- MarginWidget::keyPressEvent(e);
+ MarginWidget::keyPressEvent(event);
- if (e->key() == Qt::Key_G && e->modifiers() == Qt::ControlModifier)
+ if (event->key() == Qt::Key_G && event->modifiers() == Qt::ControlModifier)
on_group();
- else if (e->key() == Qt::Key_U && e->modifiers() == Qt::ControlModifier)
+ else if (event->key() == Qt::Key_U && event->modifiers() == Qt::ControlModifier)
on_ungroup();
}
@@ -179,7 +174,7 @@ void Header::on_group()
shared_ptr group(new TraceGroup());
shared_ptr mouse_down_item(
- std::dynamic_pointer_cast(mouse_down_item_));
+ dynamic_pointer_cast(mouse_down_item_));
shared_ptr focus_item(
mouse_down_item ? mouse_down_item : selected_items.front());
@@ -219,5 +214,6 @@ void Header::on_ungroup()
} while (restart);
}
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv