Commit 2a475134 authored by David Jarvie's avatar David Jarvie
Browse files

Rationalise use of listViewOptions()

parent 387f37e3
Pipeline #209398 passed with stage
in 1 minute and 46 seconds
......@@ -112,17 +112,6 @@ void AlarmListView::initSections()
header()->resizeSection(AlarmListModel::TypeColumn, AlarmListModel::iconWidth() + 2*margin + 2);
}
QStyleOptionViewItem AlarmListView::listViewOptions() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QTreeView::viewOptions();
#else
QStyleOptionViewItem option;
initViewItemOption(&option);
return option;
#endif
}
/******************************************************************************
* Called when the column order is changed.
* Save the new order for restoration on program restart.
......
......@@ -39,7 +39,6 @@ private:
void showHideColumn(QMenu&, QAction*);
void setReplaceBlankName();
void enableTimeColumns(QMenu*);
QStyleOptionViewItem listViewOptions() const;
QByteArray mConfigGroup;
};
......
......@@ -156,18 +156,6 @@ void EventListView::resizeEvent(QResizeEvent* se)
initSections();
}
QStyleOptionViewItem EventListView::listViewOptions() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QTreeView::viewOptions();
#else
QStyleOptionViewItem option;
initViewItemOption(&option);
return option;
#endif
}
/******************************************************************************
* Called when a ToolTip or WhatsThis event occurs.
*/
......@@ -216,6 +204,17 @@ void EventListView::contextMenuEvent(QContextMenuEvent* e)
Q_EMIT contextMenuRequested(e->globalPos());
}
QStyleOptionViewItem EventListView::listViewOptions() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QTreeView::viewOptions();
#else
QStyleOptionViewItem option;
initViewItemOption(&option);
return option;
#endif
}
bool EventListDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, const QStyleOptionViewItem&, const QModelIndex& index)
{
......
......@@ -47,13 +47,13 @@ protected:
void resizeEvent(QResizeEvent*) override;
bool viewportEvent(QEvent*) override;
void contextMenuEvent(QContextMenuEvent*) override;
QStyleOptionViewItem listViewOptions() const;
protected Q_SLOTS:
virtual void initSections() = 0;
void sortChanged(int column, Qt::SortOrder);
private:
QStyleOptionViewItem listViewOptions() const;
void findNext(bool forward);
Find* mFind {nullptr};
......
......@@ -721,4 +721,5 @@ QStyleOptionViewItem ResourceView::listViewOptions() const
return option;
#endif
}
// vim: et sw=4:
......@@ -236,7 +236,6 @@ Q_SIGNALS:
protected:
void mouseReleaseEvent(QMouseEvent*) override;
bool viewportEvent(QEvent*) override;
private:
QStyleOptionViewItem listViewOptions() const;
};
......
......@@ -39,17 +39,6 @@ void TemplateListView::initSections()
sortByColumn(TemplateListModel::TemplateNameColumn, Qt::AscendingOrder);
}
QStyleOptionViewItem TemplateListView::listViewOptions() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QTreeView::viewOptions();
#else
QStyleOptionViewItem option;
initViewItemOption(&option);
return option;
#endif
}
void TemplateListDelegate::edit(KAEvent& event, EventListView* view)
{
KAlarm::editTemplate(event, static_cast<TemplateListView*>(view));
......
......@@ -19,8 +19,6 @@ public:
protected Q_SLOTS:
void initSections() override;
private:
QStyleOptionViewItem listViewOptions() const;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment