qskinny/playground/inputpanel/main.cpp

396 lines
11 KiB
C++
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
2024-01-17 13:31:45 +00:00
* QSkinny - Copyright (C) The authors
2023-04-06 07:23:37 +00:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 16:21:34 +00:00
*****************************************************************************/
#include <SkinnyShortcut.h>
2017-07-28 12:47:11 +00:00
#include <QskDialog.h>
#include <QskFocusIndicator.h>
2018-08-03 06:15:28 +00:00
#include <QskInputContext.h>
#include <QskInputPanel.h>
2017-07-28 12:47:11 +00:00
#include <QskLinearBox.h>
#include <QskListView.h>
Squashed commit of the following: commit c331fd601a727ca0c616f320a0d35577c3689352 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 10 12:17:51 2024 +0100 use enums for class members commit 0d86454774aa440af1d403f9d8f6dc6f843eafbe Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 10 11:27:16 2024 +0100 elide mode for QskTextField::PlaceholderText added commit 0038f6d3b34d3a8c9229532f33125035922ac15c Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 16:03:55 2024 +0100 more enums specified commit 5d959133663226f3fc04c0f708d4cf1f82969833 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:56:49 2024 +0100 QskSizePolicy enums specified commit 4220edc7ca741483f7be44748aa0cfb6e26e545b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:46:43 2024 +0100 don't use enum bitfields for unspecied enums commit 36f502b57ab19deca67702c7e5dfafa2f3edcca9 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:43:57 2024 +0100 QskItem::UpdateFlags sepcified commit 23beda3c2868f3d23560c4dadc6f0a9703475d40 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:39:06 2024 +0100 more enum types specified commit 08495715231243e3e6f00a2fa83a1ed57894863b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:21:37 2024 +0100 enum types specified commit d53579f3d9e74657b7d3c567842917e7055b2c50 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:04:37 2024 +0100 enum types specified commit 4e6ee36420dfffb5ba00dce37807e50694ea31c9 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 14:53:59 2024 +0100 NodeRole enums qualified as quint8 commit 3a83f5fa2c29c4da1dd3fab44823c12927346fd8 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 13:29:03 2024 +0100 compiler errors fixed commit d1fa0207fa12eb4a47d8ffc895ade75f23895ccd Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 12:10:10 2024 +0100 Markdown format added commit 66d97831b50af569036ccd2bc40fddd0b6b1de48 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 12:01:16 2024 +0100 QskTextColors is a Q_GADGET now commit 4ad28e6076ad5ab297ddfbc836f76a2844820499 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 10:04:33 2024 +0100 don't show the placeholder when text is not empty commit b6f20038265661cc6fe8a3f199d8ce5d79beda75 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Dec 4 10:08:39 2024 +0100 QskTextFieldSkinlet::sizeHint added commit f0d53322aaa98ff818fc84aa2d02a7e34603febd Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 17:52:39 2024 +0100 gallery updated, dummy TextFieldSkinlets introduced commit e86378a0725b8a3dd74cf52727df4309ef2f151a Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 13:33:17 2024 +0100 fusion skin improved commit 4540cc1e4e21fea77d80343b3f4c27f9386b7c3e Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 10:06:26 2024 +0100 QskTextFieldSkinlet::Selected state introduced commit 77e556fad27cd133c40103205a8b3ac35b273cb7 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 09:32:39 2024 +0100 QskTextField::placeholderText introduced, QskTextField::description removed commit 77739d773474306c00ec2fce67f8d2ba11a63f2b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 07:44:44 2024 +0100 skin hint table size reduced commit 108aa23397265749216909d2a48bdf7111f7fb9c Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 2 12:54:31 2024 +0100 QskTextInput renamed to QskTextField ( term used by F2/M3 and QC2 ) commit b0864965a804a514525d53986e8425444b2ca5ff Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Sun Dec 1 11:06:51 2024 +0100 Material3 adjustements for progress bars commit d18017ca90b93c8c366ad6b755699bc40c42ad62 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 29 13:55:30 2024 +0100 QskProgressRing fixed + M3 updates commit a58d6dd5896b2c9e92a959668f452e50c733e385 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 29 09:42:01 2024 +0100 QskProgressIndicator::hasOrigin(), QskSlider::hasOrigin added commit 12dfac153d473040ab98eec7bd9178897347b0e0 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 16:06:00 2024 +0100 QskSlider::inverted introduced commit db1e9a7e44aa045e05948dba354e40d96cc83b92 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:59:59 2024 +0100 key handling of bounded inputs improved commit d9a66e4a98407d72b9a078ea0b8a99af6aadf009 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:55:57 2024 +0100 QskSlider API cleanup commit 9d13cd1edf8608fea7e1b7f43e732ac1d30f7447 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:47:20 2024 +0100 subcontrol renamed from Knob to Handle commit 7a180cfe5e9fefe1f69da84b46c34d9cf2ca4dca Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 12:00:46 2024 +0100 the corrected mouse/touch handling works without extending the handle selection area handle selection commit 66085ea41f0c708f5f3e7dfd62365493c4f2ac7b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 27 16:27:57 2024 +0100 QskSlider::origin implemented commit e2c76aa121653f82758100464e23b0443086a254 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 27 16:24:55 2024 +0100 QskSlider ticks implementaton completed commit 77731954eb081416928fa4f998f2f23318a4ba92 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:59:42 2024 +0100 slider changes on press commit 59b88ffd7c5502ee50c657feac366226b2bd8900 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:57:13 2024 +0100 slider layout code fixed commit cd65adb4518d8f22d570d83cb3211a57ada35aef Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:48:55 2024 +0100 QskSkinnable::metric with default value commit ea3d7a5e699bd813d16528fb3b81d69b30f0737d Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 25 09:02:04 2024 +0100 QskInterval::center(), QskInterval::stretch removed as they the implementation is only handling normalized intervals commit 494c370e61bcb418c97426116bffa0bab501c6d4 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 22 17:38:58 2024 +0100 ticks for F2 sliders commit f4c2211f2c196b6662fdc023578e1498805f3377 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 22 17:37:47 2024 +0100 API extended commit 5c1e0ccad485fc81a3fa0b9576333fcefd7bdfdc Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 19:19:53 2024 +0100 invalid constexpr qualifier removed commit 9a5dd886ed2445606dc7887e7d7024a588a967aa Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 17:59:54 2024 +0100 slider ticks - not only for M3 commit d04c0309248b72088d7099cbcd86140739b15885 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 17:59:37 2024 +0100 using constexpr commit d87c8e3d0b4b579aa0a67c173833c4a7ea28af0a Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 13:54:01 2024 +0100 API cleanup of the Bounded controls commit 109fc7d7f48420662b5ca9bed548444dce83e055 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 20 14:57:16 2024 +0100 QskBoxClipNode renamed to QskClipNode + more clip options added commit 1e383406e213fc3f129729760da3960b16d2e827 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 20 11:00:17 2024 +0100 M3 specific definitions moved to M3 classes commit 97e3ea6e1f10a804cb1b4c926ff9f3506f20df3b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 18 16:44:06 2024 +0100 Qt5 incompatibility fixed commit 00f2112817e1a07cb37ab3e4e421393716a37fc6 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 18 16:15:50 2024 +0100 QskMaterial3SliderSkinlet introduced commit 9fc7b1f677f2983d304dfedabd6499214f60fc31 Author: Peter Hartmann <peter@edelhirsch.io> Date: Mon Nov 18 12:18:30 2024 +0100 push buttons: Style checked state properly (#477) Resolves #367 commit b5c56f7f8043391d1236eefcf4510d54d9aee4a2 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 10:52:08 2024 +0100 mismatch between allocated and used memory fixed commit d1c2751a8e40e32e1ed45663b3ea42e4621b3960 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 10:51:53 2024 +0100 nullptr check added commit 8dd5a7b249edfa269a048496d9b6577297933fc2 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 08:52:40 2024 +0100 dangling reference fixed commit baaccb2f414b28f647f50c05081418415c6fd295 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 07:43:34 2024 +0100 avoid enum bitfields commit 7f389ef6cca50800fadc19c35ae951213989418b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 13 14:11:11 2024 +0100 don't subtract the slider margins twice commit d84ab6e387163cc2da6c4d3e6a2ab623a324e727 Author: Peter Hartmann <peter@edelhirsch.io> Date: Wed Nov 13 10:00:38 2024 +0100 Update instructions on how to build the website (#470) * Regenerate doxygen file ... and change some things * Add custom stylesheet from Skia * update instructions on how to build the website commit 525ca3bd0e66dc864b5d21e37d8dd7f95cb060f3 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 7 17:31:14 2024 +0100 QskSlider: Adapt to new Material3 style ( ValueLabel a.k.a Tooltip is not done yet )
2024-12-10 13:41:17 +00:00
#include <QskTextField.h>
2017-07-28 12:47:11 +00:00
#include <QskAspect.h>
2020-03-13 12:32:22 +00:00
#include <QskFunctions.h>
#include <QskInputPanelBox.h>
2017-07-21 16:21:34 +00:00
#include <QskObjectCounter.h>
#include <QskVirtualKeyboard.h>
#include <QskWindow.h>
2017-07-21 16:21:34 +00:00
#include <QFontMetricsF>
2018-08-03 06:15:28 +00:00
#include <QGuiApplication>
2017-07-21 16:21:34 +00:00
namespace
{
class Keyboard final : public QskVirtualKeyboard
{
using Inherited = QskVirtualKeyboard;
public:
Keyboard( QQuickItem* parentItem = nullptr ):
QskVirtualKeyboard( parentItem )
{
// here rearrange keyboard layouts if necessary
}
};
class Panel : public QskInputPanel
{
public:
Panel( QQuickItem* parentItem = nullptr )
: QskInputPanel( parentItem )
{
setAutoLayoutChildren( true );
setLayoutAlignmentHint( Qt::AlignHCenter | Qt::AlignBottom );
m_box = new QskInputPanelBox( this );
m_box->setKeyboard( new Keyboard() );
connect( m_box, &QskInputPanelBox::keySelected,
this, &QskInputPanel::keySelected );
connect( m_box, &QskInputPanelBox::predictiveTextSelected,
this, &QskInputPanel::predictiveTextSelected );
}
void attachItem( QQuickItem* item ) override
{
m_box->attachInputItem( item );
}
QQuickItem* inputProxy() const override
{
return m_box->inputProxy();
}
void setPrompt( const QString& prompt ) override
{
m_box->setInputPrompt( prompt );
}
void setPredictionEnabled( bool on ) override
{
m_box->setPanelHint( QskInputPanelBox::Prediction, on );
}
void setPrediction( const QStringList& prediction ) override
{
QskInputPanel::setPrediction( prediction );
m_box->setPrediction( prediction );
}
private:
QskInputPanelBox* m_box;
};
class InputContextFactory : public QskInputContextFactory
{
QskInputPanel* createPanel() const override
{
return new Panel;
}
};
QString nativeLocaleString( const QLocale& locale )
{
switch ( locale.language() )
{
case QLocale::Bulgarian:
return QStringLiteral( "български език" );
case QLocale::Czech:
return QStringLiteral( "Čeština" );
case QLocale::German:
return QStringLiteral( "Deutsch" );
case QLocale::Danish:
return QStringLiteral( "Dansk" );
case QLocale::Greek:
return QStringLiteral( "Eλληνικά" );
case QLocale::English:
{
2023-11-15 10:52:07 +00:00
const auto territory =
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
locale.territory();
#else
locale.country();
#endif
switch ( territory )
{
case QLocale::Canada:
case QLocale::UnitedStates:
case QLocale::UnitedStatesMinorOutlyingIslands:
case QLocale::UnitedStatesVirginIslands:
return QStringLiteral( "English (US)" );
default:
return QStringLiteral( "English (UK)" );
}
}
case QLocale::Spanish:
return QStringLiteral( "Español" );
case QLocale::Finnish:
return QStringLiteral( "Suomi" );
case QLocale::French:
return QStringLiteral( "Français" );
case QLocale::Hungarian:
return QStringLiteral( "Magyar" );
case QLocale::Italian:
return QStringLiteral( "Italiano" );
case QLocale::Japanese:
return QStringLiteral( "日本語" );
case QLocale::Latvian:
return QStringLiteral( "Latviešu" );
case QLocale::Lithuanian:
return QStringLiteral( "Lietuvių" );
case QLocale::Dutch:
return QStringLiteral( "Nederlands" );
case QLocale::Portuguese:
return QStringLiteral( "Português" );
case QLocale::Romanian:
return QStringLiteral( "Română" );
case QLocale::Russian:
return QStringLiteral( "Русский" );
case QLocale::Slovenian:
return QStringLiteral( "Slovenščina" );
case QLocale::Slovak:
return QStringLiteral( "Slovenčina" );
case QLocale::Turkish:
return QStringLiteral( "Türkçe" );
case QLocale::Chinese:
return QStringLiteral( "中文" );
default:
return QLocale::languageToString( locale.language() );
}
}
}
2017-07-28 12:47:11 +00:00
class InputBox : public QskLinearBox
{
2018-08-03 06:15:28 +00:00
public:
InputBox( QQuickItem* parentItem = nullptr )
: QskLinearBox( Qt::Vertical, parentItem )
2017-07-28 12:47:11 +00:00
{
2018-04-11 15:33:43 +00:00
setExtraSpacingAt( Qt::BottomEdge | Qt::RightEdge );
2017-07-28 12:47:11 +00:00
setMargins( 10 );
setSpacing( 10 );
Squashed commit of the following: commit c331fd601a727ca0c616f320a0d35577c3689352 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 10 12:17:51 2024 +0100 use enums for class members commit 0d86454774aa440af1d403f9d8f6dc6f843eafbe Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 10 11:27:16 2024 +0100 elide mode for QskTextField::PlaceholderText added commit 0038f6d3b34d3a8c9229532f33125035922ac15c Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 16:03:55 2024 +0100 more enums specified commit 5d959133663226f3fc04c0f708d4cf1f82969833 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:56:49 2024 +0100 QskSizePolicy enums specified commit 4220edc7ca741483f7be44748aa0cfb6e26e545b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:46:43 2024 +0100 don't use enum bitfields for unspecied enums commit 36f502b57ab19deca67702c7e5dfafa2f3edcca9 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:43:57 2024 +0100 QskItem::UpdateFlags sepcified commit 23beda3c2868f3d23560c4dadc6f0a9703475d40 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:39:06 2024 +0100 more enum types specified commit 08495715231243e3e6f00a2fa83a1ed57894863b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:21:37 2024 +0100 enum types specified commit d53579f3d9e74657b7d3c567842917e7055b2c50 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 15:04:37 2024 +0100 enum types specified commit 4e6ee36420dfffb5ba00dce37807e50694ea31c9 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 14:53:59 2024 +0100 NodeRole enums qualified as quint8 commit 3a83f5fa2c29c4da1dd3fab44823c12927346fd8 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 13:29:03 2024 +0100 compiler errors fixed commit d1fa0207fa12eb4a47d8ffc895ade75f23895ccd Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 12:10:10 2024 +0100 Markdown format added commit 66d97831b50af569036ccd2bc40fddd0b6b1de48 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 12:01:16 2024 +0100 QskTextColors is a Q_GADGET now commit 4ad28e6076ad5ab297ddfbc836f76a2844820499 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 9 10:04:33 2024 +0100 don't show the placeholder when text is not empty commit b6f20038265661cc6fe8a3f199d8ce5d79beda75 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Dec 4 10:08:39 2024 +0100 QskTextFieldSkinlet::sizeHint added commit f0d53322aaa98ff818fc84aa2d02a7e34603febd Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 17:52:39 2024 +0100 gallery updated, dummy TextFieldSkinlets introduced commit e86378a0725b8a3dd74cf52727df4309ef2f151a Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 13:33:17 2024 +0100 fusion skin improved commit 4540cc1e4e21fea77d80343b3f4c27f9386b7c3e Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 10:06:26 2024 +0100 QskTextFieldSkinlet::Selected state introduced commit 77e556fad27cd133c40103205a8b3ac35b273cb7 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 09:32:39 2024 +0100 QskTextField::placeholderText introduced, QskTextField::description removed commit 77739d773474306c00ec2fce67f8d2ba11a63f2b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Dec 3 07:44:44 2024 +0100 skin hint table size reduced commit 108aa23397265749216909d2a48bdf7111f7fb9c Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Dec 2 12:54:31 2024 +0100 QskTextInput renamed to QskTextField ( term used by F2/M3 and QC2 ) commit b0864965a804a514525d53986e8425444b2ca5ff Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Sun Dec 1 11:06:51 2024 +0100 Material3 adjustements for progress bars commit d18017ca90b93c8c366ad6b755699bc40c42ad62 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 29 13:55:30 2024 +0100 QskProgressRing fixed + M3 updates commit a58d6dd5896b2c9e92a959668f452e50c733e385 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 29 09:42:01 2024 +0100 QskProgressIndicator::hasOrigin(), QskSlider::hasOrigin added commit 12dfac153d473040ab98eec7bd9178897347b0e0 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 16:06:00 2024 +0100 QskSlider::inverted introduced commit db1e9a7e44aa045e05948dba354e40d96cc83b92 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:59:59 2024 +0100 key handling of bounded inputs improved commit d9a66e4a98407d72b9a078ea0b8a99af6aadf009 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:55:57 2024 +0100 QskSlider API cleanup commit 9d13cd1edf8608fea7e1b7f43e732ac1d30f7447 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 15:47:20 2024 +0100 subcontrol renamed from Knob to Handle commit 7a180cfe5e9fefe1f69da84b46c34d9cf2ca4dca Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 28 12:00:46 2024 +0100 the corrected mouse/touch handling works without extending the handle selection area handle selection commit 66085ea41f0c708f5f3e7dfd62365493c4f2ac7b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 27 16:27:57 2024 +0100 QskSlider::origin implemented commit e2c76aa121653f82758100464e23b0443086a254 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 27 16:24:55 2024 +0100 QskSlider ticks implementaton completed commit 77731954eb081416928fa4f998f2f23318a4ba92 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:59:42 2024 +0100 slider changes on press commit 59b88ffd7c5502ee50c657feac366226b2bd8900 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:57:13 2024 +0100 slider layout code fixed commit cd65adb4518d8f22d570d83cb3211a57ada35aef Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Tue Nov 26 13:48:55 2024 +0100 QskSkinnable::metric with default value commit ea3d7a5e699bd813d16528fb3b81d69b30f0737d Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 25 09:02:04 2024 +0100 QskInterval::center(), QskInterval::stretch removed as they the implementation is only handling normalized intervals commit 494c370e61bcb418c97426116bffa0bab501c6d4 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 22 17:38:58 2024 +0100 ticks for F2 sliders commit f4c2211f2c196b6662fdc023578e1498805f3377 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Fri Nov 22 17:37:47 2024 +0100 API extended commit 5c1e0ccad485fc81a3fa0b9576333fcefd7bdfdc Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 19:19:53 2024 +0100 invalid constexpr qualifier removed commit 9a5dd886ed2445606dc7887e7d7024a588a967aa Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 17:59:54 2024 +0100 slider ticks - not only for M3 commit d04c0309248b72088d7099cbcd86140739b15885 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 17:59:37 2024 +0100 using constexpr commit d87c8e3d0b4b579aa0a67c173833c4a7ea28af0a Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 21 13:54:01 2024 +0100 API cleanup of the Bounded controls commit 109fc7d7f48420662b5ca9bed548444dce83e055 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 20 14:57:16 2024 +0100 QskBoxClipNode renamed to QskClipNode + more clip options added commit 1e383406e213fc3f129729760da3960b16d2e827 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 20 11:00:17 2024 +0100 M3 specific definitions moved to M3 classes commit 97e3ea6e1f10a804cb1b4c926ff9f3506f20df3b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 18 16:44:06 2024 +0100 Qt5 incompatibility fixed commit 00f2112817e1a07cb37ab3e4e421393716a37fc6 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Mon Nov 18 16:15:50 2024 +0100 QskMaterial3SliderSkinlet introduced commit 9fc7b1f677f2983d304dfedabd6499214f60fc31 Author: Peter Hartmann <peter@edelhirsch.io> Date: Mon Nov 18 12:18:30 2024 +0100 push buttons: Style checked state properly (#477) Resolves #367 commit b5c56f7f8043391d1236eefcf4510d54d9aee4a2 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 10:52:08 2024 +0100 mismatch between allocated and used memory fixed commit d1c2751a8e40e32e1ed45663b3ea42e4621b3960 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 10:51:53 2024 +0100 nullptr check added commit 8dd5a7b249edfa269a048496d9b6577297933fc2 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 08:52:40 2024 +0100 dangling reference fixed commit baaccb2f414b28f647f50c05081418415c6fd295 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 14 07:43:34 2024 +0100 avoid enum bitfields commit 7f389ef6cca50800fadc19c35ae951213989418b Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Wed Nov 13 14:11:11 2024 +0100 don't subtract the slider margins twice commit d84ab6e387163cc2da6c4d3e6a2ab623a324e727 Author: Peter Hartmann <peter@edelhirsch.io> Date: Wed Nov 13 10:00:38 2024 +0100 Update instructions on how to build the website (#470) * Regenerate doxygen file ... and change some things * Add custom stylesheet from Skia * update instructions on how to build the website commit 525ca3bd0e66dc864b5d21e37d8dd7f95cb060f3 Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de> Date: Thu Nov 7 17:31:14 2024 +0100 QskSlider: Adapt to new Material3 style ( ValueLabel a.k.a Tooltip is not done yet )
2024-12-10 13:41:17 +00:00
auto* textField1 = new QskTextField( this );
textField1->setText( "Press and edit Me." );
textField1->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
auto* textField2 = new QskTextField( this );
textField2->setText( "Press and edit Me." );
textField2->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
textField2->setActivationModes( QskTextField::ActivationOnAll );
auto* textField3 = new QskTextField( this );
textField3->setReadOnly( true );
textField3->setText( "Read Only information." );
textField3->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
auto* textField4 = new QskTextField( this );
textField4->setEchoMode( QskTextField::Password );
textField4->setPasswordMaskDelay( 1000 );
textField4->setMaxLength( 8 );
textField4->setText( "12345678" );
textField4->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
2017-07-28 12:47:11 +00:00
}
};
2018-07-31 15:32:25 +00:00
class LocaleListView final : public QskListView
{
2018-06-08 10:54:00 +00:00
Q_OBJECT
2018-08-03 06:15:28 +00:00
public:
LocaleListView( QQuickItem* parentItem = nullptr )
: QskListView( parentItem )
, m_maxWidth( 0.0 )
{
2018-04-06 15:30:24 +00:00
for ( auto language :
{
QLocale::Bulgarian, QLocale::Czech, QLocale::German,
QLocale::Danish, QLocale::English, QLocale::Spanish,
QLocale::Finnish, QLocale::French, QLocale::Hungarian,
QLocale::Italian, QLocale::Japanese, QLocale::Latvian,
QLocale::Lithuanian, QLocale::Dutch, QLocale::Portuguese,
QLocale::Romanian, QLocale::Russian, QLocale::Slovenian,
QLocale::Slovak, QLocale::Turkish, QLocale::Chinese
} )
{
if ( language == QLocale::English )
{
append( QLocale( QLocale::English, QLocale::UnitedStates ) );
append( QLocale( QLocale::English, QLocale::UnitedKingdom ) );
}
else
{
append( QLocale( language ) );
}
}
setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
setPreferredWidth( columnWidth( 0 ) + 20 );
setScrollableSize( QSizeF( columnWidth( 0 ), rowCount() * rowHeight() ) );
2018-06-08 10:54:00 +00:00
connect( this, &QskListView::selectedRowChanged,
[ this ]( int row ) { Q_EMIT selected( localeAt( row ) ); } );
}
2018-07-31 15:32:25 +00:00
int rowCount() const override
{
return m_values.count();
}
2018-07-31 15:32:25 +00:00
int columnCount() const override
{
return 1;
}
2018-07-31 15:32:25 +00:00
qreal columnWidth( int ) const override
{
if ( m_maxWidth == 0.0 )
{
const QFontMetricsF fm( effectiveFont( Text ) );
2017-10-30 11:06:19 +00:00
for ( const auto& entry : m_values )
2020-03-13 12:32:22 +00:00
m_maxWidth = qMax( m_maxWidth, qskHorizontalAdvance( fm, entry.first ) );
const auto padding = paddingHint( Cell );
m_maxWidth += padding.left() + padding.right();
}
return m_maxWidth;
}
2018-07-31 15:32:25 +00:00
qreal rowHeight() const override
{
const QFontMetricsF fm( effectiveFont( Text ) );
const auto padding = paddingHint( Cell );
return fm.height() + padding.top() + padding.bottom();
}
2018-07-31 15:32:25 +00:00
QVariant valueAt( int row, int ) const override
{
2018-08-03 06:15:28 +00:00
return m_values[ row ].first;
}
2018-04-04 18:19:47 +00:00
QLocale localeAt( int row ) const
{
if ( row >= 0 && row < m_values.size() )
2018-08-03 06:15:28 +00:00
return m_values[ row ].second;
2018-04-04 18:19:47 +00:00
return QLocale();
}
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
2018-06-08 10:54:00 +00:00
void selected( const QLocale& );
2018-08-03 06:15:28 +00:00
private:
2018-04-06 15:30:24 +00:00
inline void append( const QLocale& locale )
{
m_values += qMakePair( nativeLocaleString( locale ), locale );
}
QVector< QPair< QString, QLocale > > m_values;
mutable qreal m_maxWidth;
};
2018-06-08 10:54:00 +00:00
class Window : public QskWindow
{
2018-08-03 06:15:28 +00:00
public:
2018-06-08 10:54:00 +00:00
Window()
{
populate();
}
void populate()
{
auto box = new QskLinearBox( Qt::Horizontal );
box->setSpacing( 10 );
box->setPadding( 10 );
box->setPanel( true );
2018-06-08 10:54:00 +00:00
auto listView = new LocaleListView( box );
2018-08-03 06:15:28 +00:00
auto inputBox = new InputBox( box );
2018-06-08 10:54:00 +00:00
/*
Disable Qt::ClickFocus, so that the input panel stays open
when selecting a different locale
*/
listView->setFocusPolicy( Qt::TabFocus );
connect( listView, &LocaleListView::selected,
inputBox, &InputBox::setLocale );
addItem( box );
addItem( new QskFocusIndicator() );
}
};
2017-07-21 16:21:34 +00:00
int main( int argc, char* argv[] )
{
#ifdef ITEM_STATISTICS
QskObjectCounter counter( true );
#endif
qputenv( "QT_IM_MODULE", "skinny" );
2017-07-21 16:21:34 +00:00
QGuiApplication app( argc, argv );
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
2017-07-21 16:21:34 +00:00
2018-04-12 10:03:51 +00:00
#if 1
2018-04-27 11:48:51 +00:00
// We don't want to have the input panel in a top level window.
2017-07-28 12:47:11 +00:00
qskDialog->setPolicy( QskDialog::EmbeddedBox );
#endif
2018-06-12 06:20:48 +00:00
Window window1;
window1.setObjectName( "Window 1" );
window1.setTitle( "Window 1" );
2018-06-12 06:20:48 +00:00
window1.resize( 600, 600 );
window1.show();
2017-07-21 16:21:34 +00:00
#if 1
2018-06-08 10:54:00 +00:00
Window window2;
2018-06-12 06:20:48 +00:00
window2.setObjectName( "Window 2" );
window2.setTitle( "Window 2" );
2018-06-12 06:20:48 +00:00
window2.setX( window1.x() + 100 );
2018-06-08 10:54:00 +00:00
window2.resize( 600, 600 );
window2.show();
#endif
QskInputContext::instance()->setFactory( new InputContextFactory() );
2017-07-21 16:21:34 +00:00
return app.exec();
}
2018-06-08 10:54:00 +00:00
#include "main.moc"