Added first icons and started to fix with icon states.
@ -31,8 +31,29 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtGui/QListWidget>
|
||||
|
||||
class ListWidgetItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
ListWidgetItemDelegate(QObject* parent = 0) : QStyledItemDelegate(parent) {}
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
Q_ASSERT(index.isValid());
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
|
||||
if (opt.state & QStyle::State_MouseOver) {
|
||||
opt.icon = opt.icon.pixmap(opt.decorationSize, QIcon::Normal, QIcon::On);
|
||||
opt.state &= ~QStyle::State_Selected;
|
||||
}
|
||||
QStyledItemDelegate::paint(painter, opt, index);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* MyListWidget is a plain QListWidget but with the added option
|
||||
* to place the icon above the label in ListMode. This is achieved
|
||||
@ -42,7 +63,7 @@ class QTCREATOR_UTILS_EXPORT MyListWidget : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyListWidget(QWidget *parent) : QListWidget(parent), m_iconAbove(false) { }
|
||||
MyListWidget(QWidget *parent) : QListWidget(parent), m_iconAbove(false) { setItemDelegate(new ListWidgetItemDelegate());}
|
||||
void setIconAbove(bool iconAbove) { m_iconAbove = iconAbove; }
|
||||
protected:
|
||||
QStyleOptionViewItem viewOptions() const;
|
||||
|
@ -19,5 +19,13 @@
|
||||
<file>images/TX2.svg</file>
|
||||
<file>images/camera.png</file>
|
||||
<file>images/txpid.png</file>
|
||||
<file>images/output_selected.png</file>
|
||||
<file>images/output_normal.png</file>
|
||||
<file>images/input_selected.png</file>
|
||||
<file>images/input_normal.png</file>
|
||||
<file>images/hardware_normal.png</file>
|
||||
<file>images/hardware_selected.png</file>
|
||||
<file>images/vehicle_normal.png</file>
|
||||
<file>images/vehicle_selected.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -68,16 +68,28 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
QWidget *qwd;
|
||||
|
||||
qwd = new DefaultHwSettingsWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, QIcon(":/configgadget/images/hw_config.png"), QString("HW Settings"));
|
||||
QIcon *icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
||||
|
||||
icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
qwd = new ConfigVehicleTypeWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::aircraft, qwd, QIcon(":/configgadget/images/Airframe.png"), QString("Aircraft"));
|
||||
ftw->insertTab(ConfigGadgetWidget::aircraft, qwd, *icon, QString("Vehicle"));
|
||||
|
||||
icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
qwd = new ConfigInputWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::input, qwd, QIcon(":/configgadget/images/Transmitter.png"), QString("Input"));
|
||||
ftw->insertTab(ConfigGadgetWidget::input, qwd, *icon, QString("Input"));
|
||||
|
||||
icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
qwd = new ConfigOutputWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::output, qwd, QIcon(":/configgadget/images/Servo.png"), QString("Output"));
|
||||
ftw->insertTab(ConfigGadgetWidget::output, qwd, *icon, QString("Output"));
|
||||
|
||||
qwd = new DefaultAttitudeWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("INS"));
|
||||
@ -152,7 +164,11 @@ void ConfigGadgetWidget::onAutopilotDisconnect() {
|
||||
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("INS"));
|
||||
ftw->removeTab(ConfigGadgetWidget::hardware);
|
||||
qwd = new DefaultHwSettingsWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, QIcon(":/configgadget/images/hw_config.png"), QString("HW Settings"));
|
||||
|
||||
QIcon *icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
||||
|
||||
emit autopilotDisconnected();
|
||||
@ -176,7 +192,10 @@ void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("Attitude"));
|
||||
ftw->removeTab(ConfigGadgetWidget::hardware);
|
||||
qwd = new ConfigCCHWWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, QIcon(":/configgadget/images/hw_config.png"), QString("HW Settings"));
|
||||
QIcon *icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("HW Settings"));
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
||||
} else if ((board & 0xff00) == 256 ) {
|
||||
// Mainboard family
|
||||
@ -199,7 +218,10 @@ void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
ftw->insertTab(ConfigGadgetWidget::sensors, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("Revo"));
|
||||
ftw->removeTab(ConfigGadgetWidget::hardware);
|
||||
qwd = new ConfigProHWWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, QIcon(":/configgadget/images/hw_config.png"), QString("HW Settings"));
|
||||
QIcon *icon = new QIcon();
|
||||
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Normal, QIcon::On);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 24 KiB |
BIN
ground/openpilotgcs/src/plugins/config/images/input_normal.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
ground/openpilotgcs/src/plugins/config/images/input_selected.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
ground/openpilotgcs/src/plugins/config/images/output_normal.png
Normal file
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 29 KiB |
BIN
ground/openpilotgcs/src/plugins/config/images/vehicle_normal.png
Normal file
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 32 KiB |