Krita Source Code Documentation
Loading...
Searching...
No Matches
TabletTestDialog Class Reference

#include <tablettester.h>

+ Inheritance diagram for TabletTestDialog:

Public Member Functions

bool eventFilter (QObject *watched, QEvent *event) override
 
 TabletTestDialog (QWidget *parent=nullptr)
 
 ~TabletTestDialog ()
 
- Public Member Functions inherited from KoDialog
QPushButton * button (ButtonCode id) const
 
QIcon buttonIcon (ButtonCode id) const
 
QString buttonText (ButtonCode id) const
 
QString buttonToolTip (ButtonCode id) const
 
QString buttonWhatsThis (ButtonCode id) const
 
ButtonCode defaultButton () const
 
QString helpLinkText () const
 
void incrementInitialSize (const QSize &size)
 
bool isButtonEnabled (ButtonCode id) const
 
 KoDialog (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
 
QWidget * mainWidget ()
 
QSize minimumSizeHint () const override
 
void setButtonFocus (ButtonCode id)
 
void setButtonGuiItem (ButtonCode id, const KGuiItem &item)
 
void setButtonIcon (ButtonCode id, const QIcon &icon)
 
void setButtons (ButtonCodes buttonMask)
 
void setButtonsOrientation (Qt::Orientation orientation)
 
void setButtonText (ButtonCode id, const QString &text)
 
void setButtonToolTip (ButtonCode id, const QString &text)
 
void setButtonWhatsThis (ButtonCode id, const QString &text)
 
void setDefaultButton (ButtonCode id)
 
void setEscapeButton (ButtonCode id)
 
void setInitialSize (const QSize &size)
 
void setMainWidget (QWidget *widget)
 
void showButton (ButtonCode id, bool state)
 
void showButtonSeparator (bool state)
 
QSize sizeHint () const override
 
 ~KoDialog () override
 

Private Attributes

Ui_TabletTest * m_ui
 

Additional Inherited Members

- Public Types inherited from KoDialog
enum  ButtonCode {
  None = 0x00000000 , Help = 0x00000001 , Default = 0x00000002 , Ok = 0x00000004 ,
  Apply = 0x00000008 , Try = 0x00000010 , Cancel = 0x00000020 , Close = 0x00000040 ,
  No = 0x00000080 , Yes = 0x00000100 , Reset = 0x00000200 , Details = 0x00000400 ,
  User1 = 0x00001000 , User2 = 0x00002000 , User3 = 0x00004000 , NoDefault = 0x00008000
}
 
enum  ButtonPopupMode { InstantPopup = 0 , DelayedPopup = 1 }
 
enum  CaptionFlag { NoCaptionFlags = 0 , AppNameCaption = 1 , ModifiedCaption = 2 , HIGCompliantCaption = AppNameCaption }
 
- Public Slots inherited from KoDialog
void delayedDestruct ()
 
void enableButton (ButtonCode id, bool state)
 
void enableButtonApply (bool state)
 
void enableButtonCancel (bool state)
 
void enableButtonOk (bool state)
 
void enableLinkedHelp (bool state)
 
bool isDetailsWidgetVisible () const
 
virtual void setCaption (const QString &caption)
 
virtual void setCaption (const QString &caption, bool modified)
 
void setDetailsWidget (QWidget *detailsWidget)
 
void setDetailsWidgetVisible (bool visible)
 
void setHelp (const QString &anchor, const QString &appname=QString())
 
void setHelpLinkText (const QString &text)
 
virtual void setPlainCaption (const QString &caption)
 
- Signals inherited from KoDialog
void aboutToShowDetails ()
 
void applyClicked ()
 
void buttonClicked (KoDialog::ButtonCode button)
 
void cancelClicked ()
 
void closeClicked ()
 
void defaultClicked ()
 
void finished ()
 
void helpClicked ()
 
void hidden ()
 
void layoutHintChanged ()
 
void noClicked ()
 
void okClicked ()
 
void resetClicked ()
 
void tryClicked ()
 
void user1Clicked ()
 
void user2Clicked ()
 
void user3Clicked ()
 
void yesClicked ()
 
- Static Public Member Functions inherited from KoDialog
static int groupSpacingHint ()
 
static QString makeStandardCaption (const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption)
 
static int marginHint ()
 
static void resizeLayout (QLayout *lay, int margin, int spacing)
 
static void resizeLayout (QWidget *widget, int margin, int spacing)
 
static int spacingHint ()
 
- Protected Slots inherited from KoDialog
virtual void slotButtonClicked (int button)
 
- Protected Member Functions inherited from KoDialog
void closeEvent (QCloseEvent *e) override
 
void hideEvent (QHideEvent *) override
 
void keyPressEvent (QKeyEvent *) override
 
void showEvent (QShowEvent *e) override
 

Detailed Description

Definition at line 15 of file tablettester.h.

Constructor & Destructor Documentation

◆ TabletTestDialog()

TabletTestDialog::TabletTestDialog ( QWidget * parent = nullptr)

Definition at line 15 of file tablettester.cpp.

16 : KoDialog(parent, Qt::Dialog)
17{
18 setCaption(i18n("Tablet Tester"));
19 QWidget *page = new QWidget(this);
20 m_ui = new Ui_TabletTest;
21 m_ui->setupUi(page);
22 setMainWidget(page);
24 qApp->installEventFilter(this);
25 // Hack to work around extreme lag w/ S Pen on Android. Unless the focus is set on the tablet tester itself, pen input will appear to lag.
26 m_ui->tablettest->setFocus();
27
28 m_ui->logView->appendPlainText(
29 "## Legend:\n"
30 "# X,Y - event coordinate\n"
31 "# B - buttons pressed\n"
32 "# P - pressure\n"
33 "# TX,TY - tilt\n"
34 "# S - speed\n"
35 "\n");
36}
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:354
virtual void setCaption(const QString &caption)
Definition KoDialog.cpp:498
void setButtons(ButtonCodes buttonMask)
Definition KoDialog.cpp:195
@ Close
Show Close-button. (this button closes the dialog)
Definition KoDialog.h:131
KoDialog(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
Definition KoDialog.cpp:176
Ui_TabletTest * m_ui

References KoDialog::Close, m_ui, KoDialog::setButtons(), KoDialog::setCaption(), and KoDialog::setMainWidget().

◆ ~TabletTestDialog()

TabletTestDialog::~TabletTestDialog ( )

Definition at line 38 of file tablettester.cpp.

39{
40 qApp->removeEventFilter(this);
41 delete m_ui;
42}

References m_ui.

Member Function Documentation

◆ eventFilter()

bool TabletTestDialog::eventFilter ( QObject * watched,
QEvent * event )
override

Definition at line 44 of file tablettester.cpp.

44 {
45 Q_UNUSED(watched);
46 if(e->type() == QEvent::TabletEnterProximity || e->type() == QEvent::TabletLeaveProximity) {
47 QTabletEvent *te = static_cast<QTabletEvent*>(e);
48#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
49 bool isEraser = te->pointerType() == QTabletEvent::Eraser;
50#else
51 bool isEraser = te->pointingDevice()->pointerType() == QPointingDevice::PointerType::Eraser;
52#endif
53
54 bool isNear = e->type() == QEvent::TabletEnterProximity;
55 QString msg;
56 if(isEraser) {
57 if (isNear) {
58 msg = QStringLiteral("Eraser brought near");
59 } else {
60 msg = QStringLiteral("Eraser taken away");
61 }
62 } else {
63 if (isNear) {
64 msg = QStringLiteral("Pen tip brought near");
65 } else {
66 msg = QStringLiteral("Pen tip taken away");
67 }
68 }
69
70 m_ui->logView->appendPlainText(msg);
71 }
72 return QDialog::eventFilter(watched, e);
73}

References m_ui.

Member Data Documentation

◆ m_ui

Ui_TabletTest* TabletTestDialog::m_ui
private

Definition at line 24 of file tablettester.h.


The documentation for this class was generated from the following files: