Commit c778d7a3 authored by Alessandro Portale's avatar Alessandro Portale

TextEditor: Snippetssettings QTableView to QTreeView

QTreeView is a better list view with columns than QTableView.
One special reason for this change is that QTreeView
finds a proper default row height regardless of the system
DPI.

Change-Id: I80c7fe0d15be620162cefa53b5b231b62931c614
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent b8df1a9b
......@@ -38,6 +38,7 @@
#include <coreplugin/icore.h>
#include <texteditor/texteditorsettings.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/headerviewstretcher.h>
#include <QAbstractTableModel>
#include <QList>
......@@ -341,12 +342,8 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent()));
}
m_ui.snippetsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
m_ui.snippetsTable->setSelectionMode(QAbstractItemView::SingleSelection);
m_ui.snippetsTable->horizontalHeader()->setStretchLastSection(true);
m_ui.snippetsTable->horizontalHeader()->setHighlightSections(false);
m_ui.snippetsTable->verticalHeader()->setVisible(false);
m_ui.snippetsTable->setModel(m_model);
new Utils::HeaderViewStretcher(m_ui.snippetsTable->header(), 1);
m_ui.revertButton->setEnabled(false);
......
......@@ -2,19 +2,97 @@
<ui version="4.0">
<class>TextEditor::Internal::SnippetsSettingsPage</class>
<widget class="QWidget" name="TextEditor::Internal::SnippetsSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>684</width>
<height>554</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QTreeView" name="snippetsTable">
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
</widget>
<widget class="QStackedWidget" name="snippetsEditorStack">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</widget>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="revertButton">
<property name="text">
<string>Revert Built-in</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="restoreRemovedButton">
<property name="text">
<string>Restore Removed Built-ins</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="resetAllButton">
<property name="text">
<string>Reset All</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="groupLabel">
......@@ -41,88 +119,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="snippetsTable">
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="snippetsEditorStack">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="revertButton">
<property name="text">
<string>Revert Built-in</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="restoreRemovedButton">
<property name="text">
<string>Restore Removed Built-ins</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="resetAllButton">
<property name="text">
<string>Reset All</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
......
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