mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
Add layout intelligence to View Source pane (bug #8653).
View Source pane layout now automatically switches between horizontal and vertical design when docked in vertical or horizontal way. Original idea and patch from Edwin. http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg178801.html Note: the long standing-fight with too bulky minimal QTextEdit size is now solved via ViewSourceUi.sizePolicy=Ignored.
This commit is contained in:
parent
030326466f
commit
49c2450f3f
@ -32,6 +32,7 @@
|
||||
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QSettings>
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
@ -227,12 +228,24 @@ void ViewSourceWidget::updateDefaultFormat()
|
||||
}
|
||||
|
||||
|
||||
void ViewSourceWidget::dockLocationChanged(Qt::DockWidgetArea area)
|
||||
{
|
||||
if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) {
|
||||
layout_->setDirection(QBoxLayout::TopToBottom);
|
||||
} else {
|
||||
layout_->setDirection(QBoxLayout::LeftToRight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GuiViewSource::GuiViewSource(GuiView & parent,
|
||||
Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
||||
: DockView(parent, "view-source", qt_("LaTeX Source"), area, flags)
|
||||
{
|
||||
widget_ = new ViewSourceWidget;
|
||||
setWidget(widget_);
|
||||
connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
|
||||
widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,6 +49,8 @@ public Q_SLOTS:
|
||||
void updateDefaultFormat();
|
||||
///
|
||||
void contentsChanged();
|
||||
///
|
||||
void dockLocationChanged(Qt::DockWidgetArea area);
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>430</width>
|
||||
<height>131</height>
|
||||
<width>665</width>
|
||||
<height>144</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -19,10 +19,7 @@
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="1,0">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
@ -30,19 +27,36 @@
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_" stretch="1,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="viewSourceTV">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Ignored">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
@ -57,7 +71,7 @@
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
@ -170,6 +184,8 @@
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>viewSourceTV</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user