##

Palette.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_GUI_PLOT_PALETTE_HH_
#define GAZEBO_GUI_PLOT_PALETTE_HH_
#include <memory>
#include <set>
#include <string>
#include "gazebo/gui/qt.h"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/util/system.hh"
namespace google
{
namespace protobuf
{
class Message;
}
}
namespace gazebo
{
namespace common
{
class URI;
}
namespace gui
{
class SearchModel : public QSortFilterProxyModel
{
public: bool filterAcceptsRow(const int _srcRow,
const QModelIndex &_srcParent) const;
public: bool filterAcceptsRowItself(const int _srcRow, const
QModelIndex &_srcParent, QString _word) const;
public: bool hasAcceptedChildren(const int _srcRow,
const QModelIndex &_srcParent) const;
public: bool hasChildAcceptsItself(const QModelIndex &_srcParent,
const QString &_word) const;
public: void SetSearch(const QString &_search);
public: QString search;
};
// Forward declare private data class
class PalettePrivate;
class GZ_GUI_VISIBLE Palette : public QWidget
{
Q_OBJECT
public: explicit Palette(QWidget *_parent);
public: ~Palette();
private: void FillTopics();
private: void FillModels();
private: void FillSim();
private: void FillFromMsg(google::protobuf::Message *_msg,
QStandardItem *_item, const std::string &_uri);
private: void InsertPoseItem(QStandardItem *_item,
const common::URI &_uri, const std::string &_query);
private: void InsertVector3dItem(QStandardItem *_item,
const common::URI &_uri, const std::string &_query);
private: void InsertQuaterniondItem(QStandardItem *_item,
const common::URI &_uri, const std::string &_query);
private: void InsertAxisItem(QStandardItem *_item,
const common::URI &_uri, const std::string &_query);
private slots: void UpdateSearch(const QString &_search);
private: void ExpandChildren(QSortFilterProxyModel *_model,
QTreeView *_tree, const QModelIndex &_srcParent) const;
private: void OnIntrospectionUpdate(const std::set<std::string> &_items,
const bool _result);
private: void OnIntrospectionUpdate(const gazebo::msgs::Param_V &_msg);
Q_SIGNALS: void IntrospectionUpdateSignal(
const std::set<std::string> &_items);
private slots: void IntrospectionUpdateSlot(
const std::set<std::string> &_items);
private slots: void ExpandTree(const QModelIndex &_index);
private: std::unique_ptr<PalettePrivate> dataPtr;
};
}
}
#endif
gazebo::gui::SearchModel::filterAcceptsRow
bool filterAcceptsRow(const int _srcRow, const QModelIndex &_srcParent) const
Customize so we accept rows where:
gazebo::common::URI
A complete URI.
Definition: URI.hh:176
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
gazebo::gui::SearchModel
Customize the proxy model to display search results.
Definition: Palette.hh:47
common
common
Definition: FuelModelDatabase.hh:37
system.hh
msgs.hh
gazebo::gui::SearchModel::hasChildAcceptsItself
bool hasChildAcceptsItself(const QModelIndex &_srcParent, const QString &_word) const
Check if any of the children accepts a specific word.
gazebo::gui::Palette::IntrospectionUpdateSignal
void IntrospectionUpdateSignal(const std::set< std::string > &_items)
Signal to trigger IntrospectionUpdateSlot.
gazebo::common::Param_V
std::vector< common::Param * > Param_V
Definition: CommonTypes.hh:97
gazebo::gui::SearchModel::hasAcceptedChildren
bool hasAcceptedChildren(const int _srcRow, const QModelIndex &_srcParent) const
Check if any of the children is fully accepted.
gazebo::gui::Palette::~Palette
~Palette()
Destructor.
gui
gui
Definition: KeyEventHandler.hh:29
gazebo::gui::Palette::Palette
Palette(QWidget *_parent)
Constructor.
gazebo::gui::SearchModel::search
QString search
Full search string.
Definition: Palette.hh:100
gazebo::gui::Palette
A palette for the plot window, where plottable items can be dragged from.
Definition: Palette.hh:108
gazebo::gui::SearchModel::filterAcceptsRowItself
bool filterAcceptsRowItself(const int _srcRow, const QModelIndex &_srcParent, QString _word) const
Check if row contains the word on itself.
gazebo::gui::SearchModel::SetSearch
void SetSearch(const QString &_search)
Set a new search value.
google
Definition: ConfigWidget.hh:33