HGGitLab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luoliangyi
app
Commits
81171da7
Commit
81171da7
authored
Mar 17, 2022
by
luoliangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善缩略图
parent
b54a7a51
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1466 additions
and
397 deletions
+1466
-397
app/Scanner/Scanner/mainwindow.cpp
app/Scanner/Scanner/mainwindow.cpp
+5
-5
ui/HGImgThumb.cpp
ui/HGImgThumb.cpp
+1409
-380
ui/HGImgThumb.hpp
ui/HGImgThumb.hpp
+39
-10
ui/HGImgView.cpp
ui/HGImgView.cpp
+13
-2
No files found.
app/Scanner/Scanner/mainwindow.cpp
View file @
81171da7
...
...
@@ -34,10 +34,10 @@ MainWindow::MainWindow(QWidget *parent)
ui
->
toolBar
->
addSeparator
();
ui
->
toolBar
->
addAction
(
ui
->
act_help
);
//
m_view->move(0, 100);
//
m_view->resize(400, height() - 150);
m_thumb
->
move
(
0
0
,
100
);
m_thumb
->
resize
(
8
00
,
height
()
-
150
);
m_view
->
move
(
0
,
100
);
m_view
->
resize
(
400
,
height
()
-
150
);
m_thumb
->
move
(
45
0
,
100
);
m_thumb
->
resize
(
2
00
,
height
()
-
150
);
HGImage
img
=
NULL
;
HGImgFmt_LoadImage
(
"D:
\\
1.jpg"
,
0
,
NULL
,
HGBASE_IMGTYPE_RGB
,
HGBASE_IMGORIGIN_TOP
,
&
img
);
...
...
@@ -46,7 +46,7 @@ MainWindow::MainWindow(QWidget *parent)
QImage
img2
(
"D:
\\
image.png"
);
m_thumb
->
setDefItemImage
(
&
img2
);
m_thumb
->
setType
(
ThumbType_
Grid
);
m_thumb
->
setType
(
ThumbType_
Vert
);
for
(
int
i
=
0
;
i
<
1000
;
++
i
)
{
...
...
ui/HGImgThumb.cpp
View file @
81171da7
This diff is collapsed.
Click to expand it.
ui/HGImgThumb.hpp
View file @
81171da7
...
...
@@ -33,8 +33,11 @@ struct HGImgThumbItem
~
HGImgThumbItem
()
{
delete
image
;
image
=
NULL
;
if
(
NULL
!=
image
)
{
delete
image
;
image
=
NULL
;
}
}
QString
fileName
;
...
...
@@ -49,10 +52,17 @@ public:
HGImgThumb
(
QWidget
*
parent
=
nullptr
);
virtual
~
HGImgThumb
();
enum
MoveStauts
{
MoveStatus_Null
=
0
,
MoveStatus_HRoll
=
1
,
MoveStatus_VRoll
=
2
};
HGResult
setType
(
ThumbType
type
);
HGResult
setGap
(
int
width
);
HGResult
zoomIn
(
const
HGPoint
*
pCenter
);
HGResult
zoomOut
(
const
HGPoint
*
pCenter
);
HGResult
zoomIn
();
HGResult
zoomOut
();
HGResult
setDefItemImage
(
const
QImage
*
image
);
HGResult
getItemCount
(
int
*
count
);
...
...
@@ -68,10 +78,10 @@ public:
HGResult
updateItem
(
int
index
,
const
QString
&
fileName
);
HGResult
refreshItem
(
int
index
);
HGResult
refreshAllItems
();
HGResult
locateItem
(
int
index
);
signals:
void
currentItemChanged
(
int
index
);
void
itemClicked
(
int
index
);
void
itemDoubleClicked
(
int
index
);
void
itemCountChanged
(
int
count
);
void
itemSelectingChanged
();
...
...
@@ -100,13 +110,27 @@ private slots:
private:
static
QImage
*
createItemImage
(
const
QImage
*
srcImage
,
int
itemSize
);
static
QImage
*
createItemImage
(
HGImage
srcImage
,
int
itemSize
);
void
updateShowRect
();
bool
wnd2ShowRect
(
QPoint
&
pt
);
bool
showRect2Wnd
(
QPoint
&
pt
);
bool
getItemLoc
(
int
index
,
QPoint
&
pt
,
int
&
row
,
int
&
col
);
static
void
calcShowSize
(
int
wndWidth
,
int
wndHeight
,
int
rollWidth
,
ThumbType
type
,
int
itemSize
,
int
gapWidth
,
int
itemCount
,
int
&
showWidth
,
int
&
showHeight
,
bool
&
hRoll
,
bool
&
vRoll
);
static
void
recalcShowRect
(
int
wndWidth
,
int
wndHeight
,
int
rollWidth
,
ThumbType
type
,
bool
hRoll
,
bool
vRoll
,
bool
showThumb
,
HGRect
&
showRect
);
void
locateItemEx
(
int
index
);
QPoint
getItemLoc
(
int
index
);
int
getItemRow
(
int
index
);
int
getItemCol
(
int
index
);
int
getTotalRows
();
int
getTotalCols
();
int
getItem
(
const
QPoint
&
pt
);
int
getInsertPos
(
const
QPoint
&
pt
);
int
findIndex
(
const
QString
&
fileName
);
QRect
getHRollPos
();
QRect
getHRollLeftPos
();
QRect
getHRollRightPos
();
QRect
getVRollPos
();
QRect
getVRollTopPos
();
QRect
getVRollBottomPos
();
QRect
getHRollSliderPos
();
QRect
getVRollSliderPos
();
QRect
getNullRollPos
();
void
Show
();
static
void
ThreadFunc
(
HGThread
thread
,
HGPointer
param
);
...
...
@@ -125,12 +149,17 @@ private:
int
m_signItemIndex
;
bool
m_stopThread
;
HGThread
m_thread
;
std
::
vector
<
HGImgThumbItem
>
m_frontItems
;
std
::
vector
<
HGImgThumbItem
*
>
m_frontItems
;
std
::
list
<
QString
>
m_backList
;
bool
m_hRoll
;
bool
m_vRoll
;
bool
m_showThumb
;
HGRect
m_showRect
;
int
m_mousePosX
;
int
m_mousePosY
;
MoveStauts
m_moveStatus
;
int
m_beginX
;
int
m_beginY
;
};
#endif
/* __HGIMGTHUMB_HPP__ */
ui/HGImgView.cpp
View file @
81171da7
...
...
@@ -28,6 +28,8 @@ HGImgView::~HGImgView()
HGBase_DestroyImage
(
m_image
);
m_image
=
NULL
;
}
qDebug
(
"~HGImgView"
);
}
HGResult
HGImgView
::
addImage
(
HGImage
image
)
...
...
@@ -376,6 +378,11 @@ HGResult HGImgView::showColorInfo(bool show)
void
HGImgView
::
mousePressEvent
(
QMouseEvent
*
e
)
{
if
(
e
->
button
()
!=
Qt
::
LeftButton
)
{
return
;
}
assert
(
0
==
m_operate
);
if
(
NULL
==
m_image
||
!
m_showImage
)
{
...
...
@@ -479,7 +486,10 @@ void HGImgView::mouseMoveEvent(QMouseEvent* e)
void
HGImgView
::
mouseReleaseEvent
(
QMouseEvent
*
e
)
{
Q_UNUSED
(
e
);
if
(
e
->
button
()
!=
Qt
::
LeftButton
)
{
return
;
}
m_operate
=
0
;
m_beginX
=
-
1
;
...
...
@@ -489,11 +499,12 @@ void HGImgView::mouseReleaseEvent(QMouseEvent* e)
void
HGImgView
::
enterEvent
(
QEvent
*
e
)
{
Q_UNUSED
(
e
);
}
void
HGImgView
::
leaveEvent
(
QEvent
*
e
)
{
Q_UNUSED
(
e
);
m_mousePosX
=
-
1
;
m_mousePosY
=
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment