Commit 421019de authored by Kurt Hindenburg's avatar Kurt Hindenburg

Change QStyleOptionViewItemV3 and V4 to QStyleOptionViewItem

QStyleOptionViewItemV3 and QStyleOptionViewItemV4 were depreciated in
Qt 5.7
parent d3d2653b
......@@ -405,14 +405,16 @@ void ProfileSettings::setShortcutEditorVisible(bool visible)
void StyledBackgroundPainter::drawBackground(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex&)
{
const auto* v3option = qstyleoption_cast<const QStyleOptionViewItemV3*>(&option);
const QWidget* widget = v3option != nullptr ? v3option->widget : nullptr;
const auto* opt = qstyleoption_cast<const QStyleOptionViewItem*>(&option);
const QWidget* widget = opt != nullptr ? opt->widget : nullptr;
QStyle* style = widget != nullptr ? widget->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, widget);
}
// This adds a checkmark and the appropriate background in the "Show"
// column of the Manage Profiles->Profiles page.
FavoriteItemDelegate::FavoriteItemDelegate(QObject* aParent)
: QStyledItemDelegate(aParent)
{
......@@ -420,7 +422,7 @@ FavoriteItemDelegate::FavoriteItemDelegate(QObject* aParent)
void FavoriteItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
// See implementation of QStyledItemDelegate::paint()
QStyleOptionViewItemV4 opt = option;
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
StyledBackgroundPainter::drawBackground(painter, opt, index);
......
Markdown is supported
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