summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-05-02 15:21:05 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-05-02 13:45:34 +0000
commite126ccfa0c8f06bd52f0175766dd5a5321d74325 (patch)
tree231a2f1333ace09af06907ab9e64a01d5e827970
parent365bddbe0e8cb53a30e818c0ebd54e2a6c8560b1 (diff)
downloadqttools-e126ccfa0c8f06bd52f0175766dd5a5321d74325.tar.gz
Qt Designer: Base ObjectInspectorDelegate on QStyledItemDelegate.
The class previously was inheriting QItemDelegate which caused it to paint in Windows XP style. This style has a very low contrast when the widget does not have focus, which makes it hard to spot the selected widget when working on the form. Task-number: QTBUG-53020 Change-Id: I69e9e950ca1cc8b4d6ccbf55fd48a54d50eac7e1 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp
index b182a1485..324d7764e 100644
--- a/src/designer/src/components/objectinspector/objectinspector.cpp
+++ b/src/designer/src/components/objectinspector/objectinspector.cpp
@@ -63,7 +63,7 @@
#include <QtCore/QItemSelectionModel>
#include <QtWidgets/QMenu>
#include <QtWidgets/QTreeView>
-#include <QtWidgets/QItemDelegate>
+#include <QtWidgets/QStyledItemDelegate>
#include <QtGui/qevent.h>
#include <QtCore/QVector>
@@ -119,7 +119,7 @@ static inline QPoint dropPointOffset(const qdesigner_internal::FormWindowBase *f
namespace qdesigner_internal {
// Delegate with object name validator for the object name column
-class ObjectInspectorDelegate : public QItemDelegate {
+class ObjectInspectorDelegate : public QStyledItemDelegate {
public:
explicit ObjectInspectorDelegate(QObject *parent = 0);
@@ -127,14 +127,14 @@ public:
};
ObjectInspectorDelegate::ObjectInspectorDelegate(QObject *parent) :
- QItemDelegate(parent)
+ QStyledItemDelegate(parent)
{
}
QWidget *ObjectInspectorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & option, const QModelIndex &index) const
{
if (index.column() != ObjectInspectorModel::ObjectNameColumn)
- return QItemDelegate::createEditor(parent, option, index);
+ return QStyledItemDelegate::createEditor(parent, option, index);
// Object name editor
const bool isMainContainer = !index.parent().isValid();
return new TextPropertyEditor(parent, TextPropertyEditor::EmbeddingTreeView,
@@ -249,6 +249,7 @@ ObjectInspector::ObjectInspectorPrivate::ObjectInspectorPrivate(QDesignerFormEdi
m_treeView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_treeView->header()->setSectionResizeMode(1, QHeaderView::Stretch);
m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_treeView->setAlternatingRowColors(true);
m_treeView->setTextElideMode (Qt::ElideMiddle);