Merge branch 'experimental/qml-edit' into experimental/add-tree-children
# Conflicts: # src/application/xqchildmodel.cpp
This commit is contained in:
@@ -119,6 +119,29 @@ void XQItemDelegate::drawHeaderStyle(QPainter* painter, const QStyleOptionViewIt
|
||||
{
|
||||
QStyleOptionHeader headerOption;
|
||||
|
||||
/*
|
||||
QWidget* srcWidget = nullptr;
|
||||
const QTreeView* treeView = qobject_cast<const QTreeView*>(option.widget);
|
||||
if (treeView != nullptr)
|
||||
{
|
||||
srcWidget = (QWidget*)treeView;
|
||||
// is never nullptr !?
|
||||
if (treeView->header() != nullptr)
|
||||
{
|
||||
// use the header as "parent" for style init
|
||||
srcWidget = treeView->header();
|
||||
}
|
||||
headerOption.initFrom(srcWidget);
|
||||
headerOption.text = "FIRZ";//index.data(Qt::DisplayRole).toString();
|
||||
headerOption.rect = option.rect;
|
||||
headerOption.styleObject = option.styleObject;
|
||||
// __ch: reduce inner offset when painting
|
||||
headerOption.textAlignment |= Qt::AlignVCenter;
|
||||
|
||||
// --
|
||||
}
|
||||
*/
|
||||
|
||||
// use the header as "parent" for style init
|
||||
QWidget* srcWidget = treeTable();//->header();
|
||||
headerOption.initFrom(srcWidget);
|
||||
@@ -129,11 +152,13 @@ void XQItemDelegate::drawHeaderStyle(QPainter* painter, const QStyleOptionViewIt
|
||||
headerOption.textAlignment |= Qt::AlignVCenter;
|
||||
headerOption.icon = item.icon();
|
||||
|
||||
|
||||
// save painter
|
||||
painter->save();
|
||||
|
||||
|
||||
QStyle* widgetStyle = srcWidget->style();
|
||||
widgetStyle->drawControl(QStyle::CE_Header, &headerOption, painter, srcWidget);
|
||||
QApplication::style()->drawControl(QStyle::CE_Header, &headerOption, painter, srcWidget);
|
||||
// restore painter
|
||||
painter->restore();
|
||||
|
||||
@@ -254,6 +279,8 @@ QSize XQItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelI
|
||||
|
||||
QWidget* XQItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
|
||||
XQItem& item = xqItemFromIndex(index);
|
||||
XQItem::EditorType edType = item.editorType();
|
||||
if( edType == XQItem::NoEditorType )
|
||||
|
Reference in New Issue
Block a user