Fix layout of the code style settings editor

Fixes: QTCREATORBUG-23227
Change-Id: I1ae650ba1e66c9444ef0d7fe17d003e5d6662b77
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2019-11-01 12:06:43 +01:00
parent 4a00f53c17
commit f6659f24df
7 changed files with 186 additions and 262 deletions

View File

@@ -161,8 +161,6 @@ CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
this, &CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged);
m_ui->categoryTab->setCurrentIndex(0);
m_ui->tabSettingsWidget->setFlat(true);
}
CppCodeStylePreferencesWidget::~CppCodeStylePreferencesWidget()

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>314</height>
<height>317</height>
</rect>
</property>
<property name="windowTitle">
@@ -69,19 +69,7 @@
<property name="title">
<string>Indent</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentAccessSpecifiers">
<property name="text">
@@ -155,19 +143,7 @@
<property name="title">
<string>Indent Braces</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentClassBraces">
<property name="text">
@@ -238,19 +214,7 @@
<property name="title">
<string>Indent within &quot;switch&quot;</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="indentSwitchLabels">
<property name="text">
@@ -317,19 +281,7 @@
<property name="title">
<string>Align</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="alignAssignments">
<property name="toolTip">
@@ -414,9 +366,6 @@ if they would align to the next line</string>
<property name="title">
<string>Bind '*' and '&amp;&amp;' in types/declarations to</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="bindStarToIdentifier">

View File

@@ -89,11 +89,6 @@ void SimpleCodeStylePreferencesWidget::slotTabSettingsChanged(const TextEditor::
current->setTabSettings(settings);
}
void SimpleCodeStylePreferencesWidget::setFlat(bool on)
{
m_tabSettingsWidget->setFlat(on);
}
TabSettingsWidget *SimpleCodeStylePreferencesWidget::tabSettingsWidget() const
{
return m_tabSettingsWidget;

View File

@@ -46,7 +46,6 @@ public:
void setPreferences(ICodeStylePreferences *tabPreferences);
void setFlat(bool on);
TabSettingsWidget *tabSettingsWidget() const;
private:

View File

@@ -32,7 +32,7 @@
namespace TextEditor {
TabSettingsWidget::TabSettingsWidget(QWidget *parent) :
QWidget(parent),
QGroupBox(parent),
ui(new Internal::Ui::TabSettingsWidget)
{
ui->setupUi(this);
@@ -91,13 +91,6 @@ void TabSettingsWidget::codingStyleLinkActivated(const QString &linkString)
emit codingStyleLinkClicked(QtQuickLink);
}
void TabSettingsWidget::setFlat(bool on)
{
ui->tabsAndIndentationGroupBox->setFlat(on);
const int margin = on ? 0 : -1;
ui->tabsAndIndentationGroupBox->layout()->setContentsMargins(margin, -1, margin, margin);
}
void TabSettingsWidget::setCodingStyleWarningVisible(bool visible)
{
ui->codingStyleWarning->setVisible(visible);

View File

@@ -27,7 +27,7 @@
#include "texteditor_global.h"
#include <QWidget>
#include <QGroupBox>
namespace TextEditor {
@@ -35,7 +35,7 @@ namespace Internal { namespace Ui { class TabSettingsWidget; } }
class TabSettings;
class TEXTEDITOR_EXPORT TabSettingsWidget : public QWidget
class TEXTEDITOR_EXPORT TabSettingsWidget : public QGroupBox
{
Q_OBJECT
@@ -50,7 +50,6 @@ public:
TabSettings tabSettings() const;
void setFlat(bool on);
void setCodingStyleWarningVisible(bool visible);
void setTabSettings(const TextEditor::TabSettings& s);

View File

@@ -1,28 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TextEditor::Internal::TabSettingsWidget</class>
<widget class="QWidget" name="TextEditor::Internal::TabSettingsWidget">
<widget class="QGroupBox" name="TextEditor::Internal::TabSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<height>224</height>
<width>254</width>
<height>189</height>
</rect>
</property>
<property name="windowTitle">
<string/>
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="tabsAndIndentationGroupBox">
<property name="title">
<string>Tabs And Indentation</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="codingStyleWarning">
<property name="toolTip">
<string>The text editor indentation setting is used for non-code files only. See the C++ and Qt Quick coding style settings to configure indentation for code files.</string>
</property>
<property name="text">
<string>&lt;i&gt;Code indentation is configured in &lt;a href=&quot;C++&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;QtQuick&quot;&gt;Qt Quick&lt;/a&gt; settings.&lt;/i&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="tabPolicyLabel">
<property name="text">
<string>Tab policy:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -145,6 +159,13 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="continuationAlignBehaviorLabel">
<property name="text">
<string>Align continuation lines:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="continuationAlignBehavior">
<property name="sizePolicy">
@@ -197,36 +218,6 @@ Influences the indentation of continuation lines.
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="tabPolicyLabel">
<property name="text">
<string>Tab policy:</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="continuationAlignBehaviorLabel">
<property name="text">
<string>Align continuation lines:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="codingStyleWarning">
<property name="toolTip">
<string>The text editor indentation setting is used for non-code files only. See the C++ and Qt Quick coding style settings to configure indentation for code files.</string>
</property>
<property name="text">
<string>&lt;i&gt;Code indentation is configured in &lt;a href=&quot;C++&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;QtQuick&quot;&gt;Qt Quick&lt;/a&gt; settings.&lt;/i&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>