Skip to content
GitLab
Explore
Sign in
openEmbroidery
openEmbroidery_software
Compare revisions
596f4a2ad9d94b69322f05cf84e4a54fd8b69665 to 1a74031674040b066437c6113ae5fcbd856b52bc
Commits on Source (2)
new class for viewport option top bar
· 50481930
3dsman
authored
Dec 13, 2019
50481930
change OE_ui_viewportOptions to be a QHBoxLayout and make it work
· 1a740316
3dsman
authored
Dec 14, 2019
1a740316
Hide whitespace changes
Inline
Side-by-side
include/OE_interfaceDisplay.h
View file @
1a740316
...
@@ -141,6 +141,7 @@ public slots:
...
@@ -141,6 +141,7 @@ public slots:
void
stitchSelectionChange
();
void
stitchSelectionChange
();
void
refreshStitchList
();
void
refreshStitchList
();
void
refreshStitch
(
OE_stitchs
*
stitch
);
void
refreshStitch
(
OE_stitchs
*
stitch
);
void
styleChange
();
};
};
oe_designer.pro
View file @
1a740316
...
@@ -129,7 +129,8 @@ SOURCES += \
...
@@ -129,7 +129,8 @@ SOURCES += \
src
/
qt
/
OE_ui_toolbox
.
cpp
\
src
/
qt
/
OE_ui_toolbox
.
cpp
\
src
/
qt
/
OE_ui_stitchlist
.
cpp
\
src
/
qt
/
OE_ui_stitchlist
.
cpp
\
src
/
qt
/
listviewdelegate
.
cpp
\
src
/
qt
/
listviewdelegate
.
cpp
\
src
/
OE_preferences
.
cpp
src
/
OE_preferences
.
cpp
\
src
/
qt
/
OE_ui_viewportoptions
.
cpp
HEADERS
+=
\
HEADERS
+=
\
src
/
qt
/
mainwindow
.
h
\
src
/
qt
/
mainwindow
.
h
\
...
@@ -262,7 +263,8 @@ HEADERS += \
...
@@ -262,7 +263,8 @@ HEADERS += \
src
/
qt
/
OE_ui_toolbox
.
h
\
src
/
qt
/
OE_ui_toolbox
.
h
\
src
/
qt
/
OE_ui_stitchlist
.
h
\
src
/
qt
/
OE_ui_stitchlist
.
h
\
src
/
qt
/
listviewdelegate
.
h
\
src
/
qt
/
listviewdelegate
.
h
\
src
/
OE_preferences
.
h
src
/
OE_preferences
.
h
\
src
/
qt
/
OE_ui_viewportoptions
.
h
FORMS
+=
\
FORMS
+=
\
src
/
qt
/
mainwindow
.
ui
src
/
qt
/
mainwindow
.
ui
...
...
src/OE_interfaceDisplay.cpp
View file @
1a740316
...
@@ -86,6 +86,7 @@ bool OE_interfaceDisplay::setDisplayStyle(unsigned int displayStyleId)
...
@@ -86,6 +86,7 @@ bool OE_interfaceDisplay::setDisplayStyle(unsigned int displayStyleId)
if
(
displayStyles
.
size
()
>
displayStyleId
)
if
(
displayStyles
.
size
()
>
displayStyleId
)
{
{
OE_display
::
setDisplayStyle
(
displayStyles
[
displayStyleId
]);
OE_display
::
setDisplayStyle
(
displayStyles
[
displayStyleId
]);
emit
styleChange
();
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
src/qt/OE_ui_viewportoptions.cpp
0 → 100644
View file @
1a740316
#include
"OE_ui_viewportoptions.h"
OE_ui_viewportOptions
::
OE_ui_viewportOptions
(
MainWindow
*
window
,
OE_root
*
root
)
{
this
->
root
=
root
;
this
->
window
=
window
;
topGlWindowBar
();
this
->
setMargin
(
0
);
this
->
setContentsMargins
(
0
,
0
,
0
,
0
);
onRefresh
();
connect
(
getInterfaceDisplay
(),
SIGNAL
(
styleChange
()),
this
,
SLOT
(
onRefresh
()));
}
QtMaterialIconButton
*
OE_ui_viewportOptions
::
setIconButton
(
QString
iconFile
,
const
QObject
*
receiver
=
NULL
,
const
char
*
method
=
NULL
)
{
QIcon
icon
;
icon
.
addFile
(
iconFile
,
QSize
(),
QIcon
::
Normal
,
QIcon
::
Off
);
QtMaterialIconButton
*
button
=
new
QtMaterialIconButton
(
icon
);
button
->
setUseThemeColors
(
false
);
button
->
setIconSize
(
QSize
(
25
,
25
));
button
->
setRole
(
Material
::
Primary
);
if
(
method
)
connect
(
button
,
SIGNAL
(
clicked
()),
receiver
,
method
);
return
button
;
}
void
OE_ui_viewportOptions
::
topGlWindowBar
()
{
setAlignment
(
Qt
::
AlignTop
);
setSpacing
(
4
);
setMargin
(
3
);
addWidget
(
setIconButton
(
":/resources/zoom_selection.svg"
,
getInterfaceDisplay
(),
SLOT
(
zoomOnSelection
())));
addWidget
(
setIconButton
(
":/resources/zoom_document.svg"
));
addSpacing
(
8
);
gridButton
=
setIconButton
(
":/resources/grid.svg"
,
this
,
SLOT
(
onToggleGrid
()));
gridButton
->
setCheckable
(
true
);
addWidget
(
gridButton
);
showCurvesButton
=
setIconButton
(
":/resources/show_curve.svg"
,
this
,
SLOT
(
onToggleShowCurve
()));
showCurvesButton
->
setCheckable
(
true
);
addWidget
(
showCurvesButton
);
showStitchButton
=
setIconButton
(
":/resources/show_stitch.svg"
,
this
,
SLOT
(
onToggleShowStitch
()));
showStitchButton
->
setCheckable
(
true
);
addWidget
(
showStitchButton
);
addSpacing
(
8
);
selectCurvesButton
=
setIconButton
(
":/resources/select_curve.svg"
,
this
,
SLOT
(
onToggleSelectCurve
()));
selectCurvesButton
->
setCheckable
(
true
);
addWidget
(
selectCurvesButton
);
selectStitchButton
=
setIconButton
(
":/resources/select_stitch.svg"
,
this
,
SLOT
(
onToggleSelectStitch
()));
selectStitchButton
->
setCheckable
(
true
);
addWidget
(
selectStitchButton
);
}
OE_controller
*
OE_ui_viewportOptions
::
getController
()
{
return
this
->
root
->
interfaceDisplay
->
getController
();
}
OE_interfaceDisplay
*
OE_ui_viewportOptions
::
getInterfaceDisplay
()
{
return
this
->
root
->
interfaceDisplay
;
}
OE_document
*
OE_ui_viewportOptions
::
getDocument
()
{
return
this
->
root
->
interfaceDisplay
->
getDocument
();
}
void
OE_ui_viewportOptions
::
onRefresh
()
{
gridButton
->
setChecked
(
getInterfaceDisplay
()
->
style
->
drawGrid
);
showCurvesButton
->
setChecked
(
getInterfaceDisplay
()
->
style
->
drawCurves
);
showStitchButton
->
setChecked
(
getInterfaceDisplay
()
->
style
->
drawStitches
);
selectCurvesButton
->
setChecked
(
getInterfaceDisplay
()
->
style
->
selectCurves
);
selectStitchButton
->
setChecked
(
getInterfaceDisplay
()
->
style
->
selectStitches
);
}
void
OE_ui_viewportOptions
::
onToggleGrid
()
{
getInterfaceDisplay
()
->
style
->
drawGrid
=
!
getInterfaceDisplay
()
->
style
->
drawGrid
;
getInterfaceDisplay
()
->
update
();
}
void
OE_ui_viewportOptions
::
onToggleShowCurve
()
{
getInterfaceDisplay
()
->
style
->
drawCurves
=
!
getInterfaceDisplay
()
->
style
->
drawCurves
;
getInterfaceDisplay
()
->
update
();
}
void
OE_ui_viewportOptions
::
onToggleShowStitch
()
{
getInterfaceDisplay
()
->
style
->
drawStitches
=
!
getInterfaceDisplay
()
->
style
->
drawStitches
;
getInterfaceDisplay
()
->
update
();
}
void
OE_ui_viewportOptions
::
onToggleSelectCurve
()
{
getInterfaceDisplay
()
->
style
->
selectCurves
=
!
getInterfaceDisplay
()
->
style
->
selectCurves
;
getInterfaceDisplay
()
->
update
();
}
void
OE_ui_viewportOptions
::
onToggleSelectStitch
()
{
getInterfaceDisplay
()
->
style
->
selectStitches
=
!
getInterfaceDisplay
()
->
style
->
selectStitches
;
getInterfaceDisplay
()
->
update
();
}
src/qt/OE_ui_viewportoptions.h
0 → 100644
View file @
1a740316
#ifndef OE_UI_VIEWPORTOPTIONS_H
#define OE_UI_VIEWPORTOPTIONS_H
#include
"main.h"
#include
<QWidget>
#include
<QHBoxLayout>
#include
<qtmaterialiconbutton.h>
class
MainWindow
;
class
OE_ui_viewportOptions
:
public
QHBoxLayout
{
Q_OBJECT
public:
OE_ui_viewportOptions
(
MainWindow
*
window
,
OE_root
*
root
);
OE_controller
*
getController
();
OE_interfaceDisplay
*
getInterfaceDisplay
();
OE_document
*
getDocument
();
private:
void
topGlWindowBar
();
QtMaterialIconButton
*
setIconButton
(
QString
iconFile
,
const
QObject
*
receiver
,
const
char
*
method
);
OE_root
*
root
;
MainWindow
*
window
;
QtMaterialIconButton
*
gridButton
;
QtMaterialIconButton
*
showCurvesButton
;
QtMaterialIconButton
*
showStitchButton
;
QtMaterialIconButton
*
selectCurvesButton
;
QtMaterialIconButton
*
selectStitchButton
;
signals:
public
slots
:
void
onRefresh
();
void
onToggleGrid
();
void
onToggleShowCurve
();
void
onToggleShowStitch
();
void
onToggleSelectCurve
();
void
onToggleSelectStitch
();
};
#endif // OE_UI_VIEWPORTOPTIONS_H
src/qt/mainwindow.cpp
View file @
1a740316
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
"qtmaterialtoggle.h"
#include
"qtmaterialtoggle.h"
#include
"qtmaterialcheckbox.h"
#include
"qtmaterialcheckbox.h"
#include
"OE_ui_toolbox.h"
#include
"OE_ui_toolbox.h"
#include
"OE_ui_viewportoptions.h"
#include
"OE_ui_stitchlist.h"
#include
"OE_ui_stitchlist.h"
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
...
@@ -87,14 +88,14 @@ void MainWindow::addTab()
...
@@ -87,14 +88,14 @@ void MainWindow::addTab()
openglWidgetLayout
->
setStretch
(
0
,
0
);
openglWidgetLayout
->
setStretch
(
0
,
0
);
//viewport top bar (viewport options)
//viewport top bar (viewport options)
QBoxLayout
*
topGlWindowLayout
=
topGlWindowBar
();
m_viewportOptionBar
=
new
OE_ui_viewportOptions
(
this
,
newRoot
);
openglWidgetLayout
->
addLayout
(
topGlWindowLayout
);
openglWidgetLayout
->
setStretch
(
1
,
0
);
openglWidgetLayout
->
addLayout
(
m_viewportOptionBar
);
openglWidgetLayout
->
setStretch
(
1
,
0
);
openglWidgetLayout
->
addStretch
(
1
);
openglWidgetLayout
->
addStretch
(
1
);
//viewport top bar (viewport options)
//selected stitches param
QBoxLayout
*
stitchParamLayout
=
stitchParam
();
QBoxLayout
*
stitchParamLayout
=
stitchParam
();
openglWidgetLayout
->
addLayout
(
stitchParamLayout
);
openglWidgetLayout
->
addLayout
(
stitchParamLayout
);
openglWidgetLayout
->
setStretch
(
3
,
0
);
openglWidgetLayout
->
setStretch
(
3
,
0
);
...
@@ -131,40 +132,6 @@ void MainWindow::addTab()
...
@@ -131,40 +132,6 @@ void MainWindow::addTab()
update
();
update
();
}
}
QtMaterialIconButton
*
MainWindow
::
setIconButton
(
QString
iconFile
,
const
char
*
method
=
NULL
)
{
QIcon
icon
;
icon
.
addFile
(
iconFile
,
QSize
(),
QIcon
::
Normal
,
QIcon
::
Off
);
QtMaterialIconButton
*
button
=
new
QtMaterialIconButton
(
icon
);
button
->
setUseThemeColors
(
false
);
button
->
setIconSize
(
QSize
(
25
,
25
));
if
(
method
)
connect
(
button
,
SIGNAL
(
clicked
(
bool
)),
this
,
method
);
return
button
;
}
QBoxLayout
*
MainWindow
::
topGlWindowBar
()
{
QHBoxLayout
*
topGlWindowLayout
=
new
QHBoxLayout
;
topGlWindowLayout
->
setAlignment
(
Qt
::
AlignTop
);
topGlWindowLayout
->
setSpacing
(
4
);
topGlWindowLayout
->
setMargin
(
3
);
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/zoom_selection.svg"
));
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/zoom_document.svg"
));
topGlWindowLayout
->
addSpacing
(
8
);
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/grid.svg"
));
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/show_curve.svg"
));
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/show_stitch.svg"
));
topGlWindowLayout
->
addSpacing
(
8
);
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/select_curve.svg"
));
topGlWindowLayout
->
addWidget
(
setIconButton
(
":/resources/select_stitch.svg"
));
return
topGlWindowLayout
;
}
QBoxLayout
*
MainWindow
::
stitchParam
()
QBoxLayout
*
MainWindow
::
stitchParam
()
{
{
QVBoxLayout
*
topGlWindowLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
topGlWindowLayout
=
new
QVBoxLayout
;
...
@@ -181,20 +148,6 @@ QBoxLayout* MainWindow::stitchParam()
...
@@ -181,20 +148,6 @@ QBoxLayout* MainWindow::stitchParam()
return
topGlWindowLayout
;
return
topGlWindowLayout
;
}
}
QtMaterialFlatButton
*
MainWindow
::
setButton
(
QString
name
,
const
char
*
method
=
NULL
)
{
QtMaterialFlatButton
*
button
=
new
QtMaterialFlatButton
(
name
);
button
->
setFont
(
QFont
(
"Roboto"
,
8
,
QFont
::
Medium
));
button
->
setUseThemeColors
(
true
);
button
->
setHaloVisible
(
false
);
button
->
setMinimumHeight
(
0
);
if
(
method
)
connect
(
button
,
SIGNAL
(
clicked
(
bool
)),
this
,
method
);
return
button
;
}
OE_interfaceDisplay
*
MainWindow
::
getItfDisplay
()
OE_interfaceDisplay
*
MainWindow
::
getItfDisplay
()
{
{
QWidget
*
widget
=
ui
->
tabWidget
->
currentWidget
();
QWidget
*
widget
=
ui
->
tabWidget
->
currentWidget
();
...
...
src/qt/mainwindow.h
View file @
1a740316
...
@@ -28,6 +28,7 @@ class MainWindow;
...
@@ -28,6 +28,7 @@ class MainWindow;
class
OE_interfaceDisplay
;
class
OE_interfaceDisplay
;
class
OE_root
;
class
OE_root
;
class
OE_ui_toolBox
;
class
OE_ui_toolBox
;
class
OE_ui_viewportOptions
;
class
OE_ui_stitchList
;
class
OE_ui_stitchList
;
class
MainWindow
:
public
QMainWindow
class
MainWindow
:
public
QMainWindow
...
@@ -40,11 +41,10 @@ public:
...
@@ -40,11 +41,10 @@ public:
void
addTab
();
void
addTab
();
OE_ui_toolBox
*
m_leftToolTab
;
OE_ui_toolBox
*
m_leftToolTab
;
QBoxLayout
*
topGlWindowBar
();
OE_ui_viewportOptions
*
m_viewportOptionBar
;
//QBoxLayout* topGlWindowBar();
QBoxLayout
*
stitchParam
();
QBoxLayout
*
stitchParam
();
OE_ui_stitchList
*
stitchesList
;
OE_ui_stitchList
*
stitchesList
;
QtMaterialIconButton
*
setIconButton
(
QString
iconFile
,
const
char
*
method
);
QtMaterialFlatButton
*
setButton
(
QString
name
,
const
char
*
method
);
void
keyPressEvent
(
QKeyEvent
*
event
);
void
keyPressEvent
(
QKeyEvent
*
event
);
void
keyReleaseEvent
(
QKeyEvent
*
event
);
void
keyReleaseEvent
(
QKeyEvent
*
event
);
...
...