break;
case Qt::Key_Enter:
- case Qt::Key_Return:
- if (e->modifiers() == Qt::ShiftModifier) {
- if (obj == find_work_area_)
- on_findPrevPB_clicked();
- else
- on_replacePrevPB_clicked();
- return true;
- } else if (e->modifiers() == Qt::NoModifier) {
- if (obj == find_work_area_)
- on_findNextPB_clicked();
- else
- on_replaceNextPB_clicked();
- return true;
- }
+ case Qt::Key_Return: {
+ // with shift we (temporarily) change search/replace direction
+ bool const searchback = searchbackCB->isChecked();
+ if (e->modifiers() == Qt::ShiftModifier && !searchback)
+ searchbackCB->setChecked(!searchback);
+
+ if (obj == find_work_area_)
+ on_findNextPB_clicked();
+ else
+ on_replacePB_clicked();
+ // back to how it was
+ searchbackCB->setChecked(searchback);
+ return true;
break;
-
+ }
case Qt::Key_Tab:
if (e->modifiers() == Qt::NoModifier) {
if (obj == find_work_area_){
}
-void FindAndReplaceWidget::on_findNextPB_clicked() {
- findAndReplace(false, false);
- find_work_area_->setFocus();
-}
-
-
-void FindAndReplaceWidget::on_findPrevPB_clicked() {
- findAndReplace(true, false);
- find_work_area_->setFocus();
-}
-
-
-void FindAndReplaceWidget::on_replaceNextPB_clicked()
+void FindAndReplaceWidget::on_findNextPB_clicked()
{
- findAndReplace(false, true);
- replace_work_area_->setFocus();
+ findAndReplace(searchbackCB->isChecked(), false);
+ find_work_area_->setFocus();
}
-void FindAndReplaceWidget::on_replacePrevPB_clicked()
+void FindAndReplaceWidget::on_replacePB_clicked()
{
- findAndReplace(true, true);
+ findAndReplace(searchbackCB->isChecked(), true);
replace_work_area_->setFocus();
}
<rect>
<x>0</x>
<y>0</y>
- <width>288</width>
- <height>366</height>
+ <width>247</width>
+ <height>341</height>
</rect>
</property>
<property name="windowTitle">
</property>
</widget>
</item>
- <item row="1" column="0" colspan="2">
+ <item row="1" column="0" colspan="3">
<widget class="lyx::frontend::EmbeddedWorkArea" name="find_work_area_">
<property name="toolTip">
<string>Enter the text to search for in this full-featured LyX editing area</string>
<height>57</height>
</rect>
</property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
</widget>
</widget>
</item>
<item row="2" column="0">
- <widget class="QCheckBox" name="caseCB">
- <property name="toolTip">
- <string>Perform a case-sensitive search</string>
- </property>
- <property name="text">
- <string>Case &sensitive</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="wordsCB">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Restrict search to whole words only</string>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <property name="text">
- <string>Whole &words</string>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>52</width>
+ <height>20</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
- <item row="3" column="0" colspan="2">
+ <item row="2" column="1" colspan="2">
<widget class="QPushButton" name="regexpInsertPB">
<property name="toolTip">
<string>Choose one of the pre-arranged regular expressions.</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&Replace with:</string>
</property>
</widget>
</item>
- <item row="5" column="0" colspan="2">
+ <item row="4" column="0" colspan="3">
<widget class="lyx::frontend::EmbeddedWorkArea" name="replace_work_area_">
<property name="toolTip">
<string>Enter the text to replace in this full-featured LyX editing area</string>
<height>57</height>
</rect>
</property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
</widget>
</widget>
</item>
+ <item row="5" column="0" colspan="2">
+ <widget class="QCheckBox" name="caseCB">
+ <property name="toolTip">
+ <string>Perform a case-sensitive search</string>
+ </property>
+ <property name="text">
+ <string>Case &sensitive</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QPushButton" name="findNextPB">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Find next occurrence [Enter]</string>
+ </property>
+ <property name="text">
+ <string>Find &Next</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item row="6" column="0" colspan="2">
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QPushButton" name="findPrevPB">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Find previous occurrence [Shift+Enter]</string>
- </property>
- <property name="text">
- <string>Find &Previous</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QPushButton" name="findNextPB">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Find next occurrence [Enter]</string>
- </property>
- <property name="text">
- <string>Find &Next</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QPushButton" name="replacePrevPB">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Replace and find previous occurrence [Shift+Enter]</string>
- </property>
- <property name="text">
- <string>Replace Pre&vious</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="replaceNextPB">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Replace and find next occurrence [Enter]</string>
- </property>
- <property name="text">
- <string>Replace Ne&xt</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="replaceallPB">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Replace all occurences at once</string>
- </property>
- <property name="text">
- <string>Replace &All</string>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QCheckBox" name="wordsCB">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Restrict search to whole words only</string>
+ </property>
+ <property name="text">
+ <string>Whole &words</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QPushButton" name="replacePB">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Replace and find next occurrence [Enter]</string>
+ </property>
+ <property name="text">
+ <string>&Replace</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QCheckBox" name="searchbackCB">
+ <property name="text">
+ <string>Search backwards</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QPushButton" name="replaceallPB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Replace all occurences at once</string>
+ </property>
+ <property name="text">
+ <string>Replace &All</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>