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

#include <kis_dlg_preferences.h>

+ Inheritance diagram for TabletSettingsTab:

Public Member Functions

void setDefault ()
 
 TabletSettingsTab (QWidget *parent=0, const char *name=0)
 

Public Attributes

WdgTabletSettingsm_page
 

Private Slots

void slotResolutionSettings ()
 
void slotTabletTest ()
 

Detailed Description

Definition at line 235 of file kis_dlg_preferences.h.

Constructor & Destructor Documentation

◆ TabletSettingsTab()

TabletSettingsTab::TabletSettingsTab ( QWidget * parent = 0,
const char * name = 0 )

Definition at line 1635 of file kis_dlg_preferences.cc.

1635 : QWidget(parent)
1636{
1637 setObjectName(name);
1638
1639 QGridLayout * l = new QGridLayout(this);
1640 l->setContentsMargins(0, 0, 0, 0);
1641 m_page = new WdgTabletSettings(this);
1642 l->addWidget(m_page, 0, 0);
1643
1644 KisConfig cfg(true);
1645 const KisCubicCurve curve(cfg.pressureTabletCurve());
1646 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1647 m_page->pressureCurve->setCurve(curve);
1648
1649 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1650 cfg.useRightMiddleTabletButtonWorkaround());
1651
1652#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1653# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1654 QString actualTabletProtocol = "<unknown>";
1655 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1656 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1657 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1658 }
1659 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1660# endif
1661 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1662 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1663
1664 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1665 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1666 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1667#else
1668 m_page->grpTabletApi->setVisible(false);
1669#endif
1670 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1671
1672#ifdef Q_OS_WIN
1673 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1674#else
1675 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1676#endif
1677 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1678
1679#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1680 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1681 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1682#else
1683 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1684#endif
1685
1686#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1687 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1688#else
1689 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1690#endif
1691
1692 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1693 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1694 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1695 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1696 // and it will be substituted by the number. The text before will be
1697 // used as the prefix and the text after as the suffix
1698 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1699 });
1700
1701 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1702 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1703 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1704 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1705 // and it will be substituted by the number. The text before will be
1706 // used as the prefix and the text after as the suffix
1707 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1708 });
1709
1710 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1711 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1712 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1713 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1714 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1715 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1716}
float value(const T *src, size_t ch)
@ FlipOptionsMode_MenuButton
The flip options are shown as a menu accessible via a options button.
WdgTabletSettings * m_page
void install(QSpinBox *spinBox, std::function< QString(int)> messageFn)

References KisAngleSelector::FlipOptionsMode_MenuButton, KisSpinBoxI18nHelper::install(), m_page, KisConfig::pressureTabletCurve(), KisConfig::readEntry(), slotResolutionSettings(), slotTabletTest(), KisConfig::useRightMiddleTabletButtonWorkaround(), KisConfig::useWin8PointerInput(), and value().

Member Function Documentation

◆ setDefault()

void TabletSettingsTab::setDefault ( )

Definition at line 1604 of file kis_dlg_preferences.cc.

1605{
1606 KisConfig cfg(true);
1607 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1608 m_page->pressureCurve->setCurve(curve);
1609
1610 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1611 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1612
1613#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1614 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1615 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1616#else
1617 m_page->grpTabletApi->setVisible(false);
1618#endif
1619
1620#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1621 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1622 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1623#endif
1624
1625#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1626 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1627#endif
1628
1629 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1630 m_page->intMaxAllowedBrushSpeed->setValue(30);
1631 m_page->intBrushSpeedSmoothing->setValue(3);
1632 m_page->tiltDirectionOffsetAngle->setAngle(0);
1633}

References m_page, KisConfig::pressureTabletCurve(), and KisConfig::useWin8PointerInput().

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1728 of file kis_dlg_preferences.cc.

1729{
1730#ifdef Q_OS_WIN
1732 dlg.exec();
1733#endif
1734}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1718 of file kis_dlg_preferences.cc.

1719{
1720 TabletTestDialog tabletTestDialog(this);
1721 tabletTestDialog.exec();
1722}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 246 of file kis_dlg_preferences.h.


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