forked from qt-creator/qt-creator
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: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <texteditor/texteditorsettings.h>
|
#include <texteditor/texteditorsettings.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <utils/headerviewstretcher.h>
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -341,12 +342,8 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
|||||||
connect(snippetEditor, SIGNAL(snippetContentChanged()), this, SLOT(setSnippetContent()));
|
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);
|
m_ui.snippetsTable->setModel(m_model);
|
||||||
|
new Utils::HeaderViewStretcher(m_ui.snippetsTable->header(), 1);
|
||||||
|
|
||||||
m_ui.revertButton->setEnabled(false);
|
m_ui.revertButton->setEnabled(false);
|
||||||
|
|
||||||
|
@@ -2,63 +2,35 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>TextEditor::Internal::SnippetsSettingsPage</class>
|
<class>TextEditor::Internal::SnippetsSettingsPage</class>
|
||||||
<widget class="QWidget" name="TextEditor::Internal::SnippetsSettingsPage">
|
<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">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QSplitter" name="splitter">
|
||||||
<item>
|
<property name="sizePolicy">
|
||||||
<widget class="QLabel" name="groupLabel">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
<property name="text">
|
<horstretch>0</horstretch>
|
||||||
<string>Group: </string>
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="groupCombo"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="childrenCollapsible">
|
||||||
<size>
|
<bool>false</bool>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<widget class="QTreeView" name="snippetsTable">
|
||||||
</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">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid">
|
<property name="rootIsDecorated">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="gridStyle">
|
<property name="uniformRowHeights">
|
||||||
<enum>Qt::NoPen</enum>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QStackedWidget" name="snippetsEditorStack">
|
<widget class="QStackedWidget" name="snippetsEditorStack">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@@ -66,10 +38,9 @@
|
|||||||
<widget class="QWidget" name="page"/>
|
<widget class="QWidget" name="page"/>
|
||||||
<widget class="QWidget" name="page_2"/>
|
<widget class="QWidget" name="page_2"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="1" column="1">
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addButton">
|
<widget class="QPushButton" name="addButton">
|
||||||
@@ -121,6 +92,31 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="groupLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Group: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="groupCombo"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Reference in New Issue
Block a user