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) bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
{ {
if (event->type() != QEvent::KeyPress if (event->type() != QEvent::KeyPress
@ -555,6 +565,9 @@ FindAndReplace::FindAndReplace(GuiView & parent,
widget_ = new FindAndReplaceWidget(parent); widget_ = new FindAndReplaceWidget(parent);
setWidget(widget_); setWidget(widget_);
setFocusProxy(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); bool initialiseParams(std::string const & params);
void updateGUI(); void updateGUI();
public Q_SLOTS:
///
void dockLocationChanged(Qt::DockWidgetArea area);
private: private:
/// ///
GuiView & view_; GuiView & view_;

View File

@ -1,246 +1,259 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FindAndReplaceUi</class> <class>FindAndReplaceUi</class>
<widget class="QTabWidget" name="FindAndReplaceUi" > <widget class="QTabWidget" name="FindAndReplaceUi">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>279</width> <width>276</width>
<height>300</height> <height>291</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>TabWidget</string> <string>TabWidget</string>
</property> </property>
<property name="currentIndex" > <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="basicTab" > <widget class="QWidget" name="basicTab">
<attribute name="title" > <attribute name="title">
<string>Sear&amp;ch</string> <string>Sear&amp;ch</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout" > <layout class="QVBoxLayout" name="dynamicLayout_">
<item row="0" column="0" > <item>
<widget class="QLabel" name="label" > <layout class="QVBoxLayout" name="findLayout">
<property name="text" > <item>
<string>&amp;Find:</string> <widget class="QLabel" name="findLabel">
</property> <property name="text">
<property name="buddy" > <string>&amp;Find:</string>
<cstring>find_work_area_</cstring> </property>
</property> <property name="buddy">
</widget> <cstring>find_work_area_</cstring>
</property>
</widget>
</item>
<item>
<widget class="lyx::frontend::EmbeddedWorkArea" name="find_work_area_" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="1" column="0" colspan="2" > <item>
<widget class="lyx::frontend::EmbeddedWorkArea" native="1" name="find_work_area_" > <layout class="QVBoxLayout" name="replaceLayout">
<property name="sizePolicy" > <item>
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > <widget class="QLabel" name="replaceLabel">
<horstretch>0</horstretch> <property name="text">
<verstretch>0</verstretch> <string>Replace &amp;with:</string>
</sizepolicy> </property>
</property> <property name="buddy">
</widget> <cstring>replace_work_area_</cstring>
</property>
</widget>
</item>
<item>
<widget class="lyx::frontend::EmbeddedWorkArea" name="replace_work_area_" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="2" column="0" > <item>
<widget class="QLabel" name="label_2" > <layout class="QGridLayout" name="gridLayout">
<property name="text" > <item row="0" column="0">
<string>Replace &amp;with:</string> <widget class="QCheckBox" name="caseCB">
</property> <property name="sizePolicy">
<property name="buddy" > <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<cstring>replace_work_area_</cstring> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</widget> </sizepolicy>
</item> </property>
<item row="3" column="0" colspan="2" > <property name="toolTip">
<widget class="lyx::frontend::EmbeddedWorkArea" native="1" name="replace_work_area_" > <string>Perform a case-sensitive search</string>
<property name="sizePolicy" > </property>
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > <property name="text">
<horstretch>0</horstretch> <string>Case &amp;sensitive</string>
<verstretch>0</verstretch> </property>
</sizepolicy> </widget>
</property> </item>
</widget> <item row="0" column="1">
</item> <widget class="QPushButton" name="findNextPB">
<item row="4" column="0" > <property name="enabled">
<widget class="QCheckBox" name="caseCB" > <bool>true</bool>
<property name="sizePolicy" > </property>
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" > <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<verstretch>0</verstretch> <horstretch>100</horstretch>
</sizepolicy> <verstretch>32</verstretch>
</property> </sizepolicy>
<property name="toolTip" > </property>
<string>Perform a case-sensitive search</string> <property name="toolTip">
</property> <string>Find next occurrence [Enter]</string>
<property name="text" > </property>
<string>Case &amp;sensitive</string> <property name="text">
</property> <string>Find &amp;Next</string>
</widget> </property>
</item> <property name="default">
<item row="4" column="1" > <bool>true</bool>
<widget class="QPushButton" name="findNextPB" > </property>
<property name="enabled" > </widget>
<bool>true</bool> </item>
</property> <item row="1" column="0">
<property name="sizePolicy" > <widget class="QCheckBox" name="wordsCB">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <property name="enabled">
<horstretch>100</horstretch> <bool>true</bool>
<verstretch>32</verstretch> </property>
</sizepolicy> <property name="toolTip">
</property> <string>Restrict search to whole words only</string>
<property name="toolTip" > </property>
<string>Find next occurrence [Enter]</string> <property name="text">
</property> <string>W&amp;hole words</string>
<property name="text" > </property>
<string>Find &amp;Next</string> </widget>
</property> </item>
<property name="default" > <item row="1" column="1">
<bool>true</bool> <widget class="QPushButton" name="replacePB">
</property> <property name="enabled">
</widget> <bool>true</bool>
</item> </property>
<item row="5" column="0" > <property name="sizePolicy">
<widget class="QCheckBox" name="wordsCB" > <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<property name="enabled" > <horstretch>100</horstretch>
<bool>true</bool> <verstretch>32</verstretch>
</property> </sizepolicy>
<property name="toolTip" > </property>
<string>Restrict search to whole words only</string> <property name="toolTip">
</property> <string>Replace and find next occurrence [Enter]</string>
<property name="text" > </property>
<string>W&amp;hole words</string> <property name="text">
</property> <string>&amp;Replace</string>
</widget> </property>
</item> </widget>
<item row="5" column="1" > </item>
<widget class="QPushButton" name="replacePB" > <item row="2" column="0">
<property name="enabled" > <widget class="QCheckBox" name="searchbackCB">
<bool>true</bool> <property name="toolTip">
</property> <string>Shift+Enter search backwards directly</string>
<property name="sizePolicy" > </property>
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > <property name="text">
<horstretch>100</horstretch> <string>Search &amp;backwards</string>
<verstretch>32</verstretch> </property>
</sizepolicy> </widget>
</property> </item>
<property name="toolTip" > <item row="2" column="1">
<string>Replace and find next occurrence [Enter]</string> <widget class="QPushButton" name="replaceallPB">
</property> <property name="enabled">
<property name="text" > <bool>true</bool>
<string>&amp;Replace</string> </property>
</property> <property name="sizePolicy">
</widget> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
</item> <horstretch>100</horstretch>
<item row="6" column="0" > <verstretch>32</verstretch>
<widget class="QCheckBox" name="searchbackCB" > </sizepolicy>
<property name="toolTip" > </property>
<string>Shift+Enter search backwards directly</string> <property name="toolTip">
</property> <string>Replace all occurences at once</string>
<property name="text" > </property>
<string>Search &amp;backwards</string> <property name="text">
</property> <string>Replace &amp;All</string>
</widget> </property>
</item> </widget>
<item row="6" column="1" > </item>
<widget class="QPushButton" name="replaceallPB" > </layout>
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>100</horstretch>
<verstretch>32</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Replace all occurences at once</string>
</property>
<property name="text" >
<string>Replace &amp;All</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="advancedTab" > <widget class="QWidget" name="advancedTab">
<attribute name="title" > <attribute name="title">
<string>S&amp;ettings</string> <string>S&amp;ettings</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2" > <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2" > <item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2" > <widget class="QGroupBox" name="groupBox_2">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="minimumSize" > <property name="toolTip">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip" >
<string>The scope to which the search horizon is restricted</string> <string>The scope to which the search horizon is restricted</string>
</property> </property>
<property name="autoFillBackground" > <property name="autoFillBackground">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="title" > <property name="title">
<string>Sco&amp;pe</string> <string>Sco&amp;pe</string>
</property> </property>
<property name="flat" > <property name="flat">
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" > <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QRadioButton" name="CurrentDocument" > <widget class="QRadioButton" name="CurrentDocument">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text" > <property name="text">
<string>Current &amp;document</string> <string>Current &amp;document</string>
</property> </property>
<property name="checked" > <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="MasterDocument" > <widget class="QRadioButton" name="MasterDocument">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" > <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Current document and all related documents belonging to the same master document</string> <string>Current document and all related documents belonging to the same master document</string>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Master document</string> <string>&amp;Master document</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="OpenDocuments" > <widget class="QRadioButton" name="OpenDocuments">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>All open documents</string> <string>All open documents</string>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Open documents</string> <string>&amp;Open documents</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="AllManualsRB" > <widget class="QRadioButton" name="AllManualsRB">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text" > <property name="text">
<string>All ma&amp;nuals</string> <string>All ma&amp;nuals</string>
</property> </property>
</widget> </widget>
@ -248,48 +261,48 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="1" column="0">
<widget class="QCheckBox" name="ignoreFormatCB" > <widget class="QCheckBox" name="ignoreFormatCB">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>If unchecked, the search will be limited to occurrences of the selected text and paragraph style</string> <string>If unchecked, the search will be limited to occurrences of the selected text and paragraph style</string>
</property> </property>
<property name="text" > <property name="text">
<string>Ignore &amp;format</string> <string>Ignore &amp;format</string>
</property> </property>
<property name="checked" > <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2" > <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="keepCaseCB" > <widget class="QCheckBox" name="keepCaseCB">
<property name="toolTip" > <property name="toolTip">
<string>Keep the case of the replacement's first letter as in each matching text first letter</string> <string>Keep the case of the replacement's first letter as in each matching text first letter</string>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Preserve first case on replace</string> <string>&amp;Preserve first case on replace</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" > <item row="3" column="0">
<widget class="QCheckBox" name="expandMacrosCB" > <widget class="QCheckBox" name="expandMacrosCB">
<property name="enabled" > <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Expand macros</string> <string>&amp;Expand macros</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" > <item row="4" column="1">
<spacer name="verticalSpacer" > <spacer name="verticalSpacer">
<property name="orientation" > <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0" > <property name="sizeHint" stdset="0">
<size> <size>
<width>105</width> <width>105</width>
<height>2</height> <height>2</height>