Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조성현
/
graph-visualization
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조성현
2017-04-13 09:59:15 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
24e9dc015e93002ed0f181c472e1e7ea2ce93ec3
24e9dc01
1 parent
129f7039
add reset action
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
73 deletions
PaperGraph/GraphItem.cpp
PaperGraph/GraphItem.h
PaperGraph/MainWindow.cpp
PaperGraph/MainWindow.h
PaperGraph/PaperGraph.vcxproj
PaperGraph/PaperGraph.vcxproj.filters
PaperGraph/PaperGraphWidget.cpp
PaperGraph/PaperGraphWidget.h
PaperGraph/GraphItem.cpp
View file @
24e9dc0
...
...
@@ -256,7 +256,7 @@ void GraphItem::path_highlighting(std::string start, std::string end)
void
GraphItem
::
reset_color
()
{
for
(
auto
&
n
:
nodeList
)
{
n
->
setColor
(
QColor
());
n
->
setColor
(
QColor
(
Qt
::
green
));
}
}
...
...
PaperGraph/GraphItem.h
View file @
24e9dc0
...
...
@@ -60,7 +60,6 @@ public:
//methods
void
path_highlighting
(
std
::
string
start
,
std
::
string
end
);
void
reset_color
();
//
protected
:
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
override
;
...
...
PaperGraph/MainWindow.cpp
View file @
24e9dc0
...
...
@@ -4,20 +4,14 @@
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
{
//ui.setupUi(this);
graphWidget
=
new
PaperGraphWidget
;
setCentralWidget
(
graphWidget
);
/*QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(5);
graphWidget->setLayout(layout);*/
//create menu
testAct
=
new
QAction
(
tr
(
"&Test"
),
this
);
testAct
->
setStatusTip
(
tr
(
"Test Action"
));
connect
(
testAct
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
test_func
);
fileMenu
=
menuBar
()
->
addMenu
(
tr
(
"&File"
));
fileMenu
->
addAction
(
testAct
);
createActions
();
createMenus
();
QString
message
=
tr
(
"test message"
);
statusBar
()
->
showMessage
(
message
);
...
...
@@ -36,10 +30,39 @@ void MainWindow::print_graph(std::ifstream& fin)
graphWidget
->
print_graph
(
fin
);
}
void
MainWindow
::
test_func
()
//////////////////////////////////////////////////////////////////
// private methods
//////////////////////////////////////////////////////////////////
void
MainWindow
::
createActions
()
{
testHighlightAct
=
new
QAction
(
tr
(
"&Highlight"
),
this
);
testHighlightAct
->
setStatusTip
(
tr
(
"Highlighting node"
));
connect
(
testHighlightAct
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
test_highlighting
);
resetColorAct
=
new
QAction
(
tr
(
"&Reset"
),
this
);
resetColorAct
->
setStatusTip
(
tr
(
"Reset all node's color"
));
connect
(
resetColorAct
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
reset_color
);
}
void
MainWindow
::
createMenus
()
{
actionMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Actions"
));
actionMenu
->
addAction
(
testHighlightAct
);
actionMenu
->
addAction
(
resetColorAct
);
}
//////////////////////////////////////////////////////////////////
// slots
//////////////////////////////////////////////////////////////////
void
MainWindow
::
test_highlighting
()
{
/*QMessageBox::information(this, "test",
"test: "+QString::number(11));*/
graphWidget
->
path_highlight
();
//graphWidget->update();
}
void
MainWindow
::
reset_color
()
{
graphWidget
->
reset_color
();
}
\ No newline at end of file
...
...
PaperGraph/MainWindow.h
View file @
24e9dc0
...
...
@@ -2,7 +2,6 @@
#define MAINWINDOW_H
#include "stdafx.h"
//#include "ui_MainWindow.h"
#include "PaperGraphWidget.h"
class
MainWindow
:
public
QMainWindow
...
...
@@ -14,14 +13,22 @@ public:
~
MainWindow
();
void
print_graph
(
std
::
ifstream
&
fin
);
void
test_func
();
/*void test_highlighting();*/
private
:
//Ui::MainWindow ui;
PaperGraphWidget
*
graphWidget
;
QMenu
*
fileMenu
;
QAction
*
testAct
;
QMenu
*
actionMenu
;
QAction
*
testHighlightAct
;
QAction
*
resetColorAct
;
private
:
void
createActions
();
void
createMenus
();
private
slots
:
void
test_highlighting
();
void
reset_color
();
};
#endif // MAINWINDOW_H
...
...
PaperGraph/PaperGraph.vcxproj
View file @
24e9dc0
...
...
@@ -218,29 +218,7 @@
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="PaperGraphWidget.ui">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="EdgeItem.h" />
<ClInclude Include="GeneratedFiles\ui_MainWindow.h" />
<ClInclude Include="GeneratedFiles\ui_PaperGraphWidget.h" />
<ClInclude Include="stdafx.h" />
<CustomBuild Include="GraphicsView.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
...
...
@@ -301,26 +279,6 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="MainWindow.ui">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Uic%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\ui_%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"</Command>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
...
...
PaperGraph/PaperGraph.vcxproj.filters
View file @
24e9dc0
...
...
@@ -88,9 +88,6 @@
<CustomBuild Include="PaperGraphWidget.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="PaperGraphWidget.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="PaperGraphWidget.qrc">
<Filter>Resource Files</Filter>
</CustomBuild>
...
...
@@ -100,14 +97,8 @@
<CustomBuild Include="MainWindow.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="MainWindow.ui">
<Filter>Form Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GeneratedFiles\ui_PaperGraphWidget.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="NodeItem.h">
<Filter>Header Files</Filter>
</ClInclude>
...
...
@@ -117,9 +108,6 @@
<ClInclude Include="EdgeItem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_MainWindow.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>PCH</Filter>
</ClInclude>
...
...
PaperGraph/PaperGraphWidget.cpp
View file @
24e9dc0
...
...
@@ -6,7 +6,6 @@
PaperGraphWidget
::
PaperGraphWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
//ui.setupUi(this);
initscene
();
View
*
view
=
new
View
(
"temp view"
);
...
...
@@ -44,6 +43,12 @@ void PaperGraphWidget::path_highlight()
scene
->
update
();
}
void
PaperGraphWidget
::
reset_color
()
{
graphItem
->
reset_color
();
scene
->
update
();
}
void
PaperGraphWidget
::
handleSelectionChanged
(
int
idx
)
{
QMessageBox
::
information
(
this
,
"QCombobox"
,
...
...
PaperGraph/PaperGraphWidget.h
View file @
24e9dc0
...
...
@@ -4,7 +4,6 @@
#include "stdafx.h"
#include "GraphItem.h"
//#include "ui_PaperGraphWidget.h"
class
PaperGraphWidget
:
public
QWidget
{
...
...
@@ -13,7 +12,9 @@ class PaperGraphWidget : public QWidget
public
:
PaperGraphWidget
(
QWidget
*
parent
=
0
);
void
print_graph
(
ifstream
&
fin
);
void
path_highlight
();
void
reset_color
();
private
slots
:
void
handleSelectionChanged
(
int
idx
);
...
...
@@ -21,7 +22,6 @@ private slots:
private
:
void
initscene
();
//Ui::PaperGraphWidgetClass ui;
QGraphicsScene
*
scene
;
GraphItem
*
graphItem
=
nullptr
;
};
...
...
Please
register
or
login
to post a comment