Skip to content

Commit da59a90

Browse files
committed
b-170 added button to toolbar for search of commands and some test.
1 parent 88b8401 commit da59a90

11 files changed

+308
-99
lines changed

src/MainWindow.ui

+12
Original file line numberDiff line numberDiff line change
@@ -2552,12 +2552,24 @@
25522552
</property>
25532553
</action>
25542554
<action name="actionSearchCommand">
2555+
<property name="icon">
2556+
<iconset resource="risorse.qrc">
2557+
<normaloff>:/actions/info</normaloff>:/actions/info</iconset>
2558+
</property>
25552559
<property name="text">
25562560
<string>Search Command</string>
25572561
</property>
25582562
<property name="toolTip">
25592563
<string>Search a command by name</string>
25602564
</property>
2565+
<property name="shortcut">
2566+
<string>Ctrl+Shift+-</string>
2567+
</property>
2568+
</action>
2569+
<action name="actiondontuse">
2570+
<property name="text">
2571+
<string>dontuse</string>
2572+
</property>
25612573
</action>
25622574
</widget>
25632575
<customwidgets>

src/mainwindow.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,31 @@ void MainWindow::startUIState()
276276
ui.actionPasteAsSibling->setEnabled(false);
277277
}
278278

279+
280+
bool MainWindow::completeToolBar()
281+
{
282+
bool result = false ;
283+
QWidget* spacerWidget = new QWidget();
284+
if(NULL != spacerWidget) {
285+
spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
286+
spacerWidget->setEnabled(false);
287+
ui.toolBar->addWidget(spacerWidget);
288+
result = true ;
289+
}
290+
ui.toolBar->addAction(ui.actionSearchCommand);
291+
return result ;
292+
}
293+
294+
279295
bool MainWindow::finishSetUpUi()
280296
{
281297
if(ui.editor->versionNumber() != VERSION_NUMBER) {
282298
Utils::error(this, tr("The XML Editor component is not correct (%1)").arg(ui.editor->versionNumber()));
283299
return false;
284300
}
301+
302+
completeToolBar();
303+
285304
ui.messagePanel->setVisible(false);
286305
_scxmlValidationErrors = new SourceRelatedMessages(NULL);
287306
ui.messagePanel->widget(0)->layout()->addWidget(_scxmlValidationErrors);

src/mainwindow.h

+1
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ private slots:
465465

466466
void closeEvent(QCloseEvent * event);
467467
void startUIState();
468+
bool completeToolBar();
468469
void resetTree();
469470
void calcColumnState();
470471

src/modules/help/searchcommanddialog.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ void SearchCommandDialog::enableOK()
132132

133133
bool SearchCommandDialog::filterAction(QAction *action)
134134
{
135-
Utils::TODO_THIS_RELEASE(QString("fare").arg(action->text()));
136-
Utils::TEST_ME("aa");
137135
if(action->data().toString() == MainWindow::ActionTagLastFiles) {
138136
return false;
139137
}

src/modules/help/searchcommanddialog.h

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ private slots:
5959
void on_search_textChanged(const QString &text);
6060
void on_commands_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
6161
void on_commands_itemDoubleClicked(QTreeWidgetItem *, int);
62+
#ifdef QXMLEDIT_TEST
63+
friend class TestHelp ;
64+
#endif
6265
};
6366

6467
#endif // SEARCHCOMMANDDIALOG_H

src/modules/help/searchcommanddialog.ui

+116-95
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>971</width>
10-
<height>544</height>
9+
<width>893</width>
10+
<height>518</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -17,99 +17,120 @@
1717
<iconset resource="../../risorse.qrc">
1818
<normaloff>:/icon/images/icon.png</normaloff>:/icon/images/icon.png</iconset>
1919
</property>
20-
<widget class="QDialogButtonBox" name="buttonBox">
21-
<property name="geometry">
22-
<rect>
23-
<x>760</x>
24-
<y>140</y>
25-
<width>81</width>
26-
<height>111</height>
27-
</rect>
28-
</property>
29-
<property name="orientation">
30-
<enum>Qt::Vertical</enum>
31-
</property>
32-
<property name="standardButtons">
33-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
34-
</property>
35-
</widget>
36-
<widget class="QLineEdit" name="search">
37-
<property name="geometry">
38-
<rect>
39-
<x>160</x>
40-
<y>20</y>
41-
<width>541</width>
42-
<height>26</height>
43-
</rect>
44-
</property>
45-
</widget>
46-
<widget class="QLabel" name="label">
47-
<property name="geometry">
48-
<rect>
49-
<x>30</x>
50-
<y>20</y>
51-
<width>121</width>
52-
<height>18</height>
53-
</rect>
54-
</property>
55-
<property name="text">
56-
<string>&amp;Search command:</string>
57-
</property>
58-
<property name="buddy">
59-
<cstring>search</cstring>
60-
</property>
61-
</widget>
62-
<widget class="QTreeWidget" name="commands">
63-
<property name="geometry">
64-
<rect>
65-
<x>10</x>
66-
<y>70</y>
67-
<width>721</width>
68-
<height>401</height>
69-
</rect>
70-
</property>
71-
<property name="editTriggers">
72-
<set>QAbstractItemView::NoEditTriggers</set>
73-
</property>
74-
<property name="showDropIndicator" stdset="0">
75-
<bool>false</bool>
76-
</property>
77-
<property name="alternatingRowColors">
78-
<bool>true</bool>
79-
</property>
80-
<property name="uniformRowHeights">
81-
<bool>true</bool>
82-
</property>
83-
<property name="sortingEnabled">
84-
<bool>true</bool>
85-
</property>
86-
<property name="allColumnsShowFocus">
87-
<bool>true</bool>
88-
</property>
89-
<column>
90-
<property name="text">
91-
<string>Command</string>
92-
</property>
93-
</column>
94-
<column>
95-
<property name="text">
96-
<string>Description</string>
97-
</property>
98-
</column>
99-
</widget>
100-
<widget class="QPushButton" name="pushButton">
101-
<property name="geometry">
102-
<rect>
103-
<x>760</x>
104-
<y>90</y>
105-
<width>80</width>
106-
<height>26</height>
107-
</rect>
108-
</property>
109-
<property name="text">
110-
<string>Execute</string>
111-
</property>
112-
</widget>
20+
<layout class="QHBoxLayout" name="horizontalLayout">
21+
<item>
22+
<layout class="QVBoxLayout" name="verticalLayout">
23+
<item>
24+
<widget class="QLabel" name="label_2">
25+
<property name="font">
26+
<font>
27+
<pointsize>12</pointsize>
28+
<weight>75</weight>
29+
<bold>true</bold>
30+
</font>
31+
</property>
32+
<property name="text">
33+
<string>Search a command by name or feature</string>
34+
</property>
35+
</widget>
36+
</item>
37+
<item>
38+
<layout class="QFormLayout" name="formLayout">
39+
<item row="0" column="0">
40+
<widget class="QLabel" name="label">
41+
<property name="text">
42+
<string>&amp;Search command:</string>
43+
</property>
44+
<property name="buddy">
45+
<cstring>search</cstring>
46+
</property>
47+
</widget>
48+
</item>
49+
<item row="0" column="1">
50+
<widget class="QLineEdit" name="search"/>
51+
</item>
52+
</layout>
53+
</item>
54+
<item>
55+
<widget class="QTreeWidget" name="commands">
56+
<property name="editTriggers">
57+
<set>QAbstractItemView::NoEditTriggers</set>
58+
</property>
59+
<property name="showDropIndicator" stdset="0">
60+
<bool>false</bool>
61+
</property>
62+
<property name="alternatingRowColors">
63+
<bool>true</bool>
64+
</property>
65+
<property name="uniformRowHeights">
66+
<bool>true</bool>
67+
</property>
68+
<property name="sortingEnabled">
69+
<bool>true</bool>
70+
</property>
71+
<property name="allColumnsShowFocus">
72+
<bool>true</bool>
73+
</property>
74+
<column>
75+
<property name="text">
76+
<string>Command</string>
77+
</property>
78+
</column>
79+
<column>
80+
<property name="text">
81+
<string>Description</string>
82+
</property>
83+
</column>
84+
</widget>
85+
</item>
86+
<item>
87+
<widget class="QLabel" name="label_3">
88+
<property name="font">
89+
<font>
90+
<italic>true</italic>
91+
</font>
92+
</property>
93+
<property name="text">
94+
<string>Double click on command or press OK to execute it.</string>
95+
</property>
96+
</widget>
97+
</item>
98+
</layout>
99+
</item>
100+
<item>
101+
<layout class="QVBoxLayout" name="verticalLayout_2">
102+
<item>
103+
<widget class="QDialogButtonBox" name="buttonBox">
104+
<property name="sizePolicy">
105+
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
106+
<horstretch>0</horstretch>
107+
<verstretch>0</verstretch>
108+
</sizepolicy>
109+
</property>
110+
<property name="orientation">
111+
<enum>Qt::Vertical</enum>
112+
</property>
113+
<property name="standardButtons">
114+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
115+
</property>
116+
</widget>
117+
</item>
118+
<item>
119+
<spacer name="verticalSpacer">
120+
<property name="orientation">
121+
<enum>Qt::Vertical</enum>
122+
</property>
123+
<property name="sizeHint" stdset="0">
124+
<size>
125+
<width>20</width>
126+
<height>40</height>
127+
</size>
128+
</property>
129+
</spacer>
130+
</item>
131+
</layout>
132+
</item>
133+
</layout>
113134
</widget>
114135
<resources>
115136
<include location="../../risorse.qrc"/>

test/TestQXmlEdit.h

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
#include "testspecialview.h"
104104
#include "testformattinginfo.h"
105105
#include "teststartupandbehavior.h"
106+
#include "testhelp.h"
106107

107108
class TestQXmlEdit : public QObject
108109
{
@@ -205,6 +206,7 @@ private Q_SLOTS:
205206
void testSpecialView();
206207
void testFormattingInfo();
207208
void testStartupAndBehavior();
209+
void testHelp();
208210
};
209211

210212

test/test.pro

+4-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ SOURCES += \
196196
testspecialview.cpp \
197197
testformattinginfo.cpp \
198198
testhelpers/xsd/testxsdprintinfo.cpp \
199-
teststartupandbehavior.cpp
199+
teststartupandbehavior.cpp \
200+
testhelp.cpp
200201

201202
DEFINES += SRCDIR=\\\"$$PWD/\\\"
202203

@@ -312,7 +313,8 @@ HEADERS += \
312313
testspecialview.h \
313314
testformattinginfo.h \
314315
testhelpers/xsd/testxsdprintinfo.h \
315-
teststartupandbehavior.h
316+
teststartupandbehavior.h \
317+
testhelp.h
316318

317319
#OTHER_FILES += \
318320

0 commit comments

Comments
 (0)