Automatic horiz/vert switch of layout when docking Advanced F&R pane top-bottom/left-right (copying 49c2450f).

This commit is contained in:
Tommaso Cucinotta 2013-05-05 14:05:50 +01:00
parent 49c2450f3f
commit e36779755e
3 changed files with 228 additions and 198 deletions

View File

@ -65,6 +65,16 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
}
void FindAndReplaceWidget::dockLocationChanged(Qt::DockWidgetArea area)
{
if (area == Qt::RightDockWidgetArea || area == Qt::LeftDockWidgetArea) {
dynamicLayout_->setDirection(QBoxLayout::TopToBottom);
} else {
dynamicLayout_->setDirection(QBoxLayout::LeftToRight);
}
}
bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
{
if (event->type() != QEvent::KeyPress
@ -555,6 +565,9 @@ FindAndReplace::FindAndReplace(GuiView & parent,
widget_ = new FindAndReplaceWidget(parent);
setWidget(widget_);
setFocusProxy(widget_);
connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
widget_, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
}

View File

@ -39,6 +39,10 @@ public:
bool initialiseParams(std::string const & params);
void updateGUI();
public Q_SLOTS:
///
void dockLocationChanged(Qt::DockWidgetArea area);
private:
///
GuiView & view_;

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FindAndReplaceUi</class>
<widget class="QTabWidget" name="FindAndReplaceUi">
@ -5,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>279</width>
<height>300</height>
<width>276</width>
<height>291</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>TabWidget</string>
</property>
@ -19,9 +26,11 @@
<attribute name="title">
<string>Sear&amp;ch</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<layout class="QVBoxLayout" name="dynamicLayout_">
<item>
<layout class="QVBoxLayout" name="findLayout">
<item>
<widget class="QLabel" name="findLabel">
<property name="text">
<string>&amp;Find:</string>
</property>
@ -30,18 +39,22 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="lyx::frontend::EmbeddedWorkArea" native="1" name="find_work_area_" >
<item>
<widget class="lyx::frontend::EmbeddedWorkArea" name="find_work_area_" native="true">
<property name="sizePolicy">
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_2" >
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="replaceLayout">
<item>
<widget class="QLabel" name="replaceLabel">
<property name="text">
<string>Replace &amp;with:</string>
</property>
@ -50,20 +63,24 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="lyx::frontend::EmbeddedWorkArea" native="1" name="replace_work_area_" >
<item>
<widget class="lyx::frontend::EmbeddedWorkArea" name="replace_work_area_" native="true">
<property name="sizePolicy">
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0" >
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="caseCB">
<property name="sizePolicy">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -76,13 +93,13 @@
</property>
</widget>
</item>
<item row="4" column="1" >
<item row="0" column="1">
<widget class="QPushButton" name="findNextPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>100</horstretch>
<verstretch>32</verstretch>
</sizepolicy>
@ -98,7 +115,7 @@
</property>
</widget>
</item>
<item row="5" column="0" >
<item row="1" column="0">
<widget class="QCheckBox" name="wordsCB">
<property name="enabled">
<bool>true</bool>
@ -111,13 +128,13 @@
</property>
</widget>
</item>
<item row="5" column="1" >
<item row="1" column="1">
<widget class="QPushButton" name="replacePB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>100</horstretch>
<verstretch>32</verstretch>
</sizepolicy>
@ -130,7 +147,7 @@
</property>
</widget>
</item>
<item row="6" column="0" >
<item row="2" column="0">
<widget class="QCheckBox" name="searchbackCB">
<property name="toolTip">
<string>Shift+Enter search backwards directly</string>
@ -140,13 +157,13 @@
</property>
</widget>
</item>
<item row="6" column="1" >
<item row="2" column="1">
<widget class="QPushButton" name="replaceallPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>100</horstretch>
<verstretch>32</verstretch>
</sizepolicy>
@ -160,6 +177,8 @@
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="advancedTab">
<attribute name="title">
@ -171,12 +190,6 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>The scope to which the search horizon is restricted</string>
</property>
@ -209,7 +222,7 @@
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>