forked from blue/squawk
cleanup some warnings suppression
This commit is contained in:
parent
5fbb03fc46
commit
23ec80ccba
26 changed files with 630 additions and 924 deletions
|
@ -18,35 +18,30 @@
|
|||
#include "QTimer"
|
||||
|
||||
#include "comboboxdelegate.h"
|
||||
#include "shared/defines.h"
|
||||
|
||||
ComboboxDelegate::ComboboxDelegate(QObject *parent):
|
||||
QStyledItemDelegate(parent),
|
||||
entries(),
|
||||
ff(new FocusFilter())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
ComboboxDelegate::~ComboboxDelegate()
|
||||
{
|
||||
ComboboxDelegate::~ComboboxDelegate() {
|
||||
delete ff;
|
||||
}
|
||||
|
||||
|
||||
QWidget* ComboboxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QWidget* ComboboxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
SHARED_UNUSED(option);
|
||||
SHARED_UNUSED(index);
|
||||
QComboBox *cb = new QComboBox(parent);
|
||||
|
||||
for (const std::pair<QString, QIcon>& pair : entries) {
|
||||
for (const std::pair<QString, QIcon>& pair : entries)
|
||||
cb->addItem(pair.second, pair.first);
|
||||
}
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
|
||||
void ComboboxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
void ComboboxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
|
||||
QComboBox *cb = static_cast<QComboBox*>(editor);
|
||||
int currentIndex = index.data(Qt::EditRole).toInt();
|
||||
if (currentIndex >= 0) {
|
||||
|
@ -56,19 +51,16 @@ void ComboboxDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
|
|||
}
|
||||
|
||||
|
||||
void ComboboxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
void ComboboxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
|
||||
QComboBox *cb = static_cast<QComboBox *>(editor);
|
||||
model->setData(index, cb->currentIndex(), Qt::EditRole);
|
||||
}
|
||||
|
||||
void ComboboxDelegate::addEntry(const QString& title, const QIcon& icon)
|
||||
{
|
||||
void ComboboxDelegate::addEntry(const QString& title, const QIcon& icon) {
|
||||
entries.emplace_back(title, icon);
|
||||
}
|
||||
|
||||
bool ComboboxDelegate::FocusFilter::eventFilter(QObject* src, QEvent* evt)
|
||||
{
|
||||
bool ComboboxDelegate::FocusFilter::eventFilter(QObject* src, QEvent* evt) {
|
||||
if (evt->type() == QEvent::FocusIn) {
|
||||
QComboBox* cb = static_cast<QComboBox*>(src);
|
||||
cb->removeEventFilter(this);
|
||||
|
|
|
@ -18,14 +18,13 @@
|
|||
|
||||
#include "resizer.h"
|
||||
|
||||
Resizer::Resizer(QWidget* parent):
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
#include "shared/defines.h"
|
||||
|
||||
bool Resizer::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
Resizer::Resizer(QWidget* parent):
|
||||
QObject(parent) {}
|
||||
|
||||
bool Resizer::eventFilter(QObject* obj, QEvent* event) {
|
||||
SHARED_UNUSED(obj);
|
||||
if (event->type() == QEvent::Resize) {
|
||||
QResizeEvent* ev = static_cast<QResizeEvent*>(event);
|
||||
emit resized(ev->oldSize(), ev->size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue