Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Miguel Lopez
Krita
Commits
39e15d60
Commit
39e15d60
authored
May 06, 2018
by
Alvin Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add TabletTester code files from Drawpile
The source files are not yet modified.
parent
b1d67ddc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
415 additions
and
0 deletions
+415
-0
libs/ui/input/wintab/drawpile_tablettester/README.md
libs/ui/input/wintab/drawpile_tablettester/README.md
+17
-0
libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
+139
-0
libs/ui/input/wintab/drawpile_tablettester/tablettest.h
libs/ui/input/wintab/drawpile_tablettester/tablettest.h
+65
-0
libs/ui/input/wintab/drawpile_tablettester/tablettest.ui
libs/ui/input/wintab/drawpile_tablettester/tablettest.ui
+99
-0
libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
+52
-0
libs/ui/input/wintab/drawpile_tablettester/tablettester.h
libs/ui/input/wintab/drawpile_tablettester/tablettester.h
+43
-0
No files found.
libs/ui/input/wintab/drawpile_tablettester/README.md
0 → 100644
View file @
39e15d60
Notes on code originating from external source:
Tablet Tester
=============
Files are taken and possibly modified from the git repo of [Drawpile] on
commit bc06dceba83e8c758d25cfe81b986e18f38aae95.
[
Drawpile
]:
https://github.com/drawpile/Drawpile
File | Original in repo of Drawpile
-------------------- | ---
tablettester.cpp | src/desktop/dialogs/tablettester.cpp
tablettester.h | src/desktop/dialogs/tablettester.h
tablettest.cpp | src/desktop/widgets/tablettest.cpp
tablettest.h | src/desktop/widgets/tablettest.h
tablettest.ui | src/desktop/ui/tablettest.ui
libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
0 → 100644
View file @
39e15d60
/*
Drawpile - a collaborative drawing program.
Copyright (C) 2017 Calle Laakkonen
Drawpile is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Drawpile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Drawpile. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tablettest.h"
#include <QPaintEvent>
#include <QPainter>
#ifndef DESIGNER_PLUGIN
namespace
widgets
{
#endif
TabletTester
::
TabletTester
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_mouseDown
(
false
),
m_tabletDown
(
false
)
{
}
void
TabletTester
::
clear
()
{
m_mousePath
.
clear
();
m_tabletPath
.
clear
();
update
();
}
void
TabletTester
::
paintEvent
(
QPaintEvent
*
e
)
{
Q_UNUSED
(
e
);
const
int
w
=
width
();
const
int
h
=
height
();
QPainter
p
(
this
);
p
.
fillRect
(
0
,
0
,
w
,
h
,
QColor
(
200
,
200
,
200
));
p
.
setPen
(
QColor
(
128
,
128
,
128
));
// Draw grid
for
(
int
i
=
w
/
8
;
i
<
w
;
i
+=
w
/
8
)
p
.
drawLine
(
i
,
0
,
i
,
h
);
for
(
int
i
=
h
/
8
;
i
<
h
;
i
+=
h
/
8
)
p
.
drawLine
(
0
,
i
,
w
,
i
);
// Draw paths
if
(
!
m_mousePath
.
isEmpty
())
{
p
.
setPen
(
QPen
(
Qt
::
red
,
3
));
p
.
drawPolyline
(
m_mousePath
);
}
if
(
!
m_tabletPath
.
isEmpty
())
{
p
.
setPen
(
QPen
(
Qt
::
blue
,
2
));
p
.
drawPolyline
(
m_tabletPath
);
}
}
void
TabletTester
::
mousePressEvent
(
QMouseEvent
*
e
)
{
emit
eventReport
(
QString
(
"Mouse press X=%1 Y=%2 B=%3"
).
arg
(
e
->
x
()).
arg
(
e
->
y
()).
arg
(
e
->
button
()));
m_mouseDown
=
true
;
m_mousePath
.
clear
();
update
();
}
void
TabletTester
::
mouseMoveEvent
(
QMouseEvent
*
e
)
{
emit
eventReport
(
QString
(
"Mouse move X=%1 Y=%2 B=%3"
).
arg
(
e
->
x
()).
arg
(
e
->
y
()).
arg
(
e
->
buttons
()));
m_mousePath
<<
e
->
pos
();
update
();
}
void
TabletTester
::
mouseReleaseEvent
(
QMouseEvent
*
e
)
{
Q_UNUSED
(
e
);
emit
eventReport
(
QString
(
"Mouse release"
));
m_mouseDown
=
false
;
}
void
TabletTester
::
tabletEvent
(
QTabletEvent
*
e
)
{
e
->
accept
();
QString
msg
;
switch
(
e
->
device
())
{
case
QTabletEvent
::
Stylus
:
msg
=
"Stylus"
;
break
;
default:
msg
=
QString
(
"Device(%1)"
).
arg
(
e
->
device
());
break
;
}
switch
(
e
->
type
())
{
case
QEvent
::
TabletMove
:
msg
+=
" move"
;
break
;
case
QEvent
::
TabletPress
:
msg
+=
" press"
;
m_tabletPath
.
clear
();
m_tabletDown
=
true
;
break
;
case
QEvent
::
TabletRelease
:
msg
+=
" release"
;
m_tabletDown
=
false
;
break
;
default:
msg
+=
QString
(
" event-%1"
).
arg
(
e
->
type
());
break
;
}
msg
+=
QString
(
" X=%1 Y=%2 B=%3 P=%4%"
)
.
arg
(
e
->
posF
().
x
(),
0
,
'f'
,
2
)
.
arg
(
e
->
posF
().
y
(),
0
,
'f'
,
2
)
.
arg
(
e
->
buttons
())
.
arg
(
e
->
pressure
()
*
100
,
0
,
'f'
,
1
)
;
if
(
e
->
type
()
==
QEvent
::
TabletMove
)
{
if
(
m_tabletDown
)
{
msg
+=
" (DRAW)"
;
m_tabletPath
<<
e
->
pos
();
update
();
}
else
{
msg
+=
" (HOVER)"
;
}
}
emit
eventReport
(
msg
);
}
#ifndef DESIGNER_PLUGIN
}
#endif
libs/ui/input/wintab/drawpile_tablettester/tablettest.h
0 → 100644
View file @
39e15d60
/*
Drawpile - a collaborative drawing program.
Copyright (C) 2017 Calle Laakkonen
Drawpile is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Drawpile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Drawpile. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TABLETTEST_WIDGET_H
#define TABLETTEST_WIDGET_H
#include <QWidget>
#ifndef DESIGNER_PLUGIN
namespace
widgets
{
#define PLUGIN_EXPORT
#else
#include <QtUiPlugin/QDesignerExportWidget>
#define PLUGIN_EXPORT QDESIGNER_WIDGET_EXPORT
#endif
class
PLUGIN_EXPORT
TabletTester
:
public
QWidget
{
Q_OBJECT
public:
TabletTester
(
QWidget
*
parent
=
nullptr
);
public
slots
:
void
clear
();
signals:
void
eventReport
(
const
QString
&
msg
);
protected:
void
paintEvent
(
QPaintEvent
*
e
)
override
;
void
mousePressEvent
(
QMouseEvent
*
e
)
override
;
void
mouseMoveEvent
(
QMouseEvent
*
e
)
override
;
void
mouseReleaseEvent
(
QMouseEvent
*
e
)
override
;
void
tabletEvent
(
QTabletEvent
*
e
)
override
;
private:
QPolygon
m_mousePath
;
QPolygon
m_tabletPath
;
bool
m_mouseDown
;
bool
m_tabletDown
;
};
#ifndef DESIGNER_PLUGIN
}
#endif
#endif
libs/ui/input/wintab/drawpile_tablettester/tablettest.ui
0 → 100644
View file @
39e15d60
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
TabletTest
</class>
<widget
class=
"QDialog"
name=
"TabletTest"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
730
</width>
<height>
385
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Tablet Tester
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"1,1"
>
<item>
<widget
class=
"TabletTester"
name=
"tablettest"
/>
</item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QPlainTextEdit"
name=
"logView"
>
<property
name=
"readOnly"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
Clear
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
TabletTester
</class>
<extends>
QWidget
</extends>
<header>
widgets/tablettest.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>
pushButton
</sender>
<signal>
clicked()
</signal>
<receiver>
logView
</receiver>
<slot>
clear()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
722
</x>
<y>
377
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
659
</x>
<y>
84
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
pushButton
</sender>
<signal>
clicked()
</signal>
<receiver>
tablettest
</receiver>
<slot>
clear()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
419
</x>
<y>
359
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
142
</x>
<y>
242
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
tablettest
</sender>
<signal>
eventReport(QString)
</signal>
<receiver>
logView
</receiver>
<slot>
appendPlainText(QString)
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
287
</x>
<y>
187
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
546
</x>
<y>
207
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
0 → 100644
View file @
39e15d60
/*
Drawpile - a collaborative drawing program.
Copyright (C) 2017 Calle Laakkonen
Drawpile is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Drawpile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Drawpile. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tablettester.h"
#include "widgets/tablettest.h"
using
widgets
::
TabletTester
;
// work around missing namespace in UIC generated code
#include "ui_tablettest.h"
#include "../main.h"
namespace
dialogs
{
TabletTestDialog
::
TabletTestDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
m_ui
=
new
Ui_TabletTest
;
m_ui
->
setupUi
(
this
);
connect
(
static_cast
<
DrawpileApp
*>
(
qApp
),
&
DrawpileApp
::
eraserNear
,
this
,
[
this
](
bool
near
)
{
QString
msg
;
if
(
near
)
msg
=
QStringLiteral
(
"Eraser brought near"
);
else
msg
=
QStringLiteral
(
"Eraser taken away"
);
m_ui
->
logView
->
appendPlainText
(
msg
);
});
}
TabletTestDialog
::~
TabletTestDialog
()
{
delete
m_ui
;
}
}
libs/ui/input/wintab/drawpile_tablettester/tablettester.h
0 → 100644
View file @
39e15d60
/*
Drawpile - a collaborative drawing program.
Copyright (C) 2017 Calle Laakkonen
Drawpile is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Drawpile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Drawpile. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TABLETTESTDIALOG_H
#define TABLETTESTDIALOG_H
#include <QDialog>
class
Ui_TabletTest
;
namespace
dialogs
{
class
TabletTestDialog
:
public
QDialog
{
Q_OBJECT
public:
TabletTestDialog
(
QWidget
*
parent
=
nullptr
);
~
TabletTestDialog
();
private:
Ui_TabletTest
*
m_ui
;
};
}
#endif
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