30 #ifndef MAPVIZ_WIDGETS_H_
31 #define MAPVIZ_WIDGETS_H_
35 #include <QListWidget>
36 #include <QListWidgetItem>
38 #include <QMouseEvent>
55 for (
size_t i = 0; i < count(); i++)
57 item(i)->setData(Qt::UserRole, QVariant((
float)i));
67 QListWidget::dropEvent(event);
81 virtual bool operator< (
const QListWidgetItem & other)
const
83 return data(Qt::UserRole).toFloat() < other.data(Qt::UserRole).toFloat();
93 QLabel(parent, flags) {}
113 QWidget(parent, flags) {}
124 if (event->button() == Qt::LeftButton)
132 if (event->button() == Qt::RightButton)
144 explicit IconWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0) :
145 QWidget(parent, flags)
162 QPainter painter(
this);
163 painter.fillRect(0, 0, width(), height(), palette().color(QPalette::Button));
165 int x_offset = (width() -
pixmap_.width()) / 2.0;
166 int y_offset = (height() -
pixmap_.height()) / 2.0;
168 painter.drawPixmap(x_offset, y_offset,
pixmap_);
175 #endif // MAPVIZ_WIDGETS_H_