mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Added new icons and fixed icon states when selected/highlighted.
This commit is contained in:
parent
28afadf8b9
commit
d765ac01d5
@ -31,29 +31,8 @@
|
||||
|
||||
#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
|
||||
@ -63,7 +42,7 @@ class QTCREATOR_UTILS_EXPORT MyListWidget : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyListWidget(QWidget *parent) : QListWidget(parent), m_iconAbove(false) { setItemDelegate(new ListWidgetItemDelegate());}
|
||||
MyListWidget(QWidget *parent) : QListWidget(parent), m_iconAbove(false) {}
|
||||
void setIconAbove(bool iconAbove) { m_iconAbove = iconAbove; }
|
||||
protected:
|
||||
QStyleOptionViewItem viewOptions() const;
|
||||
|
@ -48,6 +48,7 @@ MyTabbedStackWidget::MyTabbedStackWidget(QWidget *parent, bool isVertical, bool
|
||||
toplevelLayout->addWidget(m_stackWidget);
|
||||
m_listWidget->setFlow(QListView::TopToBottom);
|
||||
m_listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
m_listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
} else {
|
||||
toplevelLayout = new QVBoxLayout;
|
||||
toplevelLayout->addWidget(m_stackWidget);
|
||||
|
@ -70,24 +70,24 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
qwd = new DefaultHwSettingsWidget(this);
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
qwd = new ConfigVehicleTypeWidget(this);
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
qwd = new ConfigInputWidget(this);
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
qwd = new ConfigOutputWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::output, qwd, *icon, QString("Output"));
|
||||
|
||||
@ -106,6 +106,7 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
qwd = new ConfigTxPIDWidget(this);
|
||||
ftw->insertTab(ConfigGadgetWidget::txpid, qwd, QIcon(":/configgadget/images/txpid.png"), QString("TxPID"));
|
||||
|
||||
ftw->setCurrentIndex(0);
|
||||
// *********************
|
||||
// Listen to autopilot connection events
|
||||
|
||||
@ -167,7 +168,7 @@ void ConfigGadgetWidget::onAutopilotDisconnect() {
|
||||
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
||||
|
||||
@ -194,7 +195,7 @@ void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
qwd = new ConfigCCHWWidget(this);
|
||||
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);
|
||||
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
|
||||
ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("HW Settings"));
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
|
||||
} else if ((board & 0xff00) == 256 ) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 20 KiB |
Loading…
x
Reference in New Issue
Block a user