Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
qgv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
qgv
Commits
564ed98a
Commit
564ed98a
authored
10 years ago
by
nicolas.bergont
Browse files
Options
Downloads
Patches
Plain Diff
Sample improvment
parent
aa53013d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Sample/MainWindow.cpp
+14
-6
14 additions, 6 deletions
Sample/MainWindow.cpp
Sample/MainWindow.h
+4
-1
4 additions, 1 deletion
Sample/MainWindow.h
Sample/MainWindow.ui
+8
-20
8 additions, 20 deletions
Sample/MainWindow.ui
Sample/main.cpp
+1
-3
1 addition, 3 deletions
Sample/main.cpp
with
27 additions
and
30 deletions
Sample/MainWindow.cpp
+
14
−
6
View file @
564ed98a
...
...
@@ -20,6 +20,7 @@ License along with this library.
#include
"QGVScene.h"
#include
"QGVScene.h"
#include
<QMessageBox>
#include
<QMenu>
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
...
...
@@ -32,6 +33,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect
(
_scene
,
SIGNAL
(
nodeContextMenu
(
QGVNode
*
)),
SLOT
(
nodeContextMenu
(
QGVNode
*
)));
connect
(
_scene
,
SIGNAL
(
nodeDoubleClick
(
QGVNode
*
)),
SLOT
(
nodeDoubleClick
(
QGVNode
*
)));
connect
(
_scene
,
SIGNAL
(
edgeDoubleClick
(
QGVEdge
*
)),
SLOT
(
nodeEdgeClick
(
QGVEdge
*
)));
}
MainWindow
::~
MainWindow
()
...
...
@@ -43,11 +45,9 @@ void MainWindow::drawGraph()
{
/*
_scene->loadLayout("digraph test{node [style=filled,fillcolor=white];N1 -> N2;N2 -> N3;N3 -> N4;N4 -> N1;}");
connect(_scene, SIGNAL(nodeContextMenu(QGVNode*)), SLOT(nodeContextMenu(QGVNode*)));
connect(_scene, SIGNAL(nodeDoubleClick(QGVNode*)), SLOT(nodeDoubleClick(QGVNode*)));
ui->graphicsView->setScene(_scene);
return;
*/
_scene
->
clear
();
//Configure scene attributes
_scene
->
setGraphAttribute
(
"label"
,
"DEMO"
);
...
...
@@ -120,8 +120,6 @@ void MainWindow::nodeContextMenu(QGVNode *node)
{
//Context menu exemple
QMenu
menu
(
node
->
label
());
menu
.
addSeparator
();
menu
.
addAction
(
tr
(
"Informations"
));
menu
.
addAction
(
tr
(
"Options"
));
...
...
@@ -132,5 +130,15 @@ void MainWindow::nodeContextMenu(QGVNode *node)
void
MainWindow
::
nodeDoubleClick
(
QGVNode
*
node
)
{
QMessageBox
::
information
(
this
,
tr
(
"Node double clicked"
),
tr
(
"Node %1"
).
arg
(
node
->
label
()));
QMessageBox
::
information
(
this
,
tr
(
"Node"
),
tr
(
"Node %1"
).
arg
(
node
->
label
()));
}
void
MainWindow
::
nodeEdgeClick
(
QGVEdge
*
edge
)
{
QMessageBox
::
information
(
this
,
tr
(
"Edge"
),
tr
(
"Edge %1"
).
arg
(
edge
->
label
()));
}
void
MainWindow
::
on_pushButton_clicked
()
{
drawGraph
();
}
This diff is collapsed.
Click to expand it.
Sample/MainWindow.h
+
4
−
1
View file @
564ed98a
...
...
@@ -32,11 +32,14 @@ class MainWindow : public QMainWindow
public:
explicit
MainWindow
(
QWidget
*
parent
=
0
);
~
MainWindow
();
void
drawGraph
();
private
slots
:
void
drawGraph
();
void
nodeContextMenu
(
QGVNode
*
node
);
void
nodeDoubleClick
(
QGVNode
*
node
);
void
nodeEdgeClick
(
QGVEdge
*
edge
);
void
on_pushButton_clicked
();
private:
Ui
::
MainWindow
*
ui
;
...
...
This diff is collapsed.
Click to expand it.
Sample/MainWindow.ui
+
8
−
20
View file @
564ed98a
...
...
@@ -11,10 +11,17 @@
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
MainWindow
</string>
<string>
QGV Sample
</string>
</property>
<widget
class=
"QWidget"
name=
"centralWidget"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
Draw
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QGraphicsViewEc"
name=
"graphicsView"
>
<property
name=
"renderHints"
>
...
...
@@ -27,25 +34,6 @@
</item>
</layout>
</widget>
<widget
class=
"QMenuBar"
name=
"menuBar"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
817
</width>
<height>
21
</height>
</rect>
</property>
</widget>
<widget
class=
"QToolBar"
name=
"mainToolBar"
>
<attribute
name=
"toolBarArea"
>
<enum>
TopToolBarArea
</enum>
</attribute>
<attribute
name=
"toolBarBreak"
>
<bool>
false
</bool>
</attribute>
</widget>
<widget
class=
"QStatusBar"
name=
"statusBar"
/>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<customwidgets>
...
...
This diff is collapsed.
Click to expand it.
Sample/main.cpp
+
1
−
3
View file @
564ed98a
...
...
@@ -23,8 +23,6 @@ int main(int argc, char *argv[])
QApplication
a
(
argc
,
argv
);
MainWindow
w
;
w
.
show
();
w
.
drawGraph
();
//w.drawGraph();
return
a
.
exec
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment