reimplementation of replace all, and some minor cosmetics

This commit is contained in:
nemu 2010-02-25 09:55:20 +00:00
parent 13879aabd0
commit 96c78a0f02
3 changed files with 45 additions and 54 deletions

View File

@ -2215,32 +2215,23 @@ void PTextEdit::replaceAndClose()
*/ */
void PTextEdit::replaceAll() void PTextEdit::replaceAll()
{ {
// NEEDS TO BE REWRITTEN SINCE Qt4.6 IS FAR TOO DIFFERENT TO Qt3.x // set the cursor to the start of the document
/* currentEditor()->moveCursor(QTextCursor::Start);
int currentPara, currentIndex;
currentEditor()->getCursorPosition(&currentPara, &currentIndex);
currentEditor()->setCursorPosition(0,0); // construct search flags
QTextDocument::FindFlags flags = 0;
if (fFindReplaceData->caseSensitive)
flags |= QTextDocument::FindCaseSensitively;
else if (fFindReplaceData->findBackwards)
flags |= QTextDocument::FindBackward;
else if (fFindReplaceData->wholeWordsOnly)
flags |= QTextDocument::FindWholeWords;
int para = 1, index = 1; while (currentEditor()->find(fFindReplaceData->findText, flags)) {
while (currentEditor()->find(fFindReplaceData->findText, currentEditor()->insertPlainText(fFindReplaceData->replaceText);
fFindReplaceData->caseSensitive,
fFindReplaceData->wholeWordsOnly,
true,
&para, &index)) {
// set cursor to the correct position
currentEditor()->setCursorPosition(para, index);
// replace the text
currentEditor()->insert(fFindReplaceData->replaceText);
index++;
} }
emit close(); emit close();
currentEditor()->setCursorPosition(currentPara, currentIndex);
*/
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>367</width>
<height>300</height> <height>269</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -21,8 +21,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>260</y> <y>230</y>
<width>381</width> <width>351</width>
<height>32</height> <height>32</height>
</rect> </rect>
</property> </property>
@ -66,8 +66,8 @@
<widget class="QLabel" name="fUnits_label"> <widget class="QLabel" name="fUnits_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>10</x>
<y>20</y> <y>10</y>
<width>61</width> <width>61</width>
<height>17</height> <height>17</height>
</rect> </rect>
@ -79,9 +79,9 @@
<widget class="QLabel" name="fFourierPower_label"> <widget class="QLabel" name="fFourierPower_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>10</x>
<y>40</y> <y>45</y>
<width>151</width> <width>91</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
@ -92,8 +92,8 @@
<widget class="QLabel" name="fApodization_label"> <widget class="QLabel" name="fApodization_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>10</x>
<y>70</y> <y>75</y>
<width>141</width> <width>141</width>
<height>17</height> <height>17</height>
</rect> </rect>
@ -105,8 +105,8 @@
<widget class="QLabel" name="fPlot_label"> <widget class="QLabel" name="fPlot_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>50</x> <x>10</x>
<y>100</y> <y>110</y>
<width>61</width> <width>61</width>
<height>17</height> <height>17</height>
</rect> </rect>
@ -118,7 +118,7 @@
<widget class="QLabel" name="fPhase_label"> <widget class="QLabel" name="fPhase_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>10</x>
<y>140</y> <y>140</y>
<width>61</width> <width>61</width>
<height>17</height> <height>17</height>
@ -131,8 +131,8 @@
<widget class="QLabel" name="fPhaseCorrectionRange_label"> <widget class="QLabel" name="fPhaseCorrectionRange_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>0</x>
<y>170</y> <y>160</y>
<width>111</width> <width>111</width>
<height>41</height> <height>41</height>
</rect> </rect>
@ -149,8 +149,8 @@ p, li { white-space: pre-wrap; }
<widget class="QLabel" name="fRange_label"> <widget class="QLabel" name="fRange_label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>10</x>
<y>220</y> <y>200</y>
<width>61</width> <width>61</width>
<height>17</height> <height>17</height>
</rect> </rect>
@ -162,8 +162,8 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="fUnits_comboBox"> <widget class="QComboBox" name="fUnits_comboBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>130</x>
<y>10</y> <y>5</y>
<width>111</width> <width>111</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -187,7 +187,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fFourierPower_lineEdit"> <widget class="QLineEdit" name="fFourierPower_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>130</x>
<y>40</y> <y>40</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
@ -197,7 +197,7 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="fApodization_comboBox"> <widget class="QComboBox" name="fApodization_comboBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>130</x>
<y>70</y> <y>70</y>
<width>111</width> <width>111</width>
<height>26</height> <height>26</height>
@ -227,8 +227,8 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="fPlot_comboBox"> <widget class="QComboBox" name="fPlot_comboBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>160</x> <x>130</x>
<y>100</y> <y>105</y>
<width>111</width> <width>111</width>
<height>26</height> <height>26</height>
</rect> </rect>
@ -262,7 +262,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fPhase_lineEdit"> <widget class="QLineEdit" name="fPhase_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>160</x> <x>130</x>
<y>140</y> <y>140</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
@ -272,7 +272,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fPhaseCorrectionRangeLow_lineEdit"> <widget class="QLineEdit" name="fPhaseCorrectionRangeLow_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>130</x>
<y>170</y> <y>170</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
@ -282,7 +282,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fPhaseCorrectionRangeUp_lineEdit"> <widget class="QLineEdit" name="fPhaseCorrectionRangeUp_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>270</x> <x>250</x>
<y>170</y> <y>170</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
@ -292,8 +292,8 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fRangeLow_lineEdit"> <widget class="QLineEdit" name="fRangeLow_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>130</x>
<y>210</y> <y>200</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
</rect> </rect>
@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="fRangeUp_lineEdit"> <widget class="QLineEdit" name="fRangeUp_lineEdit">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>280</x> <x>250</x>
<y>210</y> <y>200</y>
<width>113</width> <width>113</width>
<height>22</height> <height>22</height>
</rect> </rect>

View File

@ -469,7 +469,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>410</y> <y>420</y>
<width>421</width> <width>421</width>
<height>121</height> <height>121</height>
</rect> </rect>
@ -543,7 +543,7 @@
<x>0</x> <x>0</x>
<y>545</y> <y>545</y>
<width>421</width> <width>421</width>
<height>36</height> <height>39</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">