Skip to content

Commit 38145c5

Browse files
committed
Network search widget
1 parent 37500fd commit 38145c5

File tree

6 files changed

+120
-3
lines changed

6 files changed

+120
-3
lines changed

src/Interface/Application/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ SET(Interface_Application_FORMS
104104
Module.ui
105105
ModuleLogWindow.ui
106106
ConnectionStyleWizardPage.ui
107+
NetworkSearch.ui
107108
NoteEditor.ui
108109
Preferences.ui
109110
ProvenanceWindow.ui

src/Interface/Application/ModuleProxyWidget.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,4 +430,4 @@ ProxyWidgetPosition::ProxyWidgetPosition(QGraphicsProxyWidget* widget, const QPo
430430
QPointF ProxyWidgetPosition::currentPosition() const
431431
{
432432
return widget_->pos() + offset_;
433-
}
433+
}

src/Interface/Application/NetworkEditor.cc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,36 @@ void NetworkEditor::mouseReleaseEvent(QMouseEvent *event)
710710
QGraphicsView::mouseReleaseEvent(event);
711711
}
712712

713+
void NetworkEditor::mouseDoubleClickEvent(QMouseEvent* event)
714+
{
715+
if (!search_)
716+
{
717+
search_ = scene_->addWidget(new NetworkSearchWidget(this));
718+
search_->setOpacity(0.9);
719+
}
720+
search_->setPos(mapToScene(event->pos()));
721+
search_->setVisible(true);
722+
723+
QGraphicsView::mouseDoubleClickEvent(event);
724+
}
725+
726+
void NetworkEditor::hideSearchBox()
727+
{
728+
if (search_)
729+
search_->setVisible(false);
730+
}
731+
732+
NetworkSearchWidget::NetworkSearchWidget(NetworkEditor* ned)
733+
{
734+
setupUi(this);
735+
connect(closeButton_, SIGNAL(clicked()), ned, SLOT(hideSearchBox()));
736+
}
737+
738+
NetworkSearchWidgetProxy::NetworkSearchWidgetProxy(NetworkSearchWidget* nsw)
739+
{
740+
setWidget(nsw);
741+
}
742+
713743
ConnectionLine* NetworkEditor::getSingleConnectionSelected()
714744
{
715745
ConnectionLine* connectionSelected = nullptr;

src/Interface/Application/NetworkEditor.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
#include <QGraphicsView>
3333
#include <QGraphicsTextItem>
34+
#include <QGraphicsProxyWidget>
35+
#include "ui_NetworkSearch.h"
3436
#ifndef Q_MOC_RUN
3537
#include <boost/shared_ptr.hpp>
3638
#include <atomic>
@@ -87,7 +89,7 @@ namespace Gui {
8789
{
8890
Q_OBJECT
8991
public:
90-
explicit ErrorItem(const QString& text, std::function<void()> showModule, QGraphicsItem* parent = 0);
92+
explicit ErrorItem(const QString& text, std::function<void()> showModule, QGraphicsItem* parent = nullptr);
9193
~ErrorItem();
9294
int num() const { return counter_; }
9395
protected:
@@ -104,6 +106,20 @@ namespace Gui {
104106
static std::atomic<int> instanceCounter_;
105107
};
106108

109+
class NetworkSearchWidget : public QWidget, public Ui::NetworkSearch
110+
{
111+
Q_OBJECT
112+
public:
113+
explicit NetworkSearchWidget(class NetworkEditor* ned);
114+
};
115+
116+
class NetworkSearchWidgetProxy : public QGraphicsProxyWidget
117+
{
118+
Q_OBJECT
119+
public:
120+
explicit NetworkSearchWidgetProxy(NetworkSearchWidget* base);
121+
};
122+
107123
class ModuleEventProxy : public QObject
108124
{
109125
Q_OBJECT
@@ -221,6 +237,7 @@ namespace Gui {
221237
virtual void wheelEvent(QWheelEvent* event) override;
222238
virtual void contextMenuEvent(QContextMenuEvent *event) override;
223239
virtual void mousePressEvent(QMouseEvent *event) override;
240+
virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
224241

225242
public Q_SLOTS:
226243
void addModuleWidget(const std::string& name, SCIRun::Dataflow::Networks::ModuleHandle module, const SCIRun::Dataflow::Engine::ModuleCounter& count);
@@ -284,6 +301,7 @@ namespace Gui {
284301
void paste();
285302
void bringToFront();
286303
void sendToBack();
304+
void hideSearchBox();
287305

288306
private:
289307
typedef QPair<ModuleWidget*, ModuleWidget*> ModulePair;
@@ -324,6 +342,7 @@ namespace Gui {
324342
bool insertingNewModuleAlongConnection_ { false };
325343
PreexecuteFunc preexecute_;
326344
bool showTagGroupsOnFileLoad_ { false };
345+
QGraphicsProxyWidget* search_ { nullptr };
327346
};
328347
}
329348
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>NetworkSearch</class>
4+
<widget class="QWidget" name="NetworkSearch">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>432</width>
10+
<height>27</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QHBoxLayout" name="horizontalLayout">
17+
<property name="leftMargin">
18+
<number>2</number>
19+
</property>
20+
<property name="topMargin">
21+
<number>0</number>
22+
</property>
23+
<property name="rightMargin">
24+
<number>2</number>
25+
</property>
26+
<property name="bottomMargin">
27+
<number>0</number>
28+
</property>
29+
<item>
30+
<widget class="QLabel" name="label">
31+
<property name="font">
32+
<font>
33+
<weight>75</weight>
34+
<bold>true</bold>
35+
</font>
36+
</property>
37+
<property name="styleSheet">
38+
<string notr="true"/>
39+
</property>
40+
<property name="text">
41+
<string>Search network:</string>
42+
</property>
43+
</widget>
44+
</item>
45+
<item>
46+
<widget class="QLineEdit" name="searchLineEdit_"/>
47+
</item>
48+
<item>
49+
<widget class="QToolButton" name="closeButton_">
50+
<property name="maximumSize">
51+
<size>
52+
<width>16777215</width>
53+
<height>21</height>
54+
</size>
55+
</property>
56+
<property name="styleSheet">
57+
<string notr="true">QPushButton { color: red }</string>
58+
</property>
59+
<property name="text">
60+
<string>X</string>
61+
</property>
62+
</widget>
63+
</item>
64+
</layout>
65+
</widget>
66+
<resources/>
67+
<connections/>
68+
</ui>

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,6 @@ void SCIRunMainWindow::showKeyboardShortcutsDialog()
18661866

18671867
void SCIRunMainWindow::runNewModuleWizard()
18681868
{
1869-
qDebug() << "new module wizard coming soon";
18701869
auto wizard = new ClassWizard(this);
18711870
wizard->show();
18721871
}

0 commit comments

Comments
 (0)