Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
05ee7be8
Commit
05ee7be8
authored
May 24, 2019
by
LEFEBVREJP email
Browse files
Merge branch 'tableview_update' into 'master'
tableview update See merge request
!72
parents
2f147bba
7f97c7d7
Pipeline
#56738
passed with stages
in 13 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixwidgets/tableview.cc
View file @
05ee7be8
...
...
@@ -13,6 +13,8 @@ class RADIX_PUBLIC TableView::PImpl
{
public:
bool
allow_paste
;
bool
copy_vert_header
;
bool
copy_horiz_header
;
char
separator
;
PImpl
();
};
...
...
@@ -20,6 +22,8 @@ class RADIX_PUBLIC TableView::PImpl
TableView
::
PImpl
::
PImpl
()
{
allow_paste
=
false
;
copy_vert_header
=
false
;
copy_horiz_header
=
false
;
separator
=
'\t'
;
}
...
...
@@ -33,6 +37,10 @@ char TableView::separator() const { return p->separator; }
void
TableView
::
setSeparator
(
char
value
)
{
p
->
separator
=
value
;
}
void
TableView
::
setCopyVertHeader
(
bool
value
)
{
p
->
copy_vert_header
=
value
;
}
void
TableView
::
setCopyHorizHeader
(
bool
value
)
{
p
->
copy_horiz_header
=
value
;
}
bool
TableView
::
allowPaste
()
const
{
return
p
->
allow_paste
;
}
void
TableView
::
setAllowPaste
(
bool
value
)
{
p
->
allow_paste
=
value
;
}
...
...
@@ -82,16 +90,19 @@ void TableView::copy()
QString
data
;
// add column headers
if
(
horizontalHeader
()
->
isVisible
())
if
(
horizontalHeader
()
->
isVisible
()
&&
p
->
copy_horiz_header
)
{
if
(
verticalHeader
()
->
isVisible
())
if
(
verticalHeader
()
->
isVisible
()
&&
p
->
copy_vert_header
)
{
data
.
append
(
p
->
separator
);
}
for
(
auto
col
:
cols
)
if
(
p
->
copy_horiz_header
)
{
data
.
append
(
chmodel
->
headerData
(
col
,
Qt
::
Horizontal
).
toString
())
.
append
(
p
->
separator
);
for
(
int
i
=
0
;
i
<
cols
.
size
();
i
++
)
{
if
(
i
>
0
)
data
.
append
(
p
->
separator
);
data
.
append
(
chmodel
->
headerData
(
cols
[
i
],
Qt
::
Horizontal
).
toString
());
}
}
data
.
append
(
'\n'
);
}
...
...
@@ -100,24 +111,24 @@ void TableView::copy()
for
(
auto
row
:
rows
)
{
// add row header
if
(
verticalHeader
()
->
isVisible
())
if
(
verticalHeader
()
->
isVisible
()
&&
p
->
copy_vert_header
)
{
data
.
append
(
rhmodel
->
headerData
(
row
,
Qt
::
Vertical
).
toString
())
.
append
(
p
->
separator
);
}
// add row's cells
for
(
auto
col
:
cols
)
for
(
int
i
=
0
;
i
<
cols
.
size
();
i
++
)
{
if
(
i
>
0
)
data
.
append
(
p
->
separator
);
// row's data
auto
&
rd
=
cells
[
row
];
// current cell is valid
if
(
rd
.
contains
(
col
))
if
(
rd
.
contains
(
col
s
[
i
]
))
{
data
.
append
(
rd
[
col
]);
data
.
append
(
rd
[
col
s
[
i
]
]);
}
data
.
append
(
p
->
separator
);
}
data
.
append
(
'\n'
);
}
...
...
radixwidgets/tableview.hh
View file @
05ee7be8
...
...
@@ -27,6 +27,8 @@ class RADIX_PUBLIC TableView : public QTableView
char
separator
()
const
;
void
setSeparator
(
char
value
);
void
setCopyVertHeader
(
bool
value
);
void
setCopyHorizHeader
(
bool
value
);
bool
allowPaste
()
const
;
void
setAllowPaste
(
bool
value
);
...
...
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