Merge branch 'master' into material-theme
This commit is contained in:
commit
41de0f3933
|
|
@ -7,17 +7,20 @@ on:
|
|||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
name: Linux build
|
||||
|
||||
build-linux-qt5-15:
|
||||
name: Linux Qt 5.15 build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DISPLAY: ":1"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
id: cache-qt-5-15
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
path: ../Qt/5.15.2
|
||||
key: ${{ runner.os }}-QtCache-Qt5
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
|
|
@ -27,7 +30,7 @@ jobs:
|
|||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
|
|
@ -42,18 +45,158 @@ jobs:
|
|||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(nproc)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
echo starting Xvfb
|
||||
Xvfb :1 &
|
||||
sleep 10
|
||||
echo starting iotdashboard
|
||||
./examples/bin/iotdashboard &
|
||||
sleep 10
|
||||
echo taking screenshot
|
||||
import -pause 1 -window root screenshot-linux-qt5-15.jpg
|
||||
echo killing iotdashboard
|
||||
killall iotdashboard
|
||||
echo killing Xvfb
|
||||
killall Xvfb
|
||||
- name: Upload smoke test artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: screenshot-linux-qt5-15.jpg
|
||||
path: screenshot-linux-qt5-15.jpg
|
||||
|
||||
build-windows:
|
||||
name: Windows build
|
||||
|
||||
build-linux-qt-lts:
|
||||
name: Linux Qt 6.2 (LTS) build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DISPLAY: ":1"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-2
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.2.4
|
||||
key: ${{ runner.os }}-QtCache-Qt6-2
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.2.4'
|
||||
host: 'linux'
|
||||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- name: Install needed xkbcommon symlink
|
||||
run: sudo apt-get install libxkbcommon-dev -y
|
||||
- name: Ubuntu and Qt version
|
||||
run: |
|
||||
cat /etc/issue
|
||||
echo number of processors: $(nproc)
|
||||
qmake -v
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(nproc)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
echo starting Xvfb
|
||||
Xvfb :1 &
|
||||
sleep 10
|
||||
echo starting gallery
|
||||
./examples/bin/gallery &
|
||||
sleep 10
|
||||
echo taking screenshot
|
||||
import -pause 1 -window root screenshot-linux-qt6-2.jpg
|
||||
echo killing gallery
|
||||
killall gallery
|
||||
echo killing Xvfb
|
||||
killall Xvfb
|
||||
- name: Upload smoke test artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: screenshot-linux-qt6-2.jpg
|
||||
path: screenshot-linux-qt6-2.jpg
|
||||
|
||||
|
||||
build-linux-qt-current:
|
||||
name: Linux Qt 6.3 (current) build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DISPLAY: ":1"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-3
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.3.0
|
||||
key: ${{ runner.os }}-QtCache-Qt6-3
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.3.0'
|
||||
host: 'linux'
|
||||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-3.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- name: Install needed xkbcommon symlink
|
||||
run: sudo apt-get install libxkbcommon-dev -y
|
||||
- name: Ubuntu and Qt version
|
||||
run: |
|
||||
cat /etc/issue
|
||||
echo number of processors: $(nproc)
|
||||
qmake -v
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(nproc)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
echo starting Xvfb
|
||||
Xvfb :1 &
|
||||
sleep 10
|
||||
echo starting gallery
|
||||
./examples/bin/gallery &
|
||||
sleep 10
|
||||
echo taking screenshot
|
||||
import -pause 1 -window root screenshot-linux-qt6-3.jpg
|
||||
echo killing gallery
|
||||
killall gallery
|
||||
echo killing Xvfb
|
||||
killall Xvfb
|
||||
- name: Upload smoke test artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: screenshot-linux-qt6-3.jpg
|
||||
path: screenshot-linux-qt6-3.jpg
|
||||
|
||||
|
||||
build-windows-qt5-15:
|
||||
name: Windows Qt 5.15 build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
id: cache-qt-5-15
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
path: ../Qt/5.15.2
|
||||
key: ${{ runner.os }}-QtCache-Qt5
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
|
|
@ -64,7 +207,7 @@ jobs:
|
|||
arch: 'win64_msvc2019_64'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
|
|
@ -72,8 +215,10 @@ jobs:
|
|||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Qt version
|
||||
run: qmake -v
|
||||
- name: Windows and Qt version
|
||||
run: |
|
||||
systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List
|
||||
qmake -v
|
||||
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
|
|
@ -83,18 +228,140 @@ jobs:
|
|||
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip
|
||||
unzip jom.zip
|
||||
.\jom
|
||||
- name: Smoke test
|
||||
run: |
|
||||
$Env:PATH += ";lib;plugins\skins"
|
||||
echo "starting iotdashboard"
|
||||
Start-Process .\examples\bin\iotdashboard
|
||||
Start-Sleep -s 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-windows-qt5-15.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: taskkill /IM iotdashboard.exe /T
|
||||
|
||||
build-mac:
|
||||
name: MacOS build
|
||||
|
||||
build-windows-qt-lts:
|
||||
name: Windows Qt 6.2 (LTS) build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-2
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.2.4
|
||||
key: ${{ runner.os }}-QtCache-Qt6-2
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.2.4'
|
||||
host: 'windows'
|
||||
target: 'desktop'
|
||||
arch: 'win64_msvc2019_64'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Windows and Qt version
|
||||
run: |
|
||||
systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List
|
||||
qmake -v
|
||||
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
|
||||
- name: jom
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip
|
||||
unzip jom.zip
|
||||
.\jom
|
||||
- name: Smoke test
|
||||
run: |
|
||||
$Env:PATH += ";lib;plugins\skins"
|
||||
echo "starting gallery"
|
||||
Start-Process .\examples\bin\gallery
|
||||
Start-Sleep -s 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-windows-qt6-2.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: taskkill /IM gallery.exe /T
|
||||
|
||||
|
||||
build-windows-qt-current:
|
||||
name: Windows Qt 6.3 (current) build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-3
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.3.0
|
||||
key: ${{ runner.os }}-QtCache-Qt6-3
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.3.0'
|
||||
host: 'windows'
|
||||
target: 'desktop'
|
||||
arch: 'win64_msvc2019_64'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-3.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Windows and Qt version
|
||||
run: |
|
||||
systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List
|
||||
qmake -v
|
||||
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
|
||||
- name: jom
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip
|
||||
unzip jom.zip
|
||||
.\jom
|
||||
- name: Smoke test
|
||||
run: |
|
||||
$Env:PATH += ";lib;plugins\skins"
|
||||
echo "starting gallery"
|
||||
Start-Process .\examples\bin\gallery
|
||||
Start-Sleep -s 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-windows-qt6-3.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: taskkill /IM gallery.exe /T
|
||||
|
||||
|
||||
build-mac-qt5-15:
|
||||
name: MacOS Qt 5.15 build
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
id: cache-qt-5-15
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
path: ../Qt/5.15.2
|
||||
key: ${{ runner.os }}-QtCache-Qt5
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
|
|
@ -104,7 +371,7 @@ jobs:
|
|||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
|
|
@ -119,3 +386,103 @@ jobs:
|
|||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(sysctl -n hw.ncpu)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
DYLD_LIBRARY_PATH=./lib ./examples/bin/iotdashboard.app/Contents/MacOS/iotdashboard -qwindowgeometry 1024x600+75+100 &
|
||||
sleep 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-macos-qt5-15.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: killall iotdashboard
|
||||
|
||||
|
||||
build-mac-qt-lts:
|
||||
name: MacOS Qt 6.2 (LTS) build
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-2
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.2.4
|
||||
key: ${{ runner.os }}-QtCache-Qt6-2
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.2.4'
|
||||
host: 'mac'
|
||||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- name: MacOS and Qt version
|
||||
run: |
|
||||
sw_vers
|
||||
echo number of processors: $(sysctl -n hw.ncpu)
|
||||
qmake -v
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(sysctl -n hw.ncpu)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 &
|
||||
sleep 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-macos-qt6-2.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: killall gallery
|
||||
|
||||
build-mac-qt-current:
|
||||
name: MacOS Qt 6.3 (current) build
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Qt
|
||||
id: cache-qt-6-3
|
||||
uses: actions/cache@v1 # not v2!
|
||||
with:
|
||||
path: ../Qt/6.3.0
|
||||
key: ${{ runner.os }}-QtCache-Qt6-3
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.3.0'
|
||||
host: 'mac'
|
||||
target: 'desktop'
|
||||
install-deps: 'true'
|
||||
modules: 'qtwebengine'
|
||||
cached: ${{ steps.cache-qt-6-3.outputs.cache-hit }}
|
||||
setup-python: 'true'
|
||||
tools: ''
|
||||
set-env: 'true'
|
||||
tools-only: 'false'
|
||||
|
||||
- name: MacOS and Qt version
|
||||
run: |
|
||||
sw_vers
|
||||
echo number of processors: $(sysctl -n hw.ncpu)
|
||||
qmake -v
|
||||
- name: qmake
|
||||
run: qmake qskinny.pro
|
||||
- name: make
|
||||
run: make -j$(sysctl -n hw.ncpu)
|
||||
- name: Smoke test
|
||||
run: |
|
||||
DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 &
|
||||
sleep 10
|
||||
- uses: OrbitalOwen/desktop-screenshot-action@0.1
|
||||
with:
|
||||
file-name: 'screenshot-macos-qt6-3.jpg'
|
||||
- name: Cleanup smoke test
|
||||
run: killall gallery
|
||||
|
|
|
|||
|
|
@ -13,3 +13,4 @@ qskinny.pro.user
|
|||
*.o
|
||||
*.log
|
||||
html
|
||||
tags
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
#include "Page.h"
|
||||
|
||||
Page::Page( QQuickItem* parent )
|
||||
: Page( Qt::Vertical, parent )
|
||||
{
|
||||
}
|
||||
|
||||
Page::Page( Qt::Orientation orientation, QQuickItem* parent )
|
||||
: QskLinearBox( orientation, parent )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@
|
|||
class Page : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
Page( QQuickItem* parent = nullptr );
|
||||
Page( Qt::Orientation, QQuickItem* parent = nullptr );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,18 +81,18 @@ namespace
|
|||
};
|
||||
|
||||
class CheckButtonBox : public QskLinearBox
|
||||
{
|
||||
{
|
||||
public:
|
||||
CheckButtonBox( QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( Qt::Horizontal, parent )
|
||||
{
|
||||
{
|
||||
setSpacing( 20 );
|
||||
setExtraSpacingAt( Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge );
|
||||
|
||||
for ( auto state : { Qt::Unchecked, Qt::PartiallyChecked, Qt::Checked } )
|
||||
{
|
||||
auto button = new QskCheckBox( this );
|
||||
button->setTristate( true );
|
||||
button->setTristate( true );
|
||||
button->setCheckState( state );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,18 @@ HEADERS += \
|
|||
SOURCES += \
|
||||
button/ButtonPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
textinput/TextInputPage.h
|
||||
|
||||
SOURCES += \
|
||||
textinput/TextInputPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
selector/SelectorPage.h
|
||||
|
||||
SOURCES += \
|
||||
selector/SelectorPage.cpp \
|
||||
|
||||
HEADERS += \
|
||||
Page.h
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include "progressbar/ProgressBarPage.h"
|
||||
#include "slider/SliderPage.h"
|
||||
#include "button/ButtonPage.h"
|
||||
#include "textinput/TextInputPage.h"
|
||||
#include "selector/SelectorPage.h"
|
||||
|
||||
#include <SkinnyShortcut.h>
|
||||
#include <SkinnyShapeProvider.h>
|
||||
|
|
@ -20,6 +22,7 @@
|
|||
#include <QskPushButton.h>
|
||||
#include <QskMenu.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskDialog.h>
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
|
|
@ -32,7 +35,7 @@ namespace
|
|||
: QskTabView( parent )
|
||||
{
|
||||
setMargins( 10 );
|
||||
setTabPosition( Qsk::Left );
|
||||
setTabBarEdge( Qt::LeftEdge );
|
||||
setAutoFitTabs( true );
|
||||
}
|
||||
|
||||
|
|
@ -132,6 +135,8 @@ namespace
|
|||
tabView->addTab( "Buttons", new ButtonPage() );
|
||||
tabView->addTab( "Sliders", new SliderPage() );
|
||||
tabView->addTab( "Progress\nBars", new ProgressBarPage() );
|
||||
tabView->addTab( "Text\nInputs", new TextInputPage() );
|
||||
tabView->addTab( "Selectors", new SelectorPage() );
|
||||
|
||||
connect( header, &Header::enabledToggled,
|
||||
tabView, &TabView::setTabsEnabled );
|
||||
|
|
@ -147,6 +152,9 @@ int main( int argc, char* argv[] )
|
|||
|
||||
Qsk::addGraphicProvider( "shapes", new SkinnyShapeProvider() );
|
||||
|
||||
// dialogs in faked windows -> QskSubWindow
|
||||
QskDialog::instance()->setPolicy( QskDialog::EmbeddedBox );
|
||||
|
||||
QGuiApplication app( argc, argv );
|
||||
|
||||
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SelectorPage.h"
|
||||
#include <QskSegmentedBar.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Box : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
Box( Qt::Orientation orientation, QQuickItem* parent = nullptr )
|
||||
: QskLinearBox( orientation, parent )
|
||||
{
|
||||
setSpacing( 20 );
|
||||
|
||||
orientation = ( orientation == Qt::Horizontal )
|
||||
? Qt::Vertical : Qt::Horizontal;
|
||||
|
||||
{
|
||||
auto bar = new QskSegmentedBar( orientation, this );
|
||||
|
||||
bar->addText( "Option 1" );
|
||||
bar->addText( "Option 2" );
|
||||
bar->addText( "Option 3" );
|
||||
bar->addText( "Option 4" );
|
||||
}
|
||||
|
||||
{
|
||||
const auto prefix = QStringLiteral( "image://shapes/" );
|
||||
|
||||
const char* icons[] =
|
||||
{
|
||||
"rectangle/crimson",
|
||||
"triangleright/thistle",
|
||||
"ellipse/khaki",
|
||||
"ring/sandybrown",
|
||||
"star/darkviolet",
|
||||
"hexagon/darkslategray"
|
||||
};
|
||||
|
||||
auto bar = new QskSegmentedBar( orientation, this );
|
||||
for ( const auto icon : icons )
|
||||
bar->addGraphic( prefix + icon );
|
||||
}
|
||||
|
||||
setExtraSpacingAt( Qt::LeftEdge | Qt::BottomEdge );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SelectorPage::SelectorPage( QQuickItem* parent )
|
||||
: Page( Qt::Horizontal, parent )
|
||||
{
|
||||
populate();
|
||||
}
|
||||
|
||||
void SelectorPage::populate()
|
||||
{
|
||||
setSpacing( 20 );
|
||||
|
||||
new Box( Qt::Horizontal, this );
|
||||
new Box( Qt::Vertical, this );
|
||||
|
||||
setStretchFactor( 0, 0 );
|
||||
setStretchFactor( 1, 10 );
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
class SelectorPage : public Page
|
||||
{
|
||||
public:
|
||||
SelectorPage( QQuickItem* = nullptr );
|
||||
|
||||
private:
|
||||
void populate();
|
||||
};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "TextInputPage.h"
|
||||
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskTextInput.h>
|
||||
|
||||
TextInputPage::TextInputPage( QQuickItem* parent )
|
||||
: Page( parent )
|
||||
{
|
||||
setSpacing( 40 );
|
||||
populate();
|
||||
}
|
||||
|
||||
void TextInputPage::populate()
|
||||
{
|
||||
auto box = new QskLinearBox( Qt::Horizontal, 2, this );
|
||||
box->setExtraSpacingAt( Qt::BottomEdge );
|
||||
|
||||
{
|
||||
new QskTextInput( "Edit Me", box );
|
||||
}
|
||||
|
||||
{
|
||||
auto input = new QskTextInput( "Only Read Me", box );
|
||||
input->setReadOnly( true );
|
||||
}
|
||||
|
||||
{
|
||||
auto input = new QskTextInput( "12345", box );
|
||||
input->setMaxLength( 5 );
|
||||
input->setEchoMode( QskTextInput::PasswordEchoOnEdit );
|
||||
}
|
||||
|
||||
{
|
||||
// once we have QskTextEdit it will be here too.
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
class TextInputPage : public Page
|
||||
{
|
||||
public:
|
||||
TextInputPage( QQuickItem* = nullptr );
|
||||
|
||||
private:
|
||||
void populate();
|
||||
};
|
||||
|
|
@ -20,7 +20,6 @@ class Diagram::PrivateData
|
|||
QVector< QVector< QPointF > > dataPoints;
|
||||
int xGridLines = -1;
|
||||
qreal yMax = -1;
|
||||
Qsk::Position position = Qsk::Bottom;
|
||||
QVector< Types > types;
|
||||
};
|
||||
|
||||
|
|
@ -70,14 +69,4 @@ void Diagram::setXGridLines( int lines )
|
|||
m_data->xGridLines = lines;
|
||||
}
|
||||
|
||||
Qsk::Position Diagram::chartPosition() const
|
||||
{
|
||||
return m_data->position;
|
||||
}
|
||||
|
||||
void Diagram::setChartPosition( Qsk::Position position )
|
||||
{
|
||||
m_data->position = position;
|
||||
}
|
||||
|
||||
#include "moc_Diagram.cpp"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <QskControl.h>
|
||||
#include <QskNamespace.h>
|
||||
|
||||
class Diagram : public QskControl
|
||||
{
|
||||
|
|
@ -40,9 +39,6 @@ class Diagram : public QskControl
|
|||
int xGridLines() const;
|
||||
void setXGridLines( int lines );
|
||||
|
||||
Qsk::Position chartPosition() const;
|
||||
void setChartPosition( Qsk::Position );
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
|
|
|
|||
|
|
@ -92,10 +92,11 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
|
|||
}
|
||||
|
||||
using Q = Diagram;
|
||||
|
||||
const QRectF rect = diagram->subControlRect( Q::Chart );
|
||||
const qreal yMax = diagram->yMax();
|
||||
const Qsk::Position position = diagram->chartPosition();
|
||||
QVector< Diagram::Type > types = { Diagram::Line, Diagram::Area };
|
||||
|
||||
const QVector< Diagram::Type > types = { Diagram::Line, Diagram::Area };
|
||||
|
||||
for( int i = 0; i < diagram->dataPoints().size(); ++i )
|
||||
{
|
||||
|
|
@ -137,7 +138,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
|
|||
const QColor color = ( types.at( j ) == Diagram::Line ) ? diagram->color( lineSubcontrol )
|
||||
: diagram->color( areaSubcontrol );
|
||||
|
||||
dataPointNode->update( rect, nodeType, color, dataPoints, yMax, position, lineWidth );
|
||||
dataPointNode->update( rect, nodeType, color, dataPoints, yMax, false, lineWidth );
|
||||
nodeIndex++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@ DiagramDataNode::DiagramDataNode()
|
|||
|
||||
void DiagramDataNode::update( const QRectF& rect, Type type,
|
||||
const QColor& color, const QVector< QPointF >& dataPoints,
|
||||
const qreal yMax, Qsk::Position position, int lineWidth )
|
||||
const qreal yMax, bool inverted, int lineWidth )
|
||||
{
|
||||
Q_UNUSED( rect );
|
||||
|
||||
if( color != m_color )
|
||||
{
|
||||
m_material.setColor( color );
|
||||
|
|
@ -27,8 +25,8 @@ void DiagramDataNode::update( const QRectF& rect, Type type,
|
|||
markDirty( QSGNode::DirtyMaterial );
|
||||
}
|
||||
|
||||
if( m_rect == rect && m_dataPoints == dataPoints && m_yMax == yMax && m_position == position
|
||||
&& m_type == type && m_lineWidth == lineWidth )
|
||||
if( m_rect == rect && m_dataPoints == dataPoints && m_yMax == yMax
|
||||
&& m_inverted == inverted && m_type == type && m_lineWidth == lineWidth )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -44,7 +42,7 @@ void DiagramDataNode::update( const QRectF& rect, Type type,
|
|||
m_rect = rect;
|
||||
m_dataPoints = dataPoints;
|
||||
m_yMax = yMax;
|
||||
m_position = position;
|
||||
m_inverted = inverted;
|
||||
m_type = type;
|
||||
|
||||
const auto drawingMode =
|
||||
|
|
@ -76,13 +74,13 @@ void DiagramDataNode::update( const QRectF& rect, Type type,
|
|||
{
|
||||
const qreal x = ( ( m_dataPoints.at( i ).x() - xMin ) / ( xMax - xMin ) ) * rect.width();
|
||||
const qreal fraction = ( m_dataPoints.at( i ).y() / yMax ) * rect.height();
|
||||
const qreal y = ( position == Qsk::Top ) ? fraction : rect.height() - fraction;
|
||||
const qreal y = inverted ? fraction : rect.height() - fraction;
|
||||
|
||||
if( m_type == Line && i < m_dataPoints.size() - 1 )
|
||||
{
|
||||
const qreal x2 = ( ( m_dataPoints.at( i + 1 ).x() - xMin ) / ( xMax - xMin ) ) * rect.width();
|
||||
const qreal fraction2 = ( m_dataPoints.at( i + 1 ).y() / yMax ) * rect.height();
|
||||
const qreal y2 = ( position == Qsk::Top ) ? fraction2 : rect.height() - fraction2;
|
||||
const qreal y2 = inverted ? fraction2 : rect.height() - fraction2;
|
||||
vertexData[2 * i].x = x;
|
||||
vertexData[2 * i].y = y;
|
||||
|
||||
|
|
@ -91,7 +89,7 @@ void DiagramDataNode::update( const QRectF& rect, Type type,
|
|||
}
|
||||
else if( m_type == Area )
|
||||
{
|
||||
const qreal y0 = ( position == Qsk::Top ) ? 0 : rect.height();
|
||||
const qreal y0 = inverted ? 0 : rect.height();
|
||||
vertexData[2 * i].x = x;
|
||||
vertexData[2 * i].y = y;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <QskNamespace.h>
|
||||
|
||||
#include <QPolygonF>
|
||||
#include <QSGFlatColorMaterial>
|
||||
#include <QSGGeometryNode>
|
||||
|
|
@ -23,7 +21,7 @@ class DiagramDataNode : public QSGGeometryNode
|
|||
DiagramDataNode();
|
||||
|
||||
void update( const QRectF&, Type, const QColor&,
|
||||
const QVector< QPointF >&, const qreal yMax, Qsk::Position, int lineWidth );
|
||||
const QVector< QPointF >&, const qreal yMax, bool inverted, int lineWidth );
|
||||
|
||||
private:
|
||||
QSGFlatColorMaterial m_material;
|
||||
|
|
@ -34,6 +32,6 @@ class DiagramDataNode : public QSGGeometryNode
|
|||
QColor m_color;
|
||||
QVector< QPointF > m_dataPoints;
|
||||
qreal m_yMax;
|
||||
Qsk::Position m_position;
|
||||
bool m_inverted;
|
||||
int m_lineWidth;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main( int argc, char* argv[] )
|
|||
auto tabView = new QskTabView();
|
||||
|
||||
tabView->setMargins( 10 );
|
||||
tabView->setTabPosition( Qsk::Left );
|
||||
tabView->setTabBarEdge( Qt::LeftEdge );
|
||||
tabView->setAutoFitTabs( true );
|
||||
|
||||
tabView->addTab( "Grid Layout", new GridLayoutPage() );
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ class GraphicLabel : public QskGraphicLabel
|
|||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
m_tabView = new QskTabView( Qsk::Left );
|
||||
m_tabView = new QskTabView();
|
||||
m_tabView->setTabBarEdge( Qt::LeftEdge );
|
||||
|
||||
const QString resourceDir( ":/qvg" );
|
||||
const QStringList icons = QDir( resourceDir ).entryList();
|
||||
|
|
|
|||
|
|
@ -110,13 +110,14 @@ class TabView : public QskTabView
|
|||
|
||||
void rotate()
|
||||
{
|
||||
const Qsk::Position pos[] = { Qsk::Top, Qsk::Right, Qsk::Bottom, Qsk::Left };
|
||||
using namespace Qt;
|
||||
const Edge edges[] = { TopEdge, RightEdge, BottomEdge, LeftEdge };
|
||||
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
if ( tabPosition() == pos[i] )
|
||||
if ( tabBarEdge() == edges[i] )
|
||||
{
|
||||
setTabPosition( pos[ ( i + 1 ) % 4 ] );
|
||||
setTabBarEdge( edges[ ( i + 1 ) % 4 ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,11 +175,14 @@ debug {
|
|||
|
||||
LOCAL_PRI=$$(QSK_LOCAL_PRI)
|
||||
|
||||
if ( exists( $${LOCAL_PRI} ) ) {
|
||||
if ( !isEmpty( LOCAL_PRI ) ) {
|
||||
|
||||
# When not working with the Qt/Creator it is often more convenient
|
||||
# to include the specific options of your local build, than passing
|
||||
# them all on the command line
|
||||
if ( exists( $${LOCAL_PRI} ) ) {
|
||||
|
||||
include( $${LOCAL_PRI} )
|
||||
# When not working with the Qt/Creator it is often more convenient
|
||||
# to include the specific options of your local build, than passing
|
||||
# them all on the command line
|
||||
|
||||
include( $${LOCAL_PRI} )
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ GridQuick::~GridQuick()
|
|||
void GridQuick::insert( const QByteArray& colorName,
|
||||
int row, int column, int rowSpan, int columnSpan )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
/*
|
||||
We need to create a temporary layout in QML, so that the
|
||||
object for the attachedProperties is created early
|
||||
|
|
@ -82,9 +81,6 @@ void GridQuick::insert( const QByteArray& colorName,
|
|||
rectangle->setParent( nullptr );
|
||||
|
||||
delete layout;
|
||||
#else
|
||||
auto rectangle = createQml( "import QtQuick 2.0\nRectangle {}" );
|
||||
#endif
|
||||
|
||||
rectangle->setParent( m_grid );
|
||||
rectangle->setParentItem( m_grid );
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Box : public TestBox
|
|||
|
||||
int count() const
|
||||
{
|
||||
return m_tests.size();
|
||||
return static_cast< int >( m_tests.size() );
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ class QskRgbValueQml
|
|||
public:
|
||||
enum Enum
|
||||
{
|
||||
#define RGB( name, value ) name = value,
|
||||
#define RGBVALUE( name, value ) name = value,
|
||||
QSK_RGB_VALUES
|
||||
#undef RGB
|
||||
#undef RGBVALUE
|
||||
};
|
||||
|
||||
Q_ENUM( Enum )
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <QskPushButton.h>
|
||||
#include <QskProgressBar.h>
|
||||
#include <QskScrollView.h>
|
||||
#include <QskSegmentedBar.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskSubWindow.h>
|
||||
|
|
@ -79,6 +80,7 @@ namespace
|
|||
void setupProgressBar();
|
||||
void setupPushButton();
|
||||
void setupScrollView();
|
||||
void setupSegmentedBar();
|
||||
void setupSeparator();
|
||||
void setupSubWindow();
|
||||
void setupSlider();
|
||||
|
|
@ -112,6 +114,7 @@ void Editor::setup()
|
|||
setupProgressBar();
|
||||
setupPushButton();
|
||||
setupScrollView();
|
||||
setupSegmentedBar();
|
||||
setupSeparator();
|
||||
setupSlider();
|
||||
setupSubWindow();
|
||||
|
|
@ -201,9 +204,9 @@ void Editor::setupMenu()
|
|||
setBoxBorderMetrics( Q::Separator, 0 );
|
||||
setGradient( Q::Separator, m_pal.primary );
|
||||
|
||||
setPadding( Q::Cell, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Cell, 5 );
|
||||
setGradient( Q::Cell, Qt::transparent );
|
||||
setPadding( Q::Segment, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Segment, 5 );
|
||||
setGradient( Q::Segment, Qt::transparent );
|
||||
|
||||
setGradient( Q::Cursor, QskRgb::toTransparentF( m_pal.onBackground, m_pal.focused ) );
|
||||
|
||||
|
|
@ -297,6 +300,64 @@ void Editor::setupFocusIndicator()
|
|||
setGradient( Q::Panel, QskGradient() );
|
||||
}
|
||||
|
||||
void Editor::setupSegmentedBar()
|
||||
{
|
||||
// copied from Squiek: we need something similar to a tab bar here. TODO ...
|
||||
using A = QskAspect;
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
{
|
||||
// Panel
|
||||
|
||||
setPadding( Q::Panel, 0 );
|
||||
setSpacing( Q::Panel, 5 );
|
||||
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker125 );
|
||||
|
||||
const QSize strutSize( qskDpiScaled( 100 ), qskDpiScaled( 50 ) );
|
||||
|
||||
setStrutSize( Q::Panel | A::Horizontal, strutSize );
|
||||
setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() );
|
||||
}
|
||||
|
||||
{
|
||||
// Segment
|
||||
|
||||
setPadding( Q::Segment, QskMargins( 2, 5, 2, 5 ) );
|
||||
setGradient( Q::Segment, QskGradient() );
|
||||
}
|
||||
|
||||
{
|
||||
// Cursor
|
||||
setGradient( Q::Cursor, m_pal.accentColor );
|
||||
setGradient( Q::Cursor | Q::Disabled, QColor( Qt::gray ) );
|
||||
|
||||
setAnimation( Q::Cursor | A::Metric | A::Position, 100 );
|
||||
}
|
||||
|
||||
for( auto subControl : { Q::Panel, Q::Cursor } )
|
||||
setBoxShape( subControl, 3 );
|
||||
|
||||
{
|
||||
// Text
|
||||
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::Text | Q::Selected, m_pal.contrastColor );
|
||||
}
|
||||
|
||||
{
|
||||
// Graphic
|
||||
|
||||
#if 0
|
||||
setGraphicRole( Q::Graphic, ... );
|
||||
setStrutSize( Q::Graphic, ... );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::setupSeparator()
|
||||
{
|
||||
using A = QskAspect;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <QskPushButton.h>
|
||||
#include <QskScrollView.h>
|
||||
#include <QskSeparator.h>
|
||||
#include <QskSegmentedBar.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskSubWindow.h>
|
||||
#include <QskSwitchButton.h>
|
||||
|
|
@ -147,6 +148,7 @@ namespace
|
|||
void setupProgressBar();
|
||||
void setupPushButton();
|
||||
void setupScrollView();
|
||||
void setupSegmentedBar();
|
||||
void setupSeparator();
|
||||
void setupSlider();
|
||||
void setupSubWindow();
|
||||
|
|
@ -267,6 +269,7 @@ void Editor::setup()
|
|||
setupProgressBar();
|
||||
setupPushButton();
|
||||
setupScrollView();
|
||||
setupSegmentedBar();
|
||||
setupSeparator();
|
||||
setupSlider();
|
||||
setupSubWindow();
|
||||
|
|
@ -346,9 +349,9 @@ void Editor::setupMenu()
|
|||
setMetric( Q::Separator | A::Size, qskDpiScaled( 2 ) );
|
||||
setSeparator( Q::Separator | A::Horizontal );
|
||||
|
||||
setPadding( Q::Cell, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Cell, 5 );
|
||||
setGradient( Q::Cell, Qt::transparent );
|
||||
setPadding( Q::Segment, QskMargins( 2, 10, 2, 10 ) );
|
||||
setSpacing( Q::Segment, 5 );
|
||||
setGradient( Q::Segment, Qt::transparent );
|
||||
|
||||
setGradient( Q::Cursor, m_pal.highlighted );
|
||||
|
||||
|
|
@ -465,6 +468,76 @@ void Editor::setupSeparator()
|
|||
setSeparator( Q::Panel | A::Vertical );
|
||||
}
|
||||
|
||||
void Editor::setupSegmentedBar()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
{
|
||||
// Panel
|
||||
|
||||
setPadding( Q::Panel, 0 );
|
||||
setSpacing( Q::Panel, 5 );
|
||||
|
||||
setGradient( Q::Panel, m_pal.base );
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
|
||||
const auto c = m_pal.base;
|
||||
|
||||
const QskBoxBorderColors borderColors(
|
||||
c.darker( 170 ), c.darker( 170 ),
|
||||
c.darker( 105 ), c.darker( 105 ) );
|
||||
|
||||
setBoxBorderColors( Q::Panel, borderColors );
|
||||
|
||||
const QSize strutSize( qskDpiScaled( 100 ), qskDpiScaled( 50 ) );
|
||||
|
||||
setStrutSize( Q::Panel | A::Horizontal, strutSize );
|
||||
setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() );
|
||||
}
|
||||
|
||||
{
|
||||
// Segment
|
||||
|
||||
setPadding( Q::Segment, QskMargins( 2, 5, 2, 5 ) );
|
||||
setGradient( Q::Segment, QskGradient() );
|
||||
}
|
||||
|
||||
{
|
||||
// Cursor
|
||||
setGradient( Q::Cursor, m_pal.highlighted );
|
||||
setBoxBorderColors( Q::Cursor, QColor( m_pal.highlighted ).darker( 120 ) );
|
||||
|
||||
setGradient( Q::Cursor | Q::Disabled, QColor( Qt::gray ).darker( 110 ) );
|
||||
setBoxBorderColors( Q::Cursor | Q::Disabled, Qt::gray );
|
||||
|
||||
setAnimation( Q::Cursor | A::Metric | A::Position, 100 );
|
||||
}
|
||||
|
||||
for( auto subControl : { Q::Panel, Q::Cursor } )
|
||||
setBoxShape( subControl, 3 );
|
||||
|
||||
{
|
||||
// Text
|
||||
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
||||
|
||||
for( auto state : { A::NoState, Q::Selected } )
|
||||
setColor( Q::Text | state | Q::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
{
|
||||
// Graphic
|
||||
|
||||
#if 0
|
||||
setGraphicRole( Q::Graphic, ... );
|
||||
setStrutSize( Q::Graphic, ... );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::setupPageIndicator()
|
||||
{
|
||||
using Q = QskPageIndicator;
|
||||
|
|
|
|||
|
|
@ -353,11 +353,6 @@ QskAspect::State QskAspect::topState() const noexcept
|
|||
if ( m_bits.states == NoState )
|
||||
return NoState;
|
||||
|
||||
/*
|
||||
Before Qt 5.8 qCountLeadingZeroBits does not use
|
||||
_BitScanReverse - we can live with this.
|
||||
*/
|
||||
|
||||
const auto n = qCountLeadingZeroBits( static_cast< quint16 >( m_bits.states ) );
|
||||
return static_cast< QskAspect::State >( 1 << ( 15 - n ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,40 +26,20 @@ static void qskRegisterBoxBorderColors()
|
|||
|
||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterBoxBorderColors )
|
||||
|
||||
static inline void qskSetGradients( const QskGradient& gradient, QskGradient* gradients )
|
||||
{
|
||||
gradients[ 0 ] = gradients[ 1 ] = gradients[ 2 ] = gradients[ 3 ] = gradient;
|
||||
}
|
||||
|
||||
static inline void qskSetGradients(
|
||||
const QskGradient& left, const QskGradient& top,
|
||||
const QskGradient& right, const QskGradient& bottom, QskGradient* gradients )
|
||||
{
|
||||
gradients[ Qsk::Left ] = left;
|
||||
gradients[ Qsk::Top ] = top;
|
||||
gradients[ Qsk::Right ] = right;
|
||||
gradients[ Qsk::Bottom ] = bottom;
|
||||
}
|
||||
|
||||
QskBoxBorderColors::QskBoxBorderColors()
|
||||
{
|
||||
}
|
||||
|
||||
QskBoxBorderColors::QskBoxBorderColors(
|
||||
const QskGradient& left, const QskGradient& top,
|
||||
const QskGradient& right, const QskGradient& bottom )
|
||||
const QskGradient& left, const QskGradient& top,
|
||||
const QskGradient& right, const QskGradient& bottom )
|
||||
: m_gradients { top, left, right, bottom }
|
||||
{
|
||||
qskSetGradients( left, top, right, bottom, m_gradients );
|
||||
}
|
||||
|
||||
QskBoxBorderColors::QskBoxBorderColors( const QColor& color )
|
||||
{
|
||||
qskSetGradients( color, m_gradients );
|
||||
}
|
||||
|
||||
QskBoxBorderColors::QskBoxBorderColors( const QskGradient& gradient )
|
||||
: m_gradients { gradient, gradient, gradient, gradient }
|
||||
{
|
||||
qskSetGradients( gradient, m_gradients );
|
||||
}
|
||||
|
||||
QskBoxBorderColors::~QskBoxBorderColors()
|
||||
|
|
@ -85,53 +65,51 @@ void QskBoxBorderColors::setAlpha( int alpha )
|
|||
|
||||
void QskBoxBorderColors::setGradients( const QskGradient& gradient )
|
||||
{
|
||||
qskSetGradients( gradient, m_gradients );
|
||||
m_gradients[ 0 ] = m_gradients[ 1 ] = m_gradients[ 2 ] = m_gradients[ 3 ] = gradient;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setGradients( const QskGradient& left, const QskGradient& top,
|
||||
const QskGradient& right, const QskGradient& bottom )
|
||||
{
|
||||
qskSetGradients( left, top, right, bottom, m_gradients );
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setGradient( Qsk::Position position, const QskGradient& gradient )
|
||||
{
|
||||
m_gradients[ position ] = gradient;
|
||||
m_gradients[ Top ] = top;
|
||||
m_gradients[ Left ] = left;
|
||||
m_gradients[ Right ] = right;
|
||||
m_gradients[ Bottom ] = bottom;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setGradientAt( Qt::Edges edges, const QskGradient& gradient )
|
||||
{
|
||||
if ( edges & Qt::TopEdge )
|
||||
m_gradients[ Qsk::Top ] = gradient;
|
||||
m_gradients[ Top ] = gradient;
|
||||
|
||||
if ( edges & Qt::LeftEdge )
|
||||
m_gradients[ Qsk::Left ] = gradient;
|
||||
m_gradients[ Left ] = gradient;
|
||||
|
||||
if ( edges & Qt::RightEdge )
|
||||
m_gradients[ Qsk::Right ] = gradient;
|
||||
m_gradients[ Right ] = gradient;
|
||||
|
||||
if ( edges & Qt::BottomEdge )
|
||||
m_gradients[ Qsk::Bottom ] = gradient;
|
||||
m_gradients[ Bottom ] = gradient;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setLeft( const QskGradient& gradient )
|
||||
{
|
||||
m_gradients[ Qsk::Left ] = gradient;
|
||||
m_gradients[ Left ] = gradient;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setTop( const QskGradient& gradient )
|
||||
{
|
||||
m_gradients[ Qsk::Top ] = gradient;
|
||||
m_gradients[ Top ] = gradient;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setRight( const QskGradient& gradient )
|
||||
{
|
||||
m_gradients[ Qsk::Right ] = gradient;
|
||||
m_gradients[ Right ] = gradient;
|
||||
}
|
||||
|
||||
void QskBoxBorderColors::setBottom( const QskGradient& gradient )
|
||||
{
|
||||
m_gradients[ Qsk::Bottom ] = gradient;
|
||||
m_gradients[ Bottom ] = gradient;
|
||||
}
|
||||
|
||||
const QskGradient& QskBoxBorderColors::gradientAt( Qt::Edge edge ) const
|
||||
|
|
@ -139,16 +117,16 @@ const QskGradient& QskBoxBorderColors::gradientAt( Qt::Edge edge ) const
|
|||
switch ( edge )
|
||||
{
|
||||
case Qt::TopEdge:
|
||||
return m_gradients[ Qsk::Top ];
|
||||
return m_gradients[ Top ];
|
||||
|
||||
case Qt::LeftEdge:
|
||||
return m_gradients[ Qsk::Left ];
|
||||
return m_gradients[ Left ];
|
||||
|
||||
case Qt::RightEdge:
|
||||
return m_gradients[ Qsk::Right ];
|
||||
return m_gradients[ Right ];
|
||||
|
||||
case Qt::BottomEdge:
|
||||
return m_gradients[ Qsk::Bottom ];
|
||||
return m_gradients[ Bottom ];
|
||||
}
|
||||
|
||||
static QskGradient noGradient;
|
||||
|
|
@ -254,20 +232,22 @@ QDebug operator<<( QDebug debug, const QskBoxBorderColors& colors )
|
|||
|
||||
if ( colors.isMonochrome() )
|
||||
{
|
||||
const auto& gradient = colors.gradient( Qsk::Left );
|
||||
const auto& gradient = colors.gradientAt( Qt::LeftEdge );
|
||||
QskRgb::debugColor( debug, gradient.startColor() );
|
||||
}
|
||||
else
|
||||
{
|
||||
const char prompts[] = { 'L', 'T', 'R', 'B' };
|
||||
using namespace Qt;
|
||||
|
||||
for ( int i = 0; i <= Qsk::Bottom; i++ )
|
||||
const char prompts[] = { 'L', 'T', 'R', 'B' };
|
||||
const Edge edges[] = { LeftEdge, TopEdge, RightEdge, BottomEdge };
|
||||
|
||||
for ( int i = 0; i <= 4; i++ )
|
||||
{
|
||||
if ( i != 0 )
|
||||
debug << ", ";
|
||||
|
||||
const auto& gradient = colors.gradient(
|
||||
static_cast< Qsk::Position >( i ) );
|
||||
const auto& gradient = colors.gradientAt( edges[i] );
|
||||
|
||||
debug << prompts[ i ] << ": ";
|
||||
|
||||
|
|
@ -285,3 +265,5 @@ QDebug operator<<( QDebug debug, const QskBoxBorderColors& colors )
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include "moc_QskBoxBorderColors.cpp"
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@ class QSK_EXPORT QskBoxBorderColors
|
|||
void setGradients( const QskGradient& left, const QskGradient& top,
|
||||
const QskGradient& right, const QskGradient& bottom );
|
||||
|
||||
void setGradient( Qsk::Position, const QskGradient& );
|
||||
const QskGradient& gradient( Qsk::Position ) const;
|
||||
|
||||
void setGradientAt( Qt::Edges, const QskGradient& );
|
||||
const QskGradient& gradientAt( Qt::Edge ) const;
|
||||
|
||||
|
|
@ -73,16 +70,29 @@ class QSK_EXPORT QskBoxBorderColors
|
|||
bool isValid() const;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
// in order of Qt::Edge
|
||||
Top = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Bottom = 3
|
||||
};
|
||||
QskGradient m_gradients[ 4 ];
|
||||
};
|
||||
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( Qt::GlobalColor color )
|
||||
: QskBoxBorderColors( QColor( color ) )
|
||||
: QskBoxBorderColors( QskGradient( QColor( color ) ) )
|
||||
{
|
||||
}
|
||||
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( QRgb rgb )
|
||||
: QskBoxBorderColors( QColor::fromRgba( rgb ) )
|
||||
: QskBoxBorderColors( QskGradient( QColor::fromRgba( rgb ) ) )
|
||||
{
|
||||
}
|
||||
|
||||
inline QskBoxBorderColors::QskBoxBorderColors( const QColor& color )
|
||||
: QskBoxBorderColors( QskGradient( color ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -91,29 +101,24 @@ inline bool QskBoxBorderColors::operator!=( const QskBoxBorderColors& other ) co
|
|||
return !( *this == other );
|
||||
}
|
||||
|
||||
inline const QskGradient& QskBoxBorderColors::gradient( Qsk::Position position ) const
|
||||
{
|
||||
return m_gradients[ position ];
|
||||
}
|
||||
|
||||
inline const QskGradient& QskBoxBorderColors::left() const
|
||||
{
|
||||
return m_gradients[ Qsk::Left ];
|
||||
return m_gradients[ Left ];
|
||||
}
|
||||
|
||||
inline const QskGradient& QskBoxBorderColors::top() const
|
||||
{
|
||||
return m_gradients[ Qsk::Top ];
|
||||
return m_gradients[ Top ];
|
||||
}
|
||||
|
||||
inline const QskGradient& QskBoxBorderColors::right() const
|
||||
{
|
||||
return m_gradients[ Qsk::Right ];
|
||||
return m_gradients[ Right ];
|
||||
}
|
||||
|
||||
inline const QskGradient& QskBoxBorderColors::bottom() const
|
||||
{
|
||||
return m_gradients[ Qsk::Bottom ];
|
||||
return m_gradients[ Bottom ];
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ class QSK_EXPORT QskBoxBorderMetrics
|
|||
Q_PROPERTY( QskMargins widths READ widths WRITE setWidths )
|
||||
Q_PROPERTY( Qt::SizeMode sizeMode READ sizeMode WRITE setSizeMode )
|
||||
|
||||
Q_PROPERTY( qreal left READ left WRITE setLeft )
|
||||
Q_PROPERTY( qreal top READ top WRITE setTop )
|
||||
Q_PROPERTY( qreal right READ right WRITE setRight )
|
||||
Q_PROPERTY( qreal bottom READ bottom WRITE setBottom )
|
||||
|
||||
public:
|
||||
constexpr QskBoxBorderMetrics() noexcept;
|
||||
|
||||
|
|
@ -47,6 +52,16 @@ class QSK_EXPORT QskBoxBorderMetrics
|
|||
void setWidths( const QskMargins& ) noexcept;
|
||||
constexpr const QskMargins& widths() const noexcept;
|
||||
|
||||
constexpr qreal left() const noexcept;
|
||||
constexpr qreal top() const noexcept;
|
||||
constexpr qreal right() const noexcept;
|
||||
constexpr qreal bottom() const noexcept;
|
||||
|
||||
void setLeft( qreal ) noexcept;
|
||||
void setTop( qreal ) noexcept;
|
||||
void setRight( qreal ) noexcept;
|
||||
void setBottom( qreal ) noexcept;
|
||||
|
||||
void setSizeMode( Qt::SizeMode ) noexcept;
|
||||
constexpr Qt::SizeMode sizeMode() const noexcept;
|
||||
|
||||
|
|
@ -132,6 +147,46 @@ inline qreal QskBoxBorderMetrics::widthAt( Qt::Edge edge ) const noexcept
|
|||
return m_widths.marginAt( edge );
|
||||
}
|
||||
|
||||
inline constexpr qreal QskBoxBorderMetrics::left() const noexcept
|
||||
{
|
||||
return m_widths.left();
|
||||
}
|
||||
|
||||
inline constexpr qreal QskBoxBorderMetrics::top() const noexcept
|
||||
{
|
||||
return m_widths.top();
|
||||
}
|
||||
|
||||
inline constexpr qreal QskBoxBorderMetrics::right() const noexcept
|
||||
{
|
||||
return m_widths.right();
|
||||
}
|
||||
|
||||
inline constexpr qreal QskBoxBorderMetrics::bottom() const noexcept
|
||||
{
|
||||
return m_widths.bottom();
|
||||
}
|
||||
|
||||
inline void QskBoxBorderMetrics::setLeft( qreal left ) noexcept
|
||||
{
|
||||
return m_widths.setLeft( left );
|
||||
}
|
||||
|
||||
inline void QskBoxBorderMetrics::setTop( qreal top ) noexcept
|
||||
{
|
||||
return m_widths.setTop( top );
|
||||
}
|
||||
|
||||
inline void QskBoxBorderMetrics::setRight( qreal right ) noexcept
|
||||
{
|
||||
return m_widths.setRight( right );
|
||||
}
|
||||
|
||||
inline void QskBoxBorderMetrics::setBottom( qreal bottom ) noexcept
|
||||
{
|
||||
return m_widths.setBottom( bottom );
|
||||
}
|
||||
|
||||
inline constexpr Qt::SizeMode QskBoxBorderMetrics::sizeMode() const noexcept
|
||||
{
|
||||
return m_sizeMode;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
#include <qcompilerdetection.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 )
|
||||
static_assert( false, "QSkinny requires Qt >= 5.15" );
|
||||
#endif
|
||||
|
||||
// QSK_VERSION is (major << 16) + (minor << 8) + patch.
|
||||
|
||||
#define QSK_VERSION 0x000001
|
||||
|
|
|
|||
|
|
@ -14,23 +14,12 @@ QSK_QT_PRIVATE_BEGIN
|
|||
#include <private/qobject_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
static inline void qskInvokeFunctionQueued( QObject* object,
|
||||
QskMetaFunction::FunctionCall* functionCall, int argc, int* types, void* argv[],
|
||||
QSemaphore* semaphore = nullptr )
|
||||
static inline void qskInvokeFunctionQueued(
|
||||
QObject* object, QskMetaFunction::FunctionCall* functionCall,
|
||||
void* argv[], QSemaphore* semaphore )
|
||||
{
|
||||
constexpr QObject* sender = nullptr;
|
||||
constexpr int signalId = 0;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
Q_UNUSED( types )
|
||||
Q_UNUSED( argc )
|
||||
|
||||
auto event = new QMetaCallEvent(
|
||||
functionCall, sender, signalId, argv, semaphore );
|
||||
#else
|
||||
auto event = new QMetaCallEvent(
|
||||
functionCall, sender, signalId, argc, types, argv, semaphore );
|
||||
#endif
|
||||
functionCall, nullptr, 0, argv, semaphore );
|
||||
|
||||
QCoreApplication::postEvent( object, event );
|
||||
}
|
||||
|
|
@ -231,8 +220,7 @@ void QskMetaFunction::invoke( QObject* object,
|
|||
|
||||
QSemaphore semaphore;
|
||||
|
||||
qskInvokeFunctionQueued( receiver,
|
||||
m_functionCall, 0, nullptr, argv, &semaphore );
|
||||
qskInvokeFunctionQueued( receiver, m_functionCall, argv, &semaphore );
|
||||
|
||||
semaphore.acquire();
|
||||
|
||||
|
|
@ -247,18 +235,11 @@ void QskMetaFunction::invoke( QObject* object,
|
|||
|
||||
const auto argc = parameterCount() + 1; // return value + arguments
|
||||
|
||||
auto types = static_cast< int* >( std::malloc( argc * sizeof( int ) ) );
|
||||
auto arguments = static_cast< void** >( std::malloc( argc * sizeof( void* ) ) );
|
||||
|
||||
if ( types == nullptr || arguments == nullptr )
|
||||
{
|
||||
std::free( types );
|
||||
std::free( arguments );
|
||||
|
||||
if ( arguments == nullptr )
|
||||
return;
|
||||
}
|
||||
|
||||
types[ 0 ] = QMetaType::UnknownType;
|
||||
arguments[ 0 ] = nullptr;
|
||||
|
||||
const int* parameterTypes = m_functionCall->parameterTypes();
|
||||
|
|
@ -271,26 +252,24 @@ void QskMetaFunction::invoke( QObject* object,
|
|||
break;
|
||||
}
|
||||
|
||||
types[ i ] = parameterTypes[ i - 1 ];
|
||||
const auto type = parameterTypes[ i - 1 ];
|
||||
|
||||
arguments[ i ] =
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
QMetaType( types[ i ] ).create( argv[ i ] );
|
||||
QMetaType( type ).create( argv[ i ] );
|
||||
#else
|
||||
QMetaType::create( types[ i ], argv[ i ] );
|
||||
QMetaType::create( type, argv[ i ] );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( receiver.isNull() )
|
||||
{
|
||||
// object might have died in the meantime
|
||||
std::free( types );
|
||||
std::free( arguments );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
qskInvokeFunctionQueued( object, m_functionCall, argc, types, arguments );
|
||||
qskInvokeFunctionQueued( object, m_functionCall, arguments, nullptr );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,19 +62,12 @@ namespace
|
|||
public:
|
||||
MetaCallEvent(
|
||||
QMetaObject::Call call, CallFunction callFunction, ushort offset,
|
||||
ushort index, int nargs, int* types, void* args[],
|
||||
QSemaphore* semaphore = nullptr )
|
||||
: QMetaCallEvent( offset, index, callFunction, nullptr, -1,
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
||||
nargs, types,
|
||||
#endif
|
||||
args, semaphore )
|
||||
ushort index, void* args[], QSemaphore* semaphore )
|
||||
: QMetaCallEvent( offset, index, callFunction, nullptr, -1, args, semaphore )
|
||||
, m_call( call )
|
||||
, m_callFunction( callFunction )
|
||||
, m_index( index )
|
||||
{
|
||||
Q_UNUSED( nargs )
|
||||
Q_UNUSED( types )
|
||||
}
|
||||
|
||||
void placeMetaCall( QObject* object ) override
|
||||
|
|
@ -93,13 +86,12 @@ namespace
|
|||
|
||||
static inline void qskInvokeMetaCallQueued(
|
||||
QObject* object, QMetaObject::Call call, ushort offset,
|
||||
ushort index, int nargs, int* types, void* args[],
|
||||
QSemaphore* semaphore = nullptr )
|
||||
ushort index, void* args[], QSemaphore* semaphore )
|
||||
{
|
||||
const auto callFunction = object->metaObject()->d.static_metacall;
|
||||
|
||||
auto event = new MetaCallEvent( call, callFunction,
|
||||
offset, index, nargs, types, args, semaphore );
|
||||
offset, index, args, semaphore );
|
||||
|
||||
QCoreApplication::postEvent( object, event );
|
||||
}
|
||||
|
|
@ -205,7 +197,7 @@ static void qskInvokeMetaCall(
|
|||
QSemaphore semaphore;
|
||||
|
||||
qskInvokeMetaCallQueued( receiver, call,
|
||||
offset, index, 0, nullptr, argv, &semaphore );
|
||||
offset, index, argv, &semaphore );
|
||||
|
||||
semaphore.acquire();
|
||||
|
||||
|
|
@ -216,9 +208,7 @@ static void qskInvokeMetaCall(
|
|||
if ( receiver == nullptr )
|
||||
return;
|
||||
|
||||
int* types = nullptr;
|
||||
void** arguments = nullptr;
|
||||
int argc = 0;
|
||||
|
||||
if ( call == QMetaObject::InvokeMetaMethod )
|
||||
{
|
||||
|
|
@ -226,9 +216,8 @@ static void qskInvokeMetaCall(
|
|||
// should be doable without QMetaMethod. TODO ...
|
||||
const auto method = metaObject->method( offset + index );
|
||||
#endif
|
||||
argc = method.parameterCount() + 1;
|
||||
const int argc = method.parameterCount() + 1;
|
||||
|
||||
types = static_cast< int* >( malloc( argc * sizeof( int ) ) );
|
||||
arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) );
|
||||
|
||||
/*
|
||||
|
|
@ -236,7 +225,6 @@ static void qskInvokeMetaCall(
|
|||
invalid for Queued Connections.
|
||||
*/
|
||||
|
||||
types[ 0 ] = QMetaType::UnknownType;
|
||||
arguments[ 0 ] = nullptr;
|
||||
|
||||
for ( int i = 1; i < argc; i++ )
|
||||
|
|
@ -248,8 +236,8 @@ static void qskInvokeMetaCall(
|
|||
break;
|
||||
}
|
||||
|
||||
types[ i ] = method.parameterType( i - 1 );
|
||||
arguments[ i ] = qskMetaTypeCreate( types[ i ], argv[ i ] );
|
||||
const auto type = method.parameterType( i - 1 );
|
||||
arguments[ i ] = qskMetaTypeCreate( type, argv[ i ] );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -257,26 +245,18 @@ static void qskInvokeMetaCall(
|
|||
// should be doable without QMetaMethod. TODO ...
|
||||
const auto property = metaObject->property( offset + index );
|
||||
|
||||
argc = 1;
|
||||
|
||||
types = static_cast< int* >( malloc( argc * sizeof( int ) ) );
|
||||
arguments = static_cast< void** >( malloc( argc * sizeof( void* ) ) );
|
||||
|
||||
types[ 0 ] = property.userType();
|
||||
arguments[ 0 ] = qskMetaTypeCreate( types[ 0 ], argv[ 0 ] );
|
||||
arguments = static_cast< void** >( malloc( 1 * sizeof( void* ) ) );
|
||||
arguments[ 0 ] = qskMetaTypeCreate( property.userType(), argv[ 0 ] );
|
||||
}
|
||||
|
||||
if ( receiver.isNull() )
|
||||
{
|
||||
// object might have died in the meantime
|
||||
free( types );
|
||||
free( arguments );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
qskInvokeMetaCallQueued( object, call,
|
||||
offset, index, argc, types, arguments );
|
||||
qskInvokeMetaCallQueued( object, call, offset, index, arguments, nullptr );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,6 @@ namespace Qsk
|
|||
};
|
||||
Q_ENUM_NS( Direction )
|
||||
|
||||
enum Position
|
||||
{
|
||||
Top,
|
||||
Left,
|
||||
Right,
|
||||
Bottom
|
||||
};
|
||||
Q_ENUM_NS( Position )
|
||||
|
||||
enum TextStyle
|
||||
{
|
||||
Normal,
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ class QskPlacementPolicy
|
|||
constexpr Policy hiddenPolicy() const noexcept;
|
||||
|
||||
private:
|
||||
Policy m_visiblePolicy : 2;
|
||||
Policy m_hiddenPolicy : 2;
|
||||
Policy m_visiblePolicy : 3;
|
||||
Policy m_hiddenPolicy : 3;
|
||||
};
|
||||
|
||||
inline constexpr QskPlacementPolicy::QskPlacementPolicy() noexcept
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ static inline QColor qskInterpolatedColor(
|
|||
|
||||
return QColor::fromHsl( h, s, l, a );
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
case QColor::ExtendedRgb:
|
||||
{
|
||||
const qreal r = valueF( c1.redF(), c2.redF(), ratio );
|
||||
|
|
@ -70,7 +69,6 @@ static inline QColor qskInterpolatedColor(
|
|||
|
||||
return QColor::fromRgbF( r, g, b, a );
|
||||
}
|
||||
#endif
|
||||
case QColor::Invalid:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,435 +11,435 @@
|
|||
|
||||
#define QSK_RGB_VALUES \
|
||||
/* Web colors */ \
|
||||
RGB( AliceBlue, 0xfff0f8ff ) \
|
||||
RGB( AntiqueWhite, 0xfffaebd7 ) \
|
||||
RGB( Aqua, 0xff00ffff ) \
|
||||
RGB( Aquamarine, 0xff7fffd4 ) \
|
||||
RGB( Azure, 0xfff0ffff ) \
|
||||
RGB( Beige, 0xfff5f5dc ) \
|
||||
RGB( Bisque, 0xffffe4c4 ) \
|
||||
RGB( Black, 0xff000000 ) \
|
||||
RGB( BlanchedAlmond, 0xffffebcd ) \
|
||||
RGB( Blue, 0xff0000ff ) \
|
||||
RGB( BlueViolet, 0xff8a2be2 ) \
|
||||
RGB( Brown, 0xffa52a2a ) \
|
||||
RGB( Burlywood, 0xffdeb887 ) \
|
||||
RGB( CadetBlue, 0xff5f9ea0 ) \
|
||||
RGB( Chartreuse, 0xff7fff00 ) \
|
||||
RGB( Chocolate, 0xffd2691e ) \
|
||||
RGB( Coral, 0xffff7f50 ) \
|
||||
RGB( CornflowerBlue, 0xff6495ed ) \
|
||||
RGB( Cornsilk, 0xfffff8dc ) \
|
||||
RGB( Crimson, 0xffdc143c ) \
|
||||
RGB( Cyan, 0xff00ffff ) \
|
||||
RGB( DarkBlue, 0xff00008b ) \
|
||||
RGB( DarkCyan, 0xff008b8b ) \
|
||||
RGB( DarkGoldenrod, 0xffb8860b ) \
|
||||
RGB( DarkGray, 0xffa9a9a9 ) \
|
||||
RGB( DarkGreen, 0xff006400 ) \
|
||||
RGB( DarkGrey, 0xffa9a9a9 ) \
|
||||
RGB( DarkKhaki, 0xffbdb76b ) \
|
||||
RGB( DarkMagenta, 0xff8b008b ) \
|
||||
RGB( DarkOliveGreen, 0xff556b2f ) \
|
||||
RGB( DarkOrange, 0xffff8c00 ) \
|
||||
RGB( DarkOrchid, 0xff9932cc ) \
|
||||
RGB( DarkRed, 0xff8b0000 ) \
|
||||
RGB( DarkSalmon, 0xffe9967a ) \
|
||||
RGB( DarkSeaGreen, 0xff8fbc8f ) \
|
||||
RGB( DarkSlateBlue, 0xff483d8b ) \
|
||||
RGB( DarkSlateGray, 0xff2f4f4f ) \
|
||||
RGB( DarkSlateGrey, 0xff2f4f4f ) \
|
||||
RGB( DarkTurquoise, 0xff00ced1 ) \
|
||||
RGB( DarkViolet, 0xff9400d3 ) \
|
||||
RGB( DeepPink, 0xffff1493 ) \
|
||||
RGB( DeepSkyBlue, 0xff00bfff ) \
|
||||
RGB( DimGray, 0xff696969 ) \
|
||||
RGB( DimGrey, 0xff696969 ) \
|
||||
RGB( DodgerBlue, 0xff1e90ff ) \
|
||||
RGB( FireBrick, 0xffb22222 ) \
|
||||
RGB( FloralWhite, 0xfffffaf0 ) \
|
||||
RGB( ForestGreen, 0xff228b22 ) \
|
||||
RGB( Fuchsia, 0xffff00ff ) \
|
||||
RGB( Gainsboro, 0xffdcdcdc ) \
|
||||
RGB( GhostWhite, 0xfff8f8ff ) \
|
||||
RGB( Gold, 0xffffd700 ) \
|
||||
RGB( Goldenrod, 0xffdaa520 ) \
|
||||
RGB( Gray, 0xff808080 ) \
|
||||
RGB( Green, 0xff008000 ) \
|
||||
RGB( GreenYellow, 0xffadff2f ) \
|
||||
RGB( Grey, 0xff808080 ) \
|
||||
RGB( Honeydew, 0xfff0fff0 ) \
|
||||
RGB( HotPink, 0xffff69b4 ) \
|
||||
RGB( IndianRed, 0xffcd5c5c ) \
|
||||
RGB( Indigo, 0xff4b0082 ) \
|
||||
RGB( Ivory, 0xfffffff0 ) \
|
||||
RGB( Khaki, 0xfff0e68c ) \
|
||||
RGB( Lavender, 0xffe6e6fa ) \
|
||||
RGB( LavenderBlush, 0xfffff0f5 ) \
|
||||
RGB( LawnGreen, 0xff7cfc00 ) \
|
||||
RGB( LemonChiffon, 0xfffffacd ) \
|
||||
RGB( LightBlue, 0xffadd8e6 ) \
|
||||
RGB( LightCoral, 0xfff08080 ) \
|
||||
RGB( LightCyan, 0xffe0ffff ) \
|
||||
RGB( LightGoldenrodYellow, 0xfffafad2 ) \
|
||||
RGB( LightGray, 0xffd3d3d3 ) \
|
||||
RGB( LightGreen, 0xff90ee90 ) \
|
||||
RGB( LightGrey, 0xffd3d3d3 ) \
|
||||
RGB( LightPink, 0xffffb6c1 ) \
|
||||
RGB( LightSalmon, 0xffffa07a ) \
|
||||
RGB( LightSeaGreen, 0xff20b2aa ) \
|
||||
RGB( LightSkyBlue, 0xff87cefa ) \
|
||||
RGB( LightSlateGray, 0xff778899 ) \
|
||||
RGB( LightSlateGrey, 0xff778899 ) \
|
||||
RGB( LightSteelBlue, 0xffb0c4de ) \
|
||||
RGB( LightYellow, 0xffffffe0 ) \
|
||||
RGB( Lime, 0xff00ff00 ) \
|
||||
RGB( Limegreen, 0xff32cd32 ) \
|
||||
RGB( Linen, 0xfffaf0e6 ) \
|
||||
RGB( Magenta, 0xffff00ff ) \
|
||||
RGB( Maroon, 0xff800000 ) \
|
||||
RGB( MediumAquamarine, 0xff66cdaa ) \
|
||||
RGB( MediumBlue, 0xff0000cd ) \
|
||||
RGB( MediumOrchid, 0xffba55d3 ) \
|
||||
RGB( MediumPurple, 0xff9370db ) \
|
||||
RGB( MediumSeaGreen, 0xff3cb371 ) \
|
||||
RGB( MediumSlateBlue, 0xff7b68ee ) \
|
||||
RGB( MediumSpringGreen, 0xff00fa9a ) \
|
||||
RGB( MediumTurquoise, 0xff48d1cc ) \
|
||||
RGB( MediumVioletRed, 0xffc71585 ) \
|
||||
RGB( MidnightBlue, 0xff191970 ) \
|
||||
RGB( MintCream, 0xfff5fffa ) \
|
||||
RGB( MistyRose, 0xffffe4e1 ) \
|
||||
RGB( Moccasin, 0xffffe4b5 ) \
|
||||
RGB( NavajoWhite, 0xffffdead ) \
|
||||
RGB( Navy, 0xff000080 ) \
|
||||
RGB( OldLace, 0xfffdf5e6 ) \
|
||||
RGB( Olive, 0xff808000 ) \
|
||||
RGB( OliveDrab, 0xff6b8e23 ) \
|
||||
RGB( Orange, 0xffffa500 ) \
|
||||
RGB( OrangeRed, 0xffff4500 ) \
|
||||
RGB( Orchid, 0xffda70d6 ) \
|
||||
RGB( PaleGoldenrod, 0xffeee8aa ) \
|
||||
RGB( PaleGreen, 0xff98fb98 ) \
|
||||
RGB( PaleTurquoise, 0xffafeeee ) \
|
||||
RGB( PaleVioletRed, 0xffdb7093 ) \
|
||||
RGB( PapayaWhip, 0xffffefd5 ) \
|
||||
RGB( PeachPuff, 0xffffdab9 ) \
|
||||
RGB( Peru, 0xffcd853f ) \
|
||||
RGB( Pink, 0xffffc0cb ) \
|
||||
RGB( Plum, 0xffdda0dd ) \
|
||||
RGB( PowderBlue, 0xffb0e0e6 ) \
|
||||
RGB( Purple, 0xff800080 ) \
|
||||
RGB( Red, 0xffff0000 ) \
|
||||
RGB( RosyBrown, 0xffbc8f8f ) \
|
||||
RGB( RoyalBlue, 0xff4169e1 ) \
|
||||
RGB( SaddleBown, 0xff8b4513 ) \
|
||||
RGB( Salmon, 0xfffa8072 ) \
|
||||
RGB( SandyBrown, 0xfff4a460 ) \
|
||||
RGB( SeaGreen, 0xff2e8b57 ) \
|
||||
RGB( Seashell, 0xfffff5ee ) \
|
||||
RGB( Sienna, 0xffa0522d ) \
|
||||
RGB( Silver, 0xffc0c0c0 ) \
|
||||
RGB( SkyBlue, 0xff87ceeb ) \
|
||||
RGB( SlateBlue, 0xff6a5acd ) \
|
||||
RGB( SlateGrey, 0xff708090 ) \
|
||||
RGB( Snow, 0xfffffafa ) \
|
||||
RGB( SpringGreen, 0xff00ff7f ) \
|
||||
RGB( SteelBlue, 0xff4682b4 ) \
|
||||
RGB( Tan, 0xffd2b48c ) \
|
||||
RGB( Teal, 0xff008080 ) \
|
||||
RGB( Thistle, 0xffd8bfd8 ) \
|
||||
RGB( Tomato, 0xffff6347 ) \
|
||||
RGB( Turquoise, 0xff40e0d0 ) \
|
||||
RGB( Violet, 0xffee82ee ) \
|
||||
RGB( Wheat, 0xfff5deb3 ) \
|
||||
RGB( WhiteSmoke, 0xfff5f5f5 ) \
|
||||
RGB( Yellow, 0xffffff00 ) \
|
||||
RGB( YellowGreen, 0xff9acd32 ) \
|
||||
RGB( White, 0xffffffff ) \
|
||||
RGBVALUE( AliceBlue, 0xfff0f8ff ) \
|
||||
RGBVALUE( AntiqueWhite, 0xfffaebd7 ) \
|
||||
RGBVALUE( Aqua, 0xff00ffff ) \
|
||||
RGBVALUE( Aquamarine, 0xff7fffd4 ) \
|
||||
RGBVALUE( Azure, 0xfff0ffff ) \
|
||||
RGBVALUE( Beige, 0xfff5f5dc ) \
|
||||
RGBVALUE( Bisque, 0xffffe4c4 ) \
|
||||
RGBVALUE( Black, 0xff000000 ) \
|
||||
RGBVALUE( BlanchedAlmond, 0xffffebcd ) \
|
||||
RGBVALUE( Blue, 0xff0000ff ) \
|
||||
RGBVALUE( BlueViolet, 0xff8a2be2 ) \
|
||||
RGBVALUE( Brown, 0xffa52a2a ) \
|
||||
RGBVALUE( Burlywood, 0xffdeb887 ) \
|
||||
RGBVALUE( CadetBlue, 0xff5f9ea0 ) \
|
||||
RGBVALUE( Chartreuse, 0xff7fff00 ) \
|
||||
RGBVALUE( Chocolate, 0xffd2691e ) \
|
||||
RGBVALUE( Coral, 0xffff7f50 ) \
|
||||
RGBVALUE( CornflowerBlue, 0xff6495ed ) \
|
||||
RGBVALUE( Cornsilk, 0xfffff8dc ) \
|
||||
RGBVALUE( Crimson, 0xffdc143c ) \
|
||||
RGBVALUE( Cyan, 0xff00ffff ) \
|
||||
RGBVALUE( DarkBlue, 0xff00008b ) \
|
||||
RGBVALUE( DarkCyan, 0xff008b8b ) \
|
||||
RGBVALUE( DarkGoldenrod, 0xffb8860b ) \
|
||||
RGBVALUE( DarkGray, 0xffa9a9a9 ) \
|
||||
RGBVALUE( DarkGreen, 0xff006400 ) \
|
||||
RGBVALUE( DarkGrey, 0xffa9a9a9 ) \
|
||||
RGBVALUE( DarkKhaki, 0xffbdb76b ) \
|
||||
RGBVALUE( DarkMagenta, 0xff8b008b ) \
|
||||
RGBVALUE( DarkOliveGreen, 0xff556b2f ) \
|
||||
RGBVALUE( DarkOrange, 0xffff8c00 ) \
|
||||
RGBVALUE( DarkOrchid, 0xff9932cc ) \
|
||||
RGBVALUE( DarkRed, 0xff8b0000 ) \
|
||||
RGBVALUE( DarkSalmon, 0xffe9967a ) \
|
||||
RGBVALUE( DarkSeaGreen, 0xff8fbc8f ) \
|
||||
RGBVALUE( DarkSlateBlue, 0xff483d8b ) \
|
||||
RGBVALUE( DarkSlateGray, 0xff2f4f4f ) \
|
||||
RGBVALUE( DarkSlateGrey, 0xff2f4f4f ) \
|
||||
RGBVALUE( DarkTurquoise, 0xff00ced1 ) \
|
||||
RGBVALUE( DarkViolet, 0xff9400d3 ) \
|
||||
RGBVALUE( DeepPink, 0xffff1493 ) \
|
||||
RGBVALUE( DeepSkyBlue, 0xff00bfff ) \
|
||||
RGBVALUE( DimGray, 0xff696969 ) \
|
||||
RGBVALUE( DimGrey, 0xff696969 ) \
|
||||
RGBVALUE( DodgerBlue, 0xff1e90ff ) \
|
||||
RGBVALUE( FireBrick, 0xffb22222 ) \
|
||||
RGBVALUE( FloralWhite, 0xfffffaf0 ) \
|
||||
RGBVALUE( ForestGreen, 0xff228b22 ) \
|
||||
RGBVALUE( Fuchsia, 0xffff00ff ) \
|
||||
RGBVALUE( Gainsboro, 0xffdcdcdc ) \
|
||||
RGBVALUE( GhostWhite, 0xfff8f8ff ) \
|
||||
RGBVALUE( Gold, 0xffffd700 ) \
|
||||
RGBVALUE( Goldenrod, 0xffdaa520 ) \
|
||||
RGBVALUE( Gray, 0xff808080 ) \
|
||||
RGBVALUE( Green, 0xff008000 ) \
|
||||
RGBVALUE( GreenYellow, 0xffadff2f ) \
|
||||
RGBVALUE( Grey, 0xff808080 ) \
|
||||
RGBVALUE( Honeydew, 0xfff0fff0 ) \
|
||||
RGBVALUE( HotPink, 0xffff69b4 ) \
|
||||
RGBVALUE( IndianRed, 0xffcd5c5c ) \
|
||||
RGBVALUE( Indigo, 0xff4b0082 ) \
|
||||
RGBVALUE( Ivory, 0xfffffff0 ) \
|
||||
RGBVALUE( Khaki, 0xfff0e68c ) \
|
||||
RGBVALUE( Lavender, 0xffe6e6fa ) \
|
||||
RGBVALUE( LavenderBlush, 0xfffff0f5 ) \
|
||||
RGBVALUE( LawnGreen, 0xff7cfc00 ) \
|
||||
RGBVALUE( LemonChiffon, 0xfffffacd ) \
|
||||
RGBVALUE( LightBlue, 0xffadd8e6 ) \
|
||||
RGBVALUE( LightCoral, 0xfff08080 ) \
|
||||
RGBVALUE( LightCyan, 0xffe0ffff ) \
|
||||
RGBVALUE( LightGoldenrodYellow, 0xfffafad2 ) \
|
||||
RGBVALUE( LightGray, 0xffd3d3d3 ) \
|
||||
RGBVALUE( LightGreen, 0xff90ee90 ) \
|
||||
RGBVALUE( LightGrey, 0xffd3d3d3 ) \
|
||||
RGBVALUE( LightPink, 0xffffb6c1 ) \
|
||||
RGBVALUE( LightSalmon, 0xffffa07a ) \
|
||||
RGBVALUE( LightSeaGreen, 0xff20b2aa ) \
|
||||
RGBVALUE( LightSkyBlue, 0xff87cefa ) \
|
||||
RGBVALUE( LightSlateGray, 0xff778899 ) \
|
||||
RGBVALUE( LightSlateGrey, 0xff778899 ) \
|
||||
RGBVALUE( LightSteelBlue, 0xffb0c4de ) \
|
||||
RGBVALUE( LightYellow, 0xffffffe0 ) \
|
||||
RGBVALUE( Lime, 0xff00ff00 ) \
|
||||
RGBVALUE( Limegreen, 0xff32cd32 ) \
|
||||
RGBVALUE( Linen, 0xfffaf0e6 ) \
|
||||
RGBVALUE( Magenta, 0xffff00ff ) \
|
||||
RGBVALUE( Maroon, 0xff800000 ) \
|
||||
RGBVALUE( MediumAquamarine, 0xff66cdaa ) \
|
||||
RGBVALUE( MediumBlue, 0xff0000cd ) \
|
||||
RGBVALUE( MediumOrchid, 0xffba55d3 ) \
|
||||
RGBVALUE( MediumPurple, 0xff9370db ) \
|
||||
RGBVALUE( MediumSeaGreen, 0xff3cb371 ) \
|
||||
RGBVALUE( MediumSlateBlue, 0xff7b68ee ) \
|
||||
RGBVALUE( MediumSpringGreen, 0xff00fa9a ) \
|
||||
RGBVALUE( MediumTurquoise, 0xff48d1cc ) \
|
||||
RGBVALUE( MediumVioletRed, 0xffc71585 ) \
|
||||
RGBVALUE( MidnightBlue, 0xff191970 ) \
|
||||
RGBVALUE( MintCream, 0xfff5fffa ) \
|
||||
RGBVALUE( MistyRose, 0xffffe4e1 ) \
|
||||
RGBVALUE( Moccasin, 0xffffe4b5 ) \
|
||||
RGBVALUE( NavajoWhite, 0xffffdead ) \
|
||||
RGBVALUE( Navy, 0xff000080 ) \
|
||||
RGBVALUE( OldLace, 0xfffdf5e6 ) \
|
||||
RGBVALUE( Olive, 0xff808000 ) \
|
||||
RGBVALUE( OliveDrab, 0xff6b8e23 ) \
|
||||
RGBVALUE( Orange, 0xffffa500 ) \
|
||||
RGBVALUE( OrangeRed, 0xffff4500 ) \
|
||||
RGBVALUE( Orchid, 0xffda70d6 ) \
|
||||
RGBVALUE( PaleGoldenrod, 0xffeee8aa ) \
|
||||
RGBVALUE( PaleGreen, 0xff98fb98 ) \
|
||||
RGBVALUE( PaleTurquoise, 0xffafeeee ) \
|
||||
RGBVALUE( PaleVioletRed, 0xffdb7093 ) \
|
||||
RGBVALUE( PapayaWhip, 0xffffefd5 ) \
|
||||
RGBVALUE( PeachPuff, 0xffffdab9 ) \
|
||||
RGBVALUE( Peru, 0xffcd853f ) \
|
||||
RGBVALUE( Pink, 0xffffc0cb ) \
|
||||
RGBVALUE( Plum, 0xffdda0dd ) \
|
||||
RGBVALUE( PowderBlue, 0xffb0e0e6 ) \
|
||||
RGBVALUE( Purple, 0xff800080 ) \
|
||||
RGBVALUE( Red, 0xffff0000 ) \
|
||||
RGBVALUE( RosyBrown, 0xffbc8f8f ) \
|
||||
RGBVALUE( RoyalBlue, 0xff4169e1 ) \
|
||||
RGBVALUE( SaddleBown, 0xff8b4513 ) \
|
||||
RGBVALUE( Salmon, 0xfffa8072 ) \
|
||||
RGBVALUE( SandyBrown, 0xfff4a460 ) \
|
||||
RGBVALUE( SeaGreen, 0xff2e8b57 ) \
|
||||
RGBVALUE( Seashell, 0xfffff5ee ) \
|
||||
RGBVALUE( Sienna, 0xffa0522d ) \
|
||||
RGBVALUE( Silver, 0xffc0c0c0 ) \
|
||||
RGBVALUE( SkyBlue, 0xff87ceeb ) \
|
||||
RGBVALUE( SlateBlue, 0xff6a5acd ) \
|
||||
RGBVALUE( SlateGrey, 0xff708090 ) \
|
||||
RGBVALUE( Snow, 0xfffffafa ) \
|
||||
RGBVALUE( SpringGreen, 0xff00ff7f ) \
|
||||
RGBVALUE( SteelBlue, 0xff4682b4 ) \
|
||||
RGBVALUE( Tan, 0xffd2b48c ) \
|
||||
RGBVALUE( Teal, 0xff008080 ) \
|
||||
RGBVALUE( Thistle, 0xffd8bfd8 ) \
|
||||
RGBVALUE( Tomato, 0xffff6347 ) \
|
||||
RGBVALUE( Turquoise, 0xff40e0d0 ) \
|
||||
RGBVALUE( Violet, 0xffee82ee ) \
|
||||
RGBVALUE( Wheat, 0xfff5deb3 ) \
|
||||
RGBVALUE( WhiteSmoke, 0xfff5f5f5 ) \
|
||||
RGBVALUE( Yellow, 0xffffff00 ) \
|
||||
RGBVALUE( YellowGreen, 0xff9acd32 ) \
|
||||
RGBVALUE( White, 0xffffffff ) \
|
||||
/* Material colors from https://material.google.com/style/color.html */ \
|
||||
RGB( Red50, 0xffffebee ) \
|
||||
RGB( Red100, 0xffffcdd2 ) \
|
||||
RGB( Red200, 0xffef9a9a ) \
|
||||
RGB( Red300, 0xffe57373 ) \
|
||||
RGB( Red400, 0xffef5350 ) \
|
||||
RGB( Red500, 0xfff44336 ) \
|
||||
RGB( Red600, 0xffe53935 ) \
|
||||
RGB( Red700, 0xffd32f2f ) \
|
||||
RGB( Red800, 0xffc62828 ) \
|
||||
RGB( Red900, 0xffb71c1c ) \
|
||||
RGB( RedA100, 0xffff8a80 ) \
|
||||
RGB( RedA200, 0xffff5252 ) \
|
||||
RGB( RedA400, 0xffff1744 ) \
|
||||
RGB( RedA700, 0xffd50000 ) \
|
||||
RGBVALUE( Red50, 0xffffebee ) \
|
||||
RGBVALUE( Red100, 0xffffcdd2 ) \
|
||||
RGBVALUE( Red200, 0xffef9a9a ) \
|
||||
RGBVALUE( Red300, 0xffe57373 ) \
|
||||
RGBVALUE( Red400, 0xffef5350 ) \
|
||||
RGBVALUE( Red500, 0xfff44336 ) \
|
||||
RGBVALUE( Red600, 0xffe53935 ) \
|
||||
RGBVALUE( Red700, 0xffd32f2f ) \
|
||||
RGBVALUE( Red800, 0xffc62828 ) \
|
||||
RGBVALUE( Red900, 0xffb71c1c ) \
|
||||
RGBVALUE( RedA100, 0xffff8a80 ) \
|
||||
RGBVALUE( RedA200, 0xffff5252 ) \
|
||||
RGBVALUE( RedA400, 0xffff1744 ) \
|
||||
RGBVALUE( RedA700, 0xffd50000 ) \
|
||||
\
|
||||
RGB( Pink50, 0xfffce4ec ) \
|
||||
RGB( Pink100, 0xfff8bbd0 ) \
|
||||
RGB( Pink200, 0xfff48fb1 ) \
|
||||
RGB( Pink300, 0xfff06292 ) \
|
||||
RGB( Pink400, 0xffec407a ) \
|
||||
RGB( Pink500, 0xffe91e63 ) \
|
||||
RGB( Pink600, 0xffd81b60 ) \
|
||||
RGB( Pink700, 0xffc2185b ) \
|
||||
RGB( Pink800, 0xffad1457 ) \
|
||||
RGB( Pink900, 0xff880e4f ) \
|
||||
RGB( PinkA100, 0xffff80ab ) \
|
||||
RGB( PinkA200, 0xffff4081 ) \
|
||||
RGB( PinkA400, 0xfff50057 ) \
|
||||
RGB( PinkA700, 0xffc51162 ) \
|
||||
RGBVALUE( Pink50, 0xfffce4ec ) \
|
||||
RGBVALUE( Pink100, 0xfff8bbd0 ) \
|
||||
RGBVALUE( Pink200, 0xfff48fb1 ) \
|
||||
RGBVALUE( Pink300, 0xfff06292 ) \
|
||||
RGBVALUE( Pink400, 0xffec407a ) \
|
||||
RGBVALUE( Pink500, 0xffe91e63 ) \
|
||||
RGBVALUE( Pink600, 0xffd81b60 ) \
|
||||
RGBVALUE( Pink700, 0xffc2185b ) \
|
||||
RGBVALUE( Pink800, 0xffad1457 ) \
|
||||
RGBVALUE( Pink900, 0xff880e4f ) \
|
||||
RGBVALUE( PinkA100, 0xffff80ab ) \
|
||||
RGBVALUE( PinkA200, 0xffff4081 ) \
|
||||
RGBVALUE( PinkA400, 0xfff50057 ) \
|
||||
RGBVALUE( PinkA700, 0xffc51162 ) \
|
||||
\
|
||||
RGB( Purple50, 0xfff3e5f5 ) \
|
||||
RGB( Purple100, 0xffe1bee7 ) \
|
||||
RGB( Purple200, 0xffce93d8 ) \
|
||||
RGB( Purple300, 0xffba68c8 ) \
|
||||
RGB( Purple400, 0xffab47bc ) \
|
||||
RGB( Purple500, 0xff9c27b0 ) \
|
||||
RGB( Purple600, 0xff8e24aa ) \
|
||||
RGB( Purple700, 0xff7b1fa2 ) \
|
||||
RGB( Purple800, 0xff6a1b9a ) \
|
||||
RGB( Purple900, 0xff4a148c ) \
|
||||
RGB( PurpleA100, 0xffea80fc ) \
|
||||
RGB( PurpleA200, 0xffe040fb ) \
|
||||
RGB( PurpleA400, 0xffd500f9 ) \
|
||||
RGB( PurpleA700, 0xffaa00ff ) \
|
||||
RGBVALUE( Purple50, 0xfff3e5f5 ) \
|
||||
RGBVALUE( Purple100, 0xffe1bee7 ) \
|
||||
RGBVALUE( Purple200, 0xffce93d8 ) \
|
||||
RGBVALUE( Purple300, 0xffba68c8 ) \
|
||||
RGBVALUE( Purple400, 0xffab47bc ) \
|
||||
RGBVALUE( Purple500, 0xff9c27b0 ) \
|
||||
RGBVALUE( Purple600, 0xff8e24aa ) \
|
||||
RGBVALUE( Purple700, 0xff7b1fa2 ) \
|
||||
RGBVALUE( Purple800, 0xff6a1b9a ) \
|
||||
RGBVALUE( Purple900, 0xff4a148c ) \
|
||||
RGBVALUE( PurpleA100, 0xffea80fc ) \
|
||||
RGBVALUE( PurpleA200, 0xffe040fb ) \
|
||||
RGBVALUE( PurpleA400, 0xffd500f9 ) \
|
||||
RGBVALUE( PurpleA700, 0xffaa00ff ) \
|
||||
\
|
||||
RGB( DeepPurple50, 0xffede7f6 ) \
|
||||
RGB( DeepPurple100, 0xffd1c4e9 ) \
|
||||
RGB( DeepPurple200, 0xffb39ddb ) \
|
||||
RGB( DeepPurple300, 0xff9575cd ) \
|
||||
RGB( DeepPurple400, 0xff7e57c2 ) \
|
||||
RGB( DeepPurple500, 0xff673ab7 ) \
|
||||
RGB( DeepPurple600, 0xff5e35b1 ) \
|
||||
RGB( DeepPurple700, 0xff512da8 ) \
|
||||
RGB( DeepPurple800, 0xff4527a0 ) \
|
||||
RGB( DeepPurple900, 0xff311b92 ) \
|
||||
RGB( DeepPurpleA100, 0xffb388ff ) \
|
||||
RGB( DeepPurpleA200, 0xff7c4dff ) \
|
||||
RGB( DeepPurpleA400, 0xff651fff ) \
|
||||
RGB( DeepPurpleA700, 0xff6200ea ) \
|
||||
RGBVALUE( DeepPurple50, 0xffede7f6 ) \
|
||||
RGBVALUE( DeepPurple100, 0xffd1c4e9 ) \
|
||||
RGBVALUE( DeepPurple200, 0xffb39ddb ) \
|
||||
RGBVALUE( DeepPurple300, 0xff9575cd ) \
|
||||
RGBVALUE( DeepPurple400, 0xff7e57c2 ) \
|
||||
RGBVALUE( DeepPurple500, 0xff673ab7 ) \
|
||||
RGBVALUE( DeepPurple600, 0xff5e35b1 ) \
|
||||
RGBVALUE( DeepPurple700, 0xff512da8 ) \
|
||||
RGBVALUE( DeepPurple800, 0xff4527a0 ) \
|
||||
RGBVALUE( DeepPurple900, 0xff311b92 ) \
|
||||
RGBVALUE( DeepPurpleA100, 0xffb388ff ) \
|
||||
RGBVALUE( DeepPurpleA200, 0xff7c4dff ) \
|
||||
RGBVALUE( DeepPurpleA400, 0xff651fff ) \
|
||||
RGBVALUE( DeepPurpleA700, 0xff6200ea ) \
|
||||
\
|
||||
RGB( Indigo50, 0xffe8eaf6 ) \
|
||||
RGB( Indigo100, 0xffc5cae9 ) \
|
||||
RGB( Indigo200, 0xff9fa8da ) \
|
||||
RGB( Indigo300, 0xff7986cb ) \
|
||||
RGB( Indigo400, 0xff5c6bc0 ) \
|
||||
RGB( Indigo500, 0xff3f51b5 ) \
|
||||
RGB( Indigo600, 0xff3949ab ) \
|
||||
RGB( Indigo700, 0xff303f9f ) \
|
||||
RGB( Indigo800, 0xff283593 ) \
|
||||
RGB( Indigo900, 0xff1a237e ) \
|
||||
RGB( IndigoA100, 0xff8c9eff ) \
|
||||
RGB( IndigoA200, 0xff536dfe ) \
|
||||
RGB( IndigoA400, 0xff3d5afe ) \
|
||||
RGB( IndigoA700, 0xff304ffe ) \
|
||||
RGBVALUE( Indigo50, 0xffe8eaf6 ) \
|
||||
RGBVALUE( Indigo100, 0xffc5cae9 ) \
|
||||
RGBVALUE( Indigo200, 0xff9fa8da ) \
|
||||
RGBVALUE( Indigo300, 0xff7986cb ) \
|
||||
RGBVALUE( Indigo400, 0xff5c6bc0 ) \
|
||||
RGBVALUE( Indigo500, 0xff3f51b5 ) \
|
||||
RGBVALUE( Indigo600, 0xff3949ab ) \
|
||||
RGBVALUE( Indigo700, 0xff303f9f ) \
|
||||
RGBVALUE( Indigo800, 0xff283593 ) \
|
||||
RGBVALUE( Indigo900, 0xff1a237e ) \
|
||||
RGBVALUE( IndigoA100, 0xff8c9eff ) \
|
||||
RGBVALUE( IndigoA200, 0xff536dfe ) \
|
||||
RGBVALUE( IndigoA400, 0xff3d5afe ) \
|
||||
RGBVALUE( IndigoA700, 0xff304ffe ) \
|
||||
\
|
||||
RGB( Blue50, 0xffe3f2fd ) \
|
||||
RGB( Blue100, 0xffbbdefb ) \
|
||||
RGB( Blue200, 0xff90caf9 ) \
|
||||
RGB( Blue300, 0xff64b5f6 ) \
|
||||
RGB( Blue400, 0xff42a5f5 ) \
|
||||
RGB( Blue500, 0xff2196f3 ) \
|
||||
RGB( Blue600, 0xff1e88e5 ) \
|
||||
RGB( Blue700, 0xff1976d2 ) \
|
||||
RGB( Blue800, 0xff1565c0 ) \
|
||||
RGB( Blue900, 0xff0d47a1 ) \
|
||||
RGB( BlueA100, 0xff82b1ff ) \
|
||||
RGB( BlueA200, 0xff448aff ) \
|
||||
RGB( BlueA400, 0xff2979ff ) \
|
||||
RGB( BlueA700, 0xff2962ff ) \
|
||||
RGBVALUE( Blue50, 0xffe3f2fd ) \
|
||||
RGBVALUE( Blue100, 0xffbbdefb ) \
|
||||
RGBVALUE( Blue200, 0xff90caf9 ) \
|
||||
RGBVALUE( Blue300, 0xff64b5f6 ) \
|
||||
RGBVALUE( Blue400, 0xff42a5f5 ) \
|
||||
RGBVALUE( Blue500, 0xff2196f3 ) \
|
||||
RGBVALUE( Blue600, 0xff1e88e5 ) \
|
||||
RGBVALUE( Blue700, 0xff1976d2 ) \
|
||||
RGBVALUE( Blue800, 0xff1565c0 ) \
|
||||
RGBVALUE( Blue900, 0xff0d47a1 ) \
|
||||
RGBVALUE( BlueA100, 0xff82b1ff ) \
|
||||
RGBVALUE( BlueA200, 0xff448aff ) \
|
||||
RGBVALUE( BlueA400, 0xff2979ff ) \
|
||||
RGBVALUE( BlueA700, 0xff2962ff ) \
|
||||
\
|
||||
RGB( LightBlue50, 0xffe1f5fe ) \
|
||||
RGB( LightBlue100, 0xffb3e5fc ) \
|
||||
RGB( LightBlue200, 0xff81d4fa ) \
|
||||
RGB( LightBlue300, 0xff4fc3f7 ) \
|
||||
RGB( LightBlue400, 0xff29b6f6 ) \
|
||||
RGB( LightBlue500, 0xff03a9f4 ) \
|
||||
RGB( LightBlue600, 0xff039be5 ) \
|
||||
RGB( LightBlue700, 0xff0288d1 ) \
|
||||
RGB( LightBlue800, 0xff0277bd ) \
|
||||
RGB( LightBlue900, 0xff01579b ) \
|
||||
RGB( LightBlueA100, 0xff80d8ff ) \
|
||||
RGB( LightBlueA200, 0xff40c4ff ) \
|
||||
RGB( LightBlueA400, 0xff00b0ff ) \
|
||||
RGB( LightBlueA700, 0xff0091ea ) \
|
||||
RGBVALUE( LightBlue50, 0xffe1f5fe ) \
|
||||
RGBVALUE( LightBlue100, 0xffb3e5fc ) \
|
||||
RGBVALUE( LightBlue200, 0xff81d4fa ) \
|
||||
RGBVALUE( LightBlue300, 0xff4fc3f7 ) \
|
||||
RGBVALUE( LightBlue400, 0xff29b6f6 ) \
|
||||
RGBVALUE( LightBlue500, 0xff03a9f4 ) \
|
||||
RGBVALUE( LightBlue600, 0xff039be5 ) \
|
||||
RGBVALUE( LightBlue700, 0xff0288d1 ) \
|
||||
RGBVALUE( LightBlue800, 0xff0277bd ) \
|
||||
RGBVALUE( LightBlue900, 0xff01579b ) \
|
||||
RGBVALUE( LightBlueA100, 0xff80d8ff ) \
|
||||
RGBVALUE( LightBlueA200, 0xff40c4ff ) \
|
||||
RGBVALUE( LightBlueA400, 0xff00b0ff ) \
|
||||
RGBVALUE( LightBlueA700, 0xff0091ea ) \
|
||||
\
|
||||
RGB( Cyan50, 0xffe0f7fa ) \
|
||||
RGB( Cyan100, 0xffb2ebf2 ) \
|
||||
RGB( Cyan200, 0xff80deea ) \
|
||||
RGB( Cyan300, 0xff4dd0e1 ) \
|
||||
RGB( Cyan400, 0xff26c6da ) \
|
||||
RGB( Cyan500, 0xff00bcd4 ) \
|
||||
RGB( Cyan600, 0xff00acc1 ) \
|
||||
RGB( Cyan700, 0xff0097a7 ) \
|
||||
RGB( Cyan800, 0xff00838f ) \
|
||||
RGB( Cyan900, 0xff006064 ) \
|
||||
RGB( CyanA100, 0xff84ffff ) \
|
||||
RGB( CyanA200, 0xff18ffff ) \
|
||||
RGB( CyanA400, 0xff00e5ff ) \
|
||||
RGB( CyanA700, 0xff00b8d4 ) \
|
||||
RGBVALUE( Cyan50, 0xffe0f7fa ) \
|
||||
RGBVALUE( Cyan100, 0xffb2ebf2 ) \
|
||||
RGBVALUE( Cyan200, 0xff80deea ) \
|
||||
RGBVALUE( Cyan300, 0xff4dd0e1 ) \
|
||||
RGBVALUE( Cyan400, 0xff26c6da ) \
|
||||
RGBVALUE( Cyan500, 0xff00bcd4 ) \
|
||||
RGBVALUE( Cyan600, 0xff00acc1 ) \
|
||||
RGBVALUE( Cyan700, 0xff0097a7 ) \
|
||||
RGBVALUE( Cyan800, 0xff00838f ) \
|
||||
RGBVALUE( Cyan900, 0xff006064 ) \
|
||||
RGBVALUE( CyanA100, 0xff84ffff ) \
|
||||
RGBVALUE( CyanA200, 0xff18ffff ) \
|
||||
RGBVALUE( CyanA400, 0xff00e5ff ) \
|
||||
RGBVALUE( CyanA700, 0xff00b8d4 ) \
|
||||
\
|
||||
RGB( Teal50, 0xffe0f2f1 ) \
|
||||
RGB( Teal100, 0xffb2dfdb ) \
|
||||
RGB( Teal200, 0xff80cbc4 ) \
|
||||
RGB( Teal300, 0xff4db6ac ) \
|
||||
RGB( Teal400, 0xff26a69a ) \
|
||||
RGB( Teal500, 0xff009688 ) \
|
||||
RGB( Teal600, 0xff00897b ) \
|
||||
RGB( Teal700, 0xff00796b ) \
|
||||
RGB( Teal800, 0xff00695c ) \
|
||||
RGB( Teal900, 0xff004d40 ) \
|
||||
RGB( TealA100, 0xffa7ffeb ) \
|
||||
RGB( TealA200, 0xff64ffda ) \
|
||||
RGB( TealA400, 0xff1de9b6 ) \
|
||||
RGB( TealA700, 0xff00bfa5 ) \
|
||||
RGBVALUE( Teal50, 0xffe0f2f1 ) \
|
||||
RGBVALUE( Teal100, 0xffb2dfdb ) \
|
||||
RGBVALUE( Teal200, 0xff80cbc4 ) \
|
||||
RGBVALUE( Teal300, 0xff4db6ac ) \
|
||||
RGBVALUE( Teal400, 0xff26a69a ) \
|
||||
RGBVALUE( Teal500, 0xff009688 ) \
|
||||
RGBVALUE( Teal600, 0xff00897b ) \
|
||||
RGBVALUE( Teal700, 0xff00796b ) \
|
||||
RGBVALUE( Teal800, 0xff00695c ) \
|
||||
RGBVALUE( Teal900, 0xff004d40 ) \
|
||||
RGBVALUE( TealA100, 0xffa7ffeb ) \
|
||||
RGBVALUE( TealA200, 0xff64ffda ) \
|
||||
RGBVALUE( TealA400, 0xff1de9b6 ) \
|
||||
RGBVALUE( TealA700, 0xff00bfa5 ) \
|
||||
\
|
||||
RGB( Green50, 0xffe8f5e9 ) \
|
||||
RGB( Green100, 0xffc8e6c9 ) \
|
||||
RGB( Green200, 0xffa5d6a7 ) \
|
||||
RGB( Green300, 0xff81c784 ) \
|
||||
RGB( Green400, 0xff66bb6a ) \
|
||||
RGB( Green500, 0xff4caf50 ) \
|
||||
RGB( Green600, 0xff43a047 ) \
|
||||
RGB( Green700, 0xff388e3c ) \
|
||||
RGB( Green800, 0xff2e7d32 ) \
|
||||
RGB( Green900, 0xff1b5e20 ) \
|
||||
RGB( GreenA100, 0xffb9f6ca ) \
|
||||
RGB( GreenA200, 0xff69f0ae ) \
|
||||
RGB( GreenA400, 0xff00e676 ) \
|
||||
RGB( GreenA700, 0xff00c853 ) \
|
||||
RGBVALUE( Green50, 0xffe8f5e9 ) \
|
||||
RGBVALUE( Green100, 0xffc8e6c9 ) \
|
||||
RGBVALUE( Green200, 0xffa5d6a7 ) \
|
||||
RGBVALUE( Green300, 0xff81c784 ) \
|
||||
RGBVALUE( Green400, 0xff66bb6a ) \
|
||||
RGBVALUE( Green500, 0xff4caf50 ) \
|
||||
RGBVALUE( Green600, 0xff43a047 ) \
|
||||
RGBVALUE( Green700, 0xff388e3c ) \
|
||||
RGBVALUE( Green800, 0xff2e7d32 ) \
|
||||
RGBVALUE( Green900, 0xff1b5e20 ) \
|
||||
RGBVALUE( GreenA100, 0xffb9f6ca ) \
|
||||
RGBVALUE( GreenA200, 0xff69f0ae ) \
|
||||
RGBVALUE( GreenA400, 0xff00e676 ) \
|
||||
RGBVALUE( GreenA700, 0xff00c853 ) \
|
||||
\
|
||||
RGB( LightGreen50, 0xfff1f8e9 ) \
|
||||
RGB( LightGreen100, 0xffdcedc8 ) \
|
||||
RGB( LightGreen200, 0xffc5e1a5 ) \
|
||||
RGB( LightGreen300, 0xffaed581 ) \
|
||||
RGB( LightGreen400, 0xff9ccc65 ) \
|
||||
RGB( LightGreen500, 0xff8bc34a ) \
|
||||
RGB( LightGreen600, 0xff7cb342 ) \
|
||||
RGB( LightGreen700, 0xff689f38 ) \
|
||||
RGB( LightGreen800, 0xff558b2f ) \
|
||||
RGB( LightGreen900, 0xff33691e ) \
|
||||
RGB( LightGreenA100, 0xffccff90 ) \
|
||||
RGB( LightGreenA200, 0xffb2ff59 ) \
|
||||
RGB( LightGreenA400, 0xff76ff03 ) \
|
||||
RGB( LightGreenA700, 0xff64dd17 ) \
|
||||
RGBVALUE( LightGreen50, 0xfff1f8e9 ) \
|
||||
RGBVALUE( LightGreen100, 0xffdcedc8 ) \
|
||||
RGBVALUE( LightGreen200, 0xffc5e1a5 ) \
|
||||
RGBVALUE( LightGreen300, 0xffaed581 ) \
|
||||
RGBVALUE( LightGreen400, 0xff9ccc65 ) \
|
||||
RGBVALUE( LightGreen500, 0xff8bc34a ) \
|
||||
RGBVALUE( LightGreen600, 0xff7cb342 ) \
|
||||
RGBVALUE( LightGreen700, 0xff689f38 ) \
|
||||
RGBVALUE( LightGreen800, 0xff558b2f ) \
|
||||
RGBVALUE( LightGreen900, 0xff33691e ) \
|
||||
RGBVALUE( LightGreenA100, 0xffccff90 ) \
|
||||
RGBVALUE( LightGreenA200, 0xffb2ff59 ) \
|
||||
RGBVALUE( LightGreenA400, 0xff76ff03 ) \
|
||||
RGBVALUE( LightGreenA700, 0xff64dd17 ) \
|
||||
\
|
||||
RGB( Lime50, 0xfff9fbe7 ) \
|
||||
RGB( Lime100, 0xfff0f4c3 ) \
|
||||
RGB( Lime200, 0xffe6ee9c ) \
|
||||
RGB( Lime300, 0xffdce775 ) \
|
||||
RGB( Lime400, 0xffd4e157 ) \
|
||||
RGB( Lime500, 0xffcddc39 ) \
|
||||
RGB( Lime600, 0xffc0ca33 ) \
|
||||
RGB( Lime700, 0xffafb42b ) \
|
||||
RGB( Lime800, 0xff9e9d24 ) \
|
||||
RGB( Lime900, 0xff827717 ) \
|
||||
RGB( LimeA100, 0xfff4ff81 ) \
|
||||
RGB( LimeA200, 0xffeeff41 ) \
|
||||
RGB( LimeA400, 0xffc6ff00 ) \
|
||||
RGB( LimeA700, 0xffaeea00 ) \
|
||||
RGBVALUE( Lime50, 0xfff9fbe7 ) \
|
||||
RGBVALUE( Lime100, 0xfff0f4c3 ) \
|
||||
RGBVALUE( Lime200, 0xffe6ee9c ) \
|
||||
RGBVALUE( Lime300, 0xffdce775 ) \
|
||||
RGBVALUE( Lime400, 0xffd4e157 ) \
|
||||
RGBVALUE( Lime500, 0xffcddc39 ) \
|
||||
RGBVALUE( Lime600, 0xffc0ca33 ) \
|
||||
RGBVALUE( Lime700, 0xffafb42b ) \
|
||||
RGBVALUE( Lime800, 0xff9e9d24 ) \
|
||||
RGBVALUE( Lime900, 0xff827717 ) \
|
||||
RGBVALUE( LimeA100, 0xfff4ff81 ) \
|
||||
RGBVALUE( LimeA200, 0xffeeff41 ) \
|
||||
RGBVALUE( LimeA400, 0xffc6ff00 ) \
|
||||
RGBVALUE( LimeA700, 0xffaeea00 ) \
|
||||
\
|
||||
RGB( Yellow50, 0xfffffde7 ) \
|
||||
RGB( Yellow100, 0xfffff9c4 ) \
|
||||
RGB( Yellow200, 0xfffff59d ) \
|
||||
RGB( Yellow300, 0xfffff176 ) \
|
||||
RGB( Yellow400, 0xffffee58 ) \
|
||||
RGB( Yellow500, 0xffffeb3b ) \
|
||||
RGB( Yellow600, 0xfffdd835 ) \
|
||||
RGB( Yellow700, 0xfffbc02d ) \
|
||||
RGB( Yellow800, 0xfff9a825 ) \
|
||||
RGB( Yellow900, 0xfff57f17 ) \
|
||||
RGB( YellowA100, 0xffffff8d ) \
|
||||
RGB( YellowA200, 0xffffff00 ) \
|
||||
RGB( YellowA400, 0xffffea00 ) \
|
||||
RGB( YellowA700, 0xffffd600 ) \
|
||||
RGBVALUE( Yellow50, 0xfffffde7 ) \
|
||||
RGBVALUE( Yellow100, 0xfffff9c4 ) \
|
||||
RGBVALUE( Yellow200, 0xfffff59d ) \
|
||||
RGBVALUE( Yellow300, 0xfffff176 ) \
|
||||
RGBVALUE( Yellow400, 0xffffee58 ) \
|
||||
RGBVALUE( Yellow500, 0xffffeb3b ) \
|
||||
RGBVALUE( Yellow600, 0xfffdd835 ) \
|
||||
RGBVALUE( Yellow700, 0xfffbc02d ) \
|
||||
RGBVALUE( Yellow800, 0xfff9a825 ) \
|
||||
RGBVALUE( Yellow900, 0xfff57f17 ) \
|
||||
RGBVALUE( YellowA100, 0xffffff8d ) \
|
||||
RGBVALUE( YellowA200, 0xffffff00 ) \
|
||||
RGBVALUE( YellowA400, 0xffffea00 ) \
|
||||
RGBVALUE( YellowA700, 0xffffd600 ) \
|
||||
\
|
||||
RGB( Amber50, 0xfffff8e1 ) \
|
||||
RGB( Amber100, 0xffffecb3 ) \
|
||||
RGB( Amber200, 0xffffe082 ) \
|
||||
RGB( Amber300, 0xffffd54f ) \
|
||||
RGB( Amber400, 0xffffca28 ) \
|
||||
RGB( Amber500, 0xffffc107 ) \
|
||||
RGB( Amber600, 0xffffb300 ) \
|
||||
RGB( Amber700, 0xffffa000 ) \
|
||||
RGB( Amber800, 0xffff8f00 ) \
|
||||
RGB( Amber900, 0xffff6f00 ) \
|
||||
RGB( AmberA100, 0xffffe57f ) \
|
||||
RGB( AmberA200, 0xffffd740 ) \
|
||||
RGB( AmberA400, 0xffffc400 ) \
|
||||
RGB( AmberA700, 0xffffab00 ) \
|
||||
RGBVALUE( Amber50, 0xfffff8e1 ) \
|
||||
RGBVALUE( Amber100, 0xffffecb3 ) \
|
||||
RGBVALUE( Amber200, 0xffffe082 ) \
|
||||
RGBVALUE( Amber300, 0xffffd54f ) \
|
||||
RGBVALUE( Amber400, 0xffffca28 ) \
|
||||
RGBVALUE( Amber500, 0xffffc107 ) \
|
||||
RGBVALUE( Amber600, 0xffffb300 ) \
|
||||
RGBVALUE( Amber700, 0xffffa000 ) \
|
||||
RGBVALUE( Amber800, 0xffff8f00 ) \
|
||||
RGBVALUE( Amber900, 0xffff6f00 ) \
|
||||
RGBVALUE( AmberA100, 0xffffe57f ) \
|
||||
RGBVALUE( AmberA200, 0xffffd740 ) \
|
||||
RGBVALUE( AmberA400, 0xffffc400 ) \
|
||||
RGBVALUE( AmberA700, 0xffffab00 ) \
|
||||
\
|
||||
RGB( Orange50, 0xfffff3e0 ) \
|
||||
RGB( Orange100, 0xffffe0b2 ) \
|
||||
RGB( Orange200, 0xffffcc80 ) \
|
||||
RGB( Orange300, 0xffffb74d ) \
|
||||
RGB( Orange400, 0xffffa726 ) \
|
||||
RGB( Orange500, 0xffff9800 ) \
|
||||
RGB( Orange600, 0xfffb8c00 ) \
|
||||
RGB( Orange700, 0xfff57c00 ) \
|
||||
RGB( Orange800, 0xffef6c00 ) \
|
||||
RGB( Orange900, 0xffe65100 ) \
|
||||
RGB( OrangeA100, 0xffffd180 ) \
|
||||
RGB( OrangeA200, 0xffffab40 ) \
|
||||
RGB( OrangeA400, 0xffff9100 ) \
|
||||
RGB( OrangeA700, 0xffff6d00 ) \
|
||||
RGBVALUE( Orange50, 0xfffff3e0 ) \
|
||||
RGBVALUE( Orange100, 0xffffe0b2 ) \
|
||||
RGBVALUE( Orange200, 0xffffcc80 ) \
|
||||
RGBVALUE( Orange300, 0xffffb74d ) \
|
||||
RGBVALUE( Orange400, 0xffffa726 ) \
|
||||
RGBVALUE( Orange500, 0xffff9800 ) \
|
||||
RGBVALUE( Orange600, 0xfffb8c00 ) \
|
||||
RGBVALUE( Orange700, 0xfff57c00 ) \
|
||||
RGBVALUE( Orange800, 0xffef6c00 ) \
|
||||
RGBVALUE( Orange900, 0xffe65100 ) \
|
||||
RGBVALUE( OrangeA100, 0xffffd180 ) \
|
||||
RGBVALUE( OrangeA200, 0xffffab40 ) \
|
||||
RGBVALUE( OrangeA400, 0xffff9100 ) \
|
||||
RGBVALUE( OrangeA700, 0xffff6d00 ) \
|
||||
\
|
||||
RGB( DeepOrange50, 0xfffbe9e7 ) \
|
||||
RGB( DeepOrange100, 0xffffccbc ) \
|
||||
RGB( DeepOrange200, 0xffffab91 ) \
|
||||
RGB( DeepOrange300, 0xffff8a65 ) \
|
||||
RGB( DeepOrange400, 0xffff7043 ) \
|
||||
RGB( DeepOrange500, 0xffff5722 ) \
|
||||
RGB( DeepOrange600, 0xfff4511e ) \
|
||||
RGB( DeepOrange700, 0xffe64a19 ) \
|
||||
RGB( DeepOrange800, 0xffd84315 ) \
|
||||
RGB( DeepOrange900, 0xffbf360c ) \
|
||||
RGB( DeepOrangeA100, 0xffff9e80 ) \
|
||||
RGB( DeepOrangeA200, 0xffff6e40 ) \
|
||||
RGB( DeepOrangeA400, 0xffff3d00 ) \
|
||||
RGB( DeepOrangeA700, 0xffdd2c00 ) \
|
||||
RGBVALUE( DeepOrange50, 0xfffbe9e7 ) \
|
||||
RGBVALUE( DeepOrange100, 0xffffccbc ) \
|
||||
RGBVALUE( DeepOrange200, 0xffffab91 ) \
|
||||
RGBVALUE( DeepOrange300, 0xffff8a65 ) \
|
||||
RGBVALUE( DeepOrange400, 0xffff7043 ) \
|
||||
RGBVALUE( DeepOrange500, 0xffff5722 ) \
|
||||
RGBVALUE( DeepOrange600, 0xfff4511e ) \
|
||||
RGBVALUE( DeepOrange700, 0xffe64a19 ) \
|
||||
RGBVALUE( DeepOrange800, 0xffd84315 ) \
|
||||
RGBVALUE( DeepOrange900, 0xffbf360c ) \
|
||||
RGBVALUE( DeepOrangeA100, 0xffff9e80 ) \
|
||||
RGBVALUE( DeepOrangeA200, 0xffff6e40 ) \
|
||||
RGBVALUE( DeepOrangeA400, 0xffff3d00 ) \
|
||||
RGBVALUE( DeepOrangeA700, 0xffdd2c00 ) \
|
||||
\
|
||||
RGB( Brown50, 0xffefebe9 ) \
|
||||
RGB( Brown100, 0xffd7ccc8 ) \
|
||||
RGB( Brown200, 0xffbcaaa4 ) \
|
||||
RGB( Brown300, 0xffa1887f ) \
|
||||
RGB( Brown400, 0xff8d6e63 ) \
|
||||
RGB( Brown500, 0xff795548 ) \
|
||||
RGB( Brown600, 0xff6d4c41 ) \
|
||||
RGB( Brown700, 0xff5d4037 ) \
|
||||
RGB( Brown800, 0xff4e342e ) \
|
||||
RGB( Brown900, 0xff3e2723 ) \
|
||||
RGBVALUE( Brown50, 0xffefebe9 ) \
|
||||
RGBVALUE( Brown100, 0xffd7ccc8 ) \
|
||||
RGBVALUE( Brown200, 0xffbcaaa4 ) \
|
||||
RGBVALUE( Brown300, 0xffa1887f ) \
|
||||
RGBVALUE( Brown400, 0xff8d6e63 ) \
|
||||
RGBVALUE( Brown500, 0xff795548 ) \
|
||||
RGBVALUE( Brown600, 0xff6d4c41 ) \
|
||||
RGBVALUE( Brown700, 0xff5d4037 ) \
|
||||
RGBVALUE( Brown800, 0xff4e342e ) \
|
||||
RGBVALUE( Brown900, 0xff3e2723 ) \
|
||||
\
|
||||
RGB( Grey50, 0xfffafafa ) \
|
||||
RGB( Grey100, 0xfff5f5f5 ) \
|
||||
RGB( Grey200, 0xffeeeeee ) \
|
||||
RGB( Grey300, 0xffe0e0e0 ) \
|
||||
RGB( Grey400, 0xffbdbdbd ) \
|
||||
RGB( Grey500, 0xff9e9e9e ) \
|
||||
RGB( Grey600, 0xff757575 ) \
|
||||
RGB( Grey700, 0xff616161 ) \
|
||||
RGB( Grey800, 0xff424242 ) \
|
||||
RGB( Grey900, 0xff212121 ) \
|
||||
RGBVALUE( Grey50, 0xfffafafa ) \
|
||||
RGBVALUE( Grey100, 0xfff5f5f5 ) \
|
||||
RGBVALUE( Grey200, 0xffeeeeee ) \
|
||||
RGBVALUE( Grey300, 0xffe0e0e0 ) \
|
||||
RGBVALUE( Grey400, 0xffbdbdbd ) \
|
||||
RGBVALUE( Grey500, 0xff9e9e9e ) \
|
||||
RGBVALUE( Grey600, 0xff757575 ) \
|
||||
RGBVALUE( Grey700, 0xff616161 ) \
|
||||
RGBVALUE( Grey800, 0xff424242 ) \
|
||||
RGBVALUE( Grey900, 0xff212121 ) \
|
||||
\
|
||||
RGB( BlueGrey50, 0xffeceff1 ) \
|
||||
RGB( BlueGrey100, 0xffcfd8dc ) \
|
||||
RGB( BlueGrey200, 0xffb0bec5 ) \
|
||||
RGB( BlueGrey300, 0xff90a4ae ) \
|
||||
RGB( BlueGrey400, 0xff78909c ) \
|
||||
RGB( BlueGrey500, 0xff607d8b ) \
|
||||
RGB( BlueGrey600, 0xff546e7a ) \
|
||||
RGB( BlueGrey700, 0xff455a64 ) \
|
||||
RGB( BlueGrey800, 0xff37474f ) \
|
||||
RGB( BlueGrey900, 0xff263238 ) \
|
||||
RGBVALUE( BlueGrey50, 0xffeceff1 ) \
|
||||
RGBVALUE( BlueGrey100, 0xffcfd8dc ) \
|
||||
RGBVALUE( BlueGrey200, 0xffb0bec5 ) \
|
||||
RGBVALUE( BlueGrey300, 0xff90a4ae ) \
|
||||
RGBVALUE( BlueGrey400, 0xff78909c ) \
|
||||
RGBVALUE( BlueGrey500, 0xff607d8b ) \
|
||||
RGBVALUE( BlueGrey600, 0xff546e7a ) \
|
||||
RGBVALUE( BlueGrey700, 0xff455a64 ) \
|
||||
RGBVALUE( BlueGrey800, 0xff37474f ) \
|
||||
RGBVALUE( BlueGrey900, 0xff263238 ) \
|
||||
\
|
||||
RGB( Transparent, 0x00000000 ) \
|
||||
RGB( AlphaMask, 0xff000000 ) \
|
||||
RGB( ColorMask, 0x00ffffff )
|
||||
RGBVALUE( Transparent, 0x00000000 ) \
|
||||
RGBVALUE( AlphaMask, 0xff000000 ) \
|
||||
RGBVALUE( ColorMask, 0x00ffffff )
|
||||
|
||||
namespace QskRgb
|
||||
{
|
||||
#define RGB( name, value ) static constexpr const QRgb name = value;
|
||||
#define RGBVALUE( name, value ) static constexpr const QRgb name = value;
|
||||
QSK_RGB_VALUES
|
||||
#undef RGB
|
||||
#undef RGBVALUE
|
||||
|
||||
QSK_EXPORT QRgb rgb( Qt::GlobalColor );
|
||||
QSK_EXPORT QRgb interpolated( QRgb rgb1, QRgb rgb2, qreal ratio );
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class QSK_EXPORT QskBoxSkinlet : public QskSkinlet
|
|||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskBoxSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ void QskCheckBox::addToGroup( QskCheckBox* groupItem )
|
|||
} );
|
||||
|
||||
connect( groupItem, &QskAbstractButton::toggled,
|
||||
this, [ this, groupItem ]( bool toggled )
|
||||
this, [ this ]( bool toggled )
|
||||
{
|
||||
m_data->groupItemsChecked += toggled ? 1 : -1;
|
||||
updated();
|
||||
|
|
|
|||
|
|
@ -131,3 +131,5 @@ QSizeF QskCheckBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
|||
{
|
||||
return skinnable->strutSizeHint( QskCheckBox::Panel );
|
||||
}
|
||||
|
||||
#include "moc_QskCheckBoxSkinlet.cpp"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class QSK_EXPORT QskCheckBoxSkinlet : public QskSkinlet
|
|||
{
|
||||
PanelRole,
|
||||
IndicatorRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskCheckBoxSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -378,6 +378,11 @@ void QskControl::setPlacementPolicy( QskPlacementPolicy policy )
|
|||
}
|
||||
}
|
||||
|
||||
void QskControl::resetPlacementPolicy()
|
||||
{
|
||||
setPlacementPolicy( QskPlacementPolicy() );
|
||||
}
|
||||
|
||||
QskPlacementPolicy QskControl::placementPolicy() const
|
||||
{
|
||||
Q_D( const QskControl );
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable
|
|||
WRITE setBackground RESET resetBackground NOTIFY backgroundChanged )
|
||||
|
||||
Q_PROPERTY( QskSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy )
|
||||
Q_PROPERTY( QskPlacementPolicy placementPolicy READ placementPolicy WRITE setPlacementPolicy )
|
||||
Q_PROPERTY( QskPlacementPolicy placementPolicy READ placementPolicy
|
||||
WRITE setPlacementPolicy RESET resetPlacementPolicy )
|
||||
|
||||
Q_PROPERTY( QSizeF minimumSize READ minimumSize WRITE setMinimumSize )
|
||||
Q_PROPERTY( QSizeF maximumSize READ maximumSize WRITE setMaximumSize )
|
||||
|
|
@ -117,6 +118,7 @@ class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable
|
|||
void setPlacementPolicy( QskPlacementPolicy );
|
||||
void setPlacementPolicy( QskPlacementPolicy::Policy, QskPlacementPolicy::Policy );
|
||||
void setPlacementPolicy( Qsk::Visibilities, QskPlacementPolicy::Policy );
|
||||
void resetPlacementPolicy();
|
||||
|
||||
QskPlacementPolicy placementPolicy() const;
|
||||
QskPlacementPolicy::Policy placementPolicy( Qsk::Visibility ) const;
|
||||
|
|
|
|||
|
|
@ -76,11 +76,7 @@ QPointF qskHoverPosition( const QHoverEvent* event )
|
|||
|
||||
QPointF qskWheelPosition( const QWheelEvent* event )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
return event->position();
|
||||
#else
|
||||
return event->posF();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ class QSK_EXPORT QskGeometryChangeEvent : public QskEvent
|
|||
QSK_EVENT_DISABLE_COPY( QskGeometryChangeEvent )
|
||||
|
||||
private:
|
||||
const QRectF m_rect;
|
||||
const QRectF m_oldRect;
|
||||
QRectF m_rect;
|
||||
QRectF m_oldRect;
|
||||
};
|
||||
|
||||
class QSK_EXPORT QskWindowChangeEvent : public QskEvent
|
||||
|
|
@ -98,8 +98,8 @@ class QSK_EXPORT QskWindowChangeEvent : public QskEvent
|
|||
QSK_EVENT_DISABLE_COPY( QskWindowChangeEvent )
|
||||
|
||||
private:
|
||||
QQuickWindow* const m_oldWindow;
|
||||
QQuickWindow* const m_window;
|
||||
QQuickWindow* m_oldWindow;
|
||||
QQuickWindow* m_window;
|
||||
};
|
||||
|
||||
class QSK_EXPORT QskPopupEvent : public QskEvent
|
||||
|
|
@ -115,7 +115,7 @@ class QSK_EXPORT QskPopupEvent : public QskEvent
|
|||
QSK_EVENT_DISABLE_COPY( QskPopupEvent )
|
||||
|
||||
private:
|
||||
QskPopup* const m_popup;
|
||||
QskPopup* m_popup;
|
||||
};
|
||||
|
||||
class QSK_EXPORT QskGestureEvent : public QskEvent
|
||||
|
|
@ -154,8 +154,8 @@ class QSK_EXPORT QskAnimatorEvent : public QskEvent
|
|||
QSK_EVENT_DISABLE_COPY( QskAnimatorEvent )
|
||||
|
||||
private:
|
||||
const QskAspect m_aspect;
|
||||
const State m_state;
|
||||
QskAspect m_aspect;
|
||||
State m_state;
|
||||
};
|
||||
|
||||
QSK_EXPORT int qskFocusChainIncrement( const QEvent* );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class QSK_EXPORT QskFocusIndicatorSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
FrameRole
|
||||
FrameRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskFocusIndicatorSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ class QSK_EXPORT QskGraphicLabelSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole, GraphicRole
|
||||
PanelRole,
|
||||
GraphicRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskGraphicLabelSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@ class QSK_EXPORT QskListViewSkinlet : public QskScrollViewSkinlet
|
|||
using Inherited = QskScrollViewSkinlet;
|
||||
|
||||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
TextRole,
|
||||
GraphicRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskListViewSkinlet( QskSkin* = nullptr );
|
||||
~QskListViewSkinlet() override;
|
||||
|
||||
|
|
@ -30,12 +38,6 @@ class QSK_EXPORT QskListViewSkinlet : public QskScrollViewSkinlet
|
|||
Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
protected:
|
||||
enum NodeRole
|
||||
{
|
||||
TextRole,
|
||||
GraphicRole
|
||||
};
|
||||
|
||||
QSGNode* updateContentsNode(
|
||||
const QskScrollView*, QSGNode* ) const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,24 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskMenu.h"
|
||||
|
||||
#include <QskGraphicProvider.h>
|
||||
#include <QskTextOptions.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskSkinlet.h>
|
||||
#include <QskEvent.h>
|
||||
#include <QskPlatform.h>
|
||||
#include "QskGraphicProvider.h"
|
||||
#include "QskTextOptions.h"
|
||||
#include "QskGraphic.h"
|
||||
#include "QskColorFilter.h"
|
||||
#include "QskSkinlet.h"
|
||||
#include "QskEvent.h"
|
||||
#include "QskPlatform.h"
|
||||
|
||||
#include <qvector.h>
|
||||
#include <qvariant.h>
|
||||
#include <qeventloop.h>
|
||||
|
||||
QSK_SUBCONTROL( QskMenu, Panel )
|
||||
QSK_SUBCONTROL( QskMenu, Cell )
|
||||
QSK_SUBCONTROL( QskMenu, Segment )
|
||||
QSK_SUBCONTROL( QskMenu, Cursor )
|
||||
QSK_SUBCONTROL( QskMenu, Text )
|
||||
QSK_SUBCONTROL( QskMenu, Graphic )
|
||||
|
|
@ -30,8 +35,11 @@ namespace
|
|||
: graphicSource( graphicSource )
|
||||
, text( text )
|
||||
{
|
||||
#if 1
|
||||
// lazy loading TODO ...
|
||||
if( !graphicSource.isEmpty() )
|
||||
graphic = Qsk::loadGraphic( graphicSource );
|
||||
#endif
|
||||
}
|
||||
|
||||
QUrl graphicSource;
|
||||
|
|
@ -287,19 +295,16 @@ void QskMenu::traverse( int steps )
|
|||
if ( newIndex < 0 )
|
||||
newIndex += count();
|
||||
|
||||
if ( hasAnimationHint( Cursor | QskAspect::Position | QskAspect::Metric ) )
|
||||
{
|
||||
// when cycling we want slide in
|
||||
// when cycling we want slide in
|
||||
|
||||
if ( index < 0 )
|
||||
setPositionHint( Cursor, count() );
|
||||
int startIndex = m_data->currentIndex;
|
||||
|
||||
if ( index >= count() )
|
||||
setPositionHint( Cursor, -1 );
|
||||
|
||||
movePositionHint( Cursor, newIndex );
|
||||
}
|
||||
if ( index < 0 )
|
||||
startIndex = count();
|
||||
else if ( index >= count() )
|
||||
startIndex = -1;
|
||||
|
||||
movePositionHint( Cursor, startIndex, newIndex );
|
||||
setCurrentIndex( newIndex );
|
||||
}
|
||||
|
||||
|
|
@ -374,13 +379,13 @@ void QskMenu::setSelectedIndex( int index )
|
|||
QRectF QskMenu::cellRect( int index ) const
|
||||
{
|
||||
return effectiveSkinlet()->sampleRect(
|
||||
this, contentsRect(), QskMenu::Cell, index );
|
||||
this, contentsRect(), QskMenu::Segment, index );
|
||||
}
|
||||
|
||||
int QskMenu::indexAtPosition( const QPointF& pos ) const
|
||||
{
|
||||
return effectiveSkinlet()->sampleIndexAt(
|
||||
this, contentsRect(), QskMenu::Cell, pos );
|
||||
this, contentsRect(), QskMenu::Segment, pos );
|
||||
}
|
||||
|
||||
int QskMenu::exec()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class QSK_EXPORT QskMenu : public QskPopup
|
|||
using Inherited = QskPopup;
|
||||
|
||||
public:
|
||||
QSK_SUBCONTROLS( Panel, Cell, Cursor, Text, Graphic, Separator )
|
||||
QSK_SUBCONTROLS( Panel, Segment, Cursor, Text, Graphic, Separator )
|
||||
QSK_STATES( Selected )
|
||||
|
||||
QskMenu( QQuickItem* parentItem = nullptr );
|
||||
|
|
@ -45,7 +45,7 @@ class QSK_EXPORT QskMenu : public QskPopup
|
|||
void setOrigin( const QPointF& );
|
||||
QPointF origin() const;
|
||||
|
||||
void setTextOptions( const QskTextOptions& textOptions );
|
||||
void setTextOptions( const QskTextOptions& );
|
||||
QskTextOptions textOptions() const;
|
||||
|
||||
// insert, remove, functors, actions, QskGraphic ...
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskMenuSkinlet.h"
|
||||
#include "QskMenu.h"
|
||||
|
||||
#include <QskBoxNode.h>
|
||||
#include <QskGraphic.h>
|
||||
#include <QskColorFilter.h>
|
||||
#include <QskGraphicNode.h>
|
||||
#include <QskTextNode.h>
|
||||
#include <QskTextOptions.h>
|
||||
#include <QskSGNode.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskSkinStateChanger.h>
|
||||
#include <QskMargins.h>
|
||||
#include <QskFunctions.h>
|
||||
#include "QskBoxNode.h"
|
||||
#include "QskGraphic.h"
|
||||
#include "QskColorFilter.h"
|
||||
#include "QskGraphicNode.h"
|
||||
#include "QskTextNode.h"
|
||||
#include "QskTextOptions.h"
|
||||
#include "QskSGNode.h"
|
||||
#include "QskFunctions.h"
|
||||
#include "QskMargins.h"
|
||||
#include "QskFunctions.h"
|
||||
|
||||
#include <qfontmetrics.h>
|
||||
#include <qmath.h>
|
||||
|
|
@ -60,7 +64,7 @@ class QskMenuSkinlet::PrivateData
|
|||
void enableCache( bool on )
|
||||
{
|
||||
m_isCaching = on;
|
||||
m_cellHeight = m_cellWidth = m_graphicWidth = m_textWidth = -1.0;
|
||||
m_segmentHeight = m_segmentWidth = m_graphicWidth = m_textWidth = -1.0;
|
||||
}
|
||||
|
||||
inline int separatorsBefore( const QskMenu* menu, int index ) const
|
||||
|
|
@ -101,30 +105,30 @@ class QskMenuSkinlet::PrivateData
|
|||
return textWidthInternal( menu );
|
||||
}
|
||||
|
||||
inline qreal cellWidth( const QskMenu* menu ) const
|
||||
inline qreal segmentWidth( const QskMenu* menu ) const
|
||||
{
|
||||
if ( m_isCaching )
|
||||
{
|
||||
if ( m_cellWidth < 0.0 )
|
||||
m_cellWidth = cellWidthInternal( menu );
|
||||
if ( m_segmentWidth < 0.0 )
|
||||
m_segmentWidth = segmentWidthInternal( menu );
|
||||
|
||||
return m_cellWidth;
|
||||
return m_segmentWidth;
|
||||
}
|
||||
|
||||
return cellWidthInternal( menu );
|
||||
return segmentWidthInternal( menu );
|
||||
}
|
||||
|
||||
inline qreal cellHeight( const QskMenu* menu ) const
|
||||
inline qreal segmentHeight( const QskMenu* menu ) const
|
||||
{
|
||||
if ( m_isCaching )
|
||||
{
|
||||
if ( m_cellHeight < 0.0 )
|
||||
m_cellHeight = cellHeightInternal( menu );
|
||||
if ( m_segmentHeight < 0.0 )
|
||||
m_segmentHeight = segmentHeightInternal( menu );
|
||||
|
||||
return m_cellHeight;
|
||||
return m_segmentHeight;
|
||||
}
|
||||
|
||||
return cellHeightInternal( menu );
|
||||
return segmentHeightInternal( menu );
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -182,33 +186,33 @@ class QskMenuSkinlet::PrivateData
|
|||
return maxWidth;
|
||||
}
|
||||
|
||||
qreal cellWidthInternal( const QskMenu* menu ) const
|
||||
qreal segmentWidthInternal( const QskMenu* menu ) const
|
||||
{
|
||||
using Q = QskMenu;
|
||||
|
||||
const auto spacing = menu->spacingHint( Q::Cell );
|
||||
const auto padding = menu->paddingHint( Q::Cell );
|
||||
const auto spacing = menu->spacingHint( Q::Segment );
|
||||
const auto padding = menu->paddingHint( Q::Segment );
|
||||
|
||||
auto w = graphicWidth( menu ) + spacing + textWidth( menu );
|
||||
|
||||
w += padding.left() + padding.right();
|
||||
|
||||
const auto minWidth = menu->strutSizeHint( Q::Cell ).width();
|
||||
const auto minWidth = menu->strutSizeHint( Q::Segment ).width();
|
||||
return qMax( w, minWidth );
|
||||
}
|
||||
|
||||
qreal cellHeightInternal( const QskMenu* menu ) const
|
||||
qreal segmentHeightInternal( const QskMenu* menu ) const
|
||||
{
|
||||
using Q = QskMenu;
|
||||
|
||||
const auto graphicHeight = menu->strutSizeHint( Q::Graphic ).height();
|
||||
const auto textHeight = menu->effectiveFontHeight( Q::Text );
|
||||
const auto padding = menu->paddingHint( Q::Cell );
|
||||
const auto padding = menu->paddingHint( Q::Segment );
|
||||
|
||||
qreal h = qMax( graphicHeight, textHeight );
|
||||
h += padding.top() + padding.bottom();
|
||||
|
||||
const auto minHeight = menu->strutSizeHint( Q::Cell ).height();
|
||||
const auto minHeight = menu->strutSizeHint( Q::Segment ).height();
|
||||
h = qMax( h, minHeight );
|
||||
|
||||
return h;
|
||||
|
|
@ -218,8 +222,8 @@ class QskMenuSkinlet::PrivateData
|
|||
|
||||
mutable qreal m_graphicWidth = -1.0;
|
||||
mutable qreal m_textWidth = -1.0;
|
||||
mutable qreal m_cellHeight = -1.0;
|
||||
mutable qreal m_cellWidth = -1.0;
|
||||
mutable qreal m_segmentHeight = -1.0;
|
||||
mutable qreal m_segmentWidth = -1.0;
|
||||
};
|
||||
|
||||
QskMenuSkinlet::QskMenuSkinlet( QskSkin* skin )
|
||||
|
|
@ -234,10 +238,10 @@ QskMenuSkinlet::~QskMenuSkinlet() = default;
|
|||
QRectF QskMenuSkinlet::cursorRect(
|
||||
const QskSkinnable* skinnable, const QRectF& contentsRect, int index ) const
|
||||
{
|
||||
const auto count = sampleCount( skinnable, QskMenu::Cell );
|
||||
const auto count = sampleCount( skinnable, QskMenu::Segment );
|
||||
|
||||
auto rect = sampleRect( skinnable, contentsRect,
|
||||
QskMenu::Cell, qBound( 0, index, count ) );
|
||||
QskMenu::Segment, qBound( 0, index, count ) );
|
||||
|
||||
if ( index < 0 )
|
||||
rect.setBottom( rect.top() );
|
||||
|
|
@ -295,11 +299,11 @@ QRectF QskMenuSkinlet::sampleRect(
|
|||
|
||||
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||
|
||||
if ( subControl == Q::Cell )
|
||||
if ( subControl == Q::Segment )
|
||||
{
|
||||
const auto r = menu->subControlContentsRect( Q::Panel );
|
||||
|
||||
auto h = m_data->cellHeight( menu );
|
||||
auto h = m_data->segmentHeight( menu );
|
||||
|
||||
if ( int n = m_data->separatorsBefore( menu, index ) )
|
||||
{
|
||||
|
|
@ -314,7 +318,7 @@ QRectF QskMenuSkinlet::sampleRect(
|
|||
|
||||
if ( subControl == QskMenu::Graphic || subControl == QskMenu::Text )
|
||||
{
|
||||
const auto r = sampleRect( menu, contentsRect, Q::Cell, index );
|
||||
const auto r = sampleRect( menu, contentsRect, Q::Segment, index );
|
||||
const auto graphicWidth = m_data->graphicWidth( menu );
|
||||
|
||||
if ( subControl == QskMenu::Graphic )
|
||||
|
|
@ -330,7 +334,7 @@ QRectF QskMenuSkinlet::sampleRect(
|
|||
|
||||
if ( graphicWidth > 0.0 )
|
||||
{
|
||||
const auto spacing = skinnable->spacingHint( Q::Cell );
|
||||
const auto spacing = skinnable->spacingHint( Q::Segment );
|
||||
textRect.setX( r.x() + graphicWidth + spacing );
|
||||
}
|
||||
|
||||
|
|
@ -348,8 +352,8 @@ QRectF QskMenuSkinlet::sampleRect(
|
|||
|
||||
if ( pos < menu->count() )
|
||||
{
|
||||
const auto cellRect = sampleRect( skinnable, contentsRect, Q::Cell, pos );
|
||||
r.setBottom( cellRect.top() ); // spacing ???
|
||||
const auto segmentRect = sampleRect( skinnable, contentsRect, Q::Segment, pos );
|
||||
r.setBottom( segmentRect.top() ); // spacing ???
|
||||
}
|
||||
|
||||
const qreal h = menu->metric( Q::Separator | QskAspect::Size );
|
||||
|
|
@ -375,7 +379,7 @@ int QskMenuSkinlet::sampleCount(
|
|||
{
|
||||
using Q = QskMenu;
|
||||
|
||||
if ( subControl == Q::Cell || subControl == Q::Graphic || subControl == Q::Text )
|
||||
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
|
||||
{
|
||||
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||
return menu->count();
|
||||
|
|
@ -397,7 +401,7 @@ QskAspect::States QskMenuSkinlet::sampleStates(
|
|||
|
||||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
||||
|
||||
if ( subControl == Q::Cell || subControl == Q::Graphic || subControl == Q::Text )
|
||||
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
|
||||
{
|
||||
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||
if ( menu->currentIndex() == index )
|
||||
|
|
@ -433,8 +437,8 @@ QSGNode* QskMenuSkinlet::updateContentsNode(
|
|||
QSGNode* QskMenuSkinlet::updateMenuNode(
|
||||
const QskSkinnable* skinnable, QSGNode* contentsNode ) const
|
||||
{
|
||||
enum { Panel, Cell, Cursor, Graphic, Text, Separator };
|
||||
static QVector< quint8 > roles = { Panel, Separator, Cell, Cursor, Graphic, Text };
|
||||
enum { Panel, Segment, Cursor, Graphic, Text, Separator };
|
||||
static QVector< quint8 > roles = { Panel, Separator, Segment, Cursor, Graphic, Text };
|
||||
|
||||
if ( contentsNode == nullptr )
|
||||
contentsNode = new QSGNode();
|
||||
|
|
@ -452,9 +456,9 @@ QSGNode* QskMenuSkinlet::updateMenuNode(
|
|||
newNode = updateBoxNode( skinnable, oldNode, QskMenu::Panel );
|
||||
break;
|
||||
}
|
||||
case Cell:
|
||||
case Segment:
|
||||
{
|
||||
newNode = updateSeriesNode( skinnable, QskMenu::Cell, oldNode );
|
||||
newNode = updateSeriesNode( skinnable, QskMenu::Segment, oldNode );
|
||||
break;
|
||||
}
|
||||
case Cursor:
|
||||
|
|
@ -494,7 +498,7 @@ QSGNode* QskMenuSkinlet::updateSampleNode( const QskSkinnable* skinnable,
|
|||
|
||||
const auto rect = sampleRect( menu, menu->contentsRect(), subControl, index );
|
||||
|
||||
if ( subControl == Q::Cell )
|
||||
if ( subControl == Q::Segment )
|
||||
{
|
||||
return updateBoxNode( menu, node, rect, subControl );
|
||||
}
|
||||
|
|
@ -522,7 +526,7 @@ QSGNode* QskMenuSkinlet::updateSampleNode( const QskSkinnable* skinnable,
|
|||
subControl, Qt::AlignVCenter | Qt::AlignLeft );
|
||||
|
||||
return QskSkinlet::updateTextNode( menu, node, rect, alignment,
|
||||
text, QskTextOptions(), Q::Text );
|
||||
text, menu->textOptions(), Q::Text );
|
||||
}
|
||||
|
||||
if ( subControl == Q::Separator )
|
||||
|
|
@ -547,10 +551,10 @@ QSizeF QskMenuSkinlet::sizeHint( const QskSkinnable* skinnable,
|
|||
qreal w = 0.0;
|
||||
qreal h = 0.0;
|
||||
|
||||
if ( const auto count = sampleCount( skinnable, Q::Cell ) )
|
||||
if ( const auto count = sampleCount( skinnable, Q::Segment ) )
|
||||
{
|
||||
w = m_data->cellWidth( menu );
|
||||
h = count * m_data->cellHeight( menu );
|
||||
w = m_data->segmentWidth( menu );
|
||||
h = count * m_data->segmentHeight( menu );
|
||||
}
|
||||
|
||||
if ( const auto count = sampleCount( skinnable, Q::Separator ) )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
#pragma once
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include <QskPopupSkinlet.h>
|
||||
#ifndef QSK_MENU_SKINLET_H
|
||||
#define QSK_MENU_SKINLET_H
|
||||
|
||||
#include "QskPopupSkinlet.h"
|
||||
#include <memory>
|
||||
|
||||
class QskMenu;
|
||||
|
|
@ -54,3 +60,5 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet
|
|||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class QSK_EXPORT QskPageIndicatorSkinlet : public QskSkinlet
|
|||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
BulletsRole
|
||||
BulletsRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskPageIndicatorSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class QSK_EXPORT QskProgressBarSkinlet : public QskSkinlet
|
|||
GrooveRole,
|
||||
BarRole,
|
||||
|
||||
RoleCount,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskProgressBarSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
|
|||
{
|
||||
PanelRole,
|
||||
TextRole,
|
||||
GraphicRole
|
||||
GraphicRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskPushButtonSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,476 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskSegmentedBar.h"
|
||||
|
||||
#include "QskGraphic.h"
|
||||
#include "QskGraphicProvider.h"
|
||||
#include "QskTextOptions.h"
|
||||
#include "QskEvent.h"
|
||||
#include "QskSkinlet.h"
|
||||
#include "QskAspect.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QStyleHints>
|
||||
#include <QFontMetricsF>
|
||||
|
||||
QSK_SUBCONTROL( QskSegmentedBar, Panel )
|
||||
QSK_SUBCONTROL( QskSegmentedBar, Segment )
|
||||
QSK_SUBCONTROL( QskSegmentedBar, Cursor )
|
||||
QSK_SUBCONTROL( QskSegmentedBar, Text )
|
||||
QSK_SUBCONTROL( QskSegmentedBar, Graphic )
|
||||
|
||||
QSK_SYSTEM_STATE( QskSegmentedBar, Selected, QskAspect::FirstSystemState << 2 )
|
||||
|
||||
namespace
|
||||
{
|
||||
class Option
|
||||
{
|
||||
public:
|
||||
Option() = default;
|
||||
|
||||
Option( const QUrl& graphicSource, const QString& text )
|
||||
: graphicSource( graphicSource )
|
||||
, text( text )
|
||||
{
|
||||
#if 1
|
||||
// lazy loading TODO ...
|
||||
if ( !graphicSource.isEmpty() )
|
||||
graphic = Qsk::loadGraphic( graphicSource );
|
||||
#endif
|
||||
}
|
||||
|
||||
QUrl graphicSource;
|
||||
QString text;
|
||||
|
||||
QskGraphic graphic;
|
||||
|
||||
bool isEnabled = true;
|
||||
};
|
||||
}
|
||||
|
||||
class QskSegmentedBar::PrivateData
|
||||
{
|
||||
public:
|
||||
PrivateData( Qt::Orientation orientation )
|
||||
: orientation( orientation )
|
||||
{
|
||||
textOptions.setElideMode( Qt::ElideMiddle );
|
||||
}
|
||||
|
||||
void addOption( QskSegmentedBar* bar, const Option& option )
|
||||
{
|
||||
this->options += option;
|
||||
|
||||
bar->resetImplicitSize();
|
||||
bar->update();
|
||||
|
||||
Q_EMIT bar->countChanged();
|
||||
|
||||
if ( this->options.count() == 1 )
|
||||
bar->setSelectedIndex( 0 );
|
||||
}
|
||||
|
||||
QVector< Option > options;
|
||||
|
||||
QskTextOptions textOptions;
|
||||
|
||||
int selectedIndex = -1;
|
||||
int currentIndex = -1;
|
||||
|
||||
Qt::Orientation orientation;
|
||||
bool isPressed = false;
|
||||
};
|
||||
|
||||
QskSegmentedBar::QskSegmentedBar( QQuickItem* parent )
|
||||
: QskSegmentedBar( Qt::Horizontal, parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskSegmentedBar::QskSegmentedBar( Qt::Orientation orientation, QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData( orientation ) )
|
||||
{
|
||||
if( orientation == Qt::Horizontal )
|
||||
initSizePolicy( QskSizePolicy::MinimumExpanding, QskSizePolicy::Fixed );
|
||||
else
|
||||
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::MinimumExpanding );
|
||||
|
||||
setAcceptedMouseButtons( Qt::LeftButton );
|
||||
setWheelEnabled( true );
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
|
||||
connect( this, &QskSegmentedBar::currentIndexChanged,
|
||||
this, &QskControl::focusIndicatorRectChanged );
|
||||
}
|
||||
|
||||
QskSegmentedBar::~QskSegmentedBar()
|
||||
{
|
||||
}
|
||||
|
||||
void QskSegmentedBar::setOrientation( Qt::Orientation orientation )
|
||||
{
|
||||
if( orientation != m_data->orientation )
|
||||
{
|
||||
setSizePolicy( sizePolicy( Qt::Vertical ), sizePolicy( Qt::Horizontal ) );
|
||||
m_data->orientation = orientation;
|
||||
|
||||
resetImplicitSize();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
Qt::Orientation QskSegmentedBar::orientation() const
|
||||
{
|
||||
return m_data->orientation;
|
||||
}
|
||||
|
||||
void QskSegmentedBar::setTextOptions( const QskTextOptions& textOptions )
|
||||
{
|
||||
if( textOptions != m_data->textOptions )
|
||||
{
|
||||
m_data->textOptions = textOptions;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QskTextOptions QskSegmentedBar::textOptions() const
|
||||
{
|
||||
return m_data->textOptions;
|
||||
}
|
||||
|
||||
int QskSegmentedBar::addText( const QString& text )
|
||||
{
|
||||
m_data->addOption( this, Option( QUrl(), text ) );
|
||||
return count() - 1;
|
||||
}
|
||||
|
||||
int QskSegmentedBar::addGraphic( const QUrl& graphicSource )
|
||||
{
|
||||
m_data->addOption( this, Option( graphicSource, QString() ) );
|
||||
return count() - 1;
|
||||
}
|
||||
|
||||
QVariant QskSegmentedBar::optionAt( int index ) const
|
||||
{
|
||||
const auto& options = m_data->options;
|
||||
|
||||
if( index < 0 || index >= options.count() )
|
||||
return QVariantList();
|
||||
|
||||
const auto& option = options[ index ];
|
||||
|
||||
QVariant value;
|
||||
|
||||
if ( option.graphicSource.isValid() )
|
||||
value = QVariant::fromValue( option.graphic );
|
||||
else
|
||||
value = QVariant::fromValue( option.text );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
QskAspect::Placement QskSegmentedBar::effectivePlacement() const
|
||||
{
|
||||
return static_cast< QskAspect::Placement >( m_data->orientation );
|
||||
}
|
||||
|
||||
void QskSegmentedBar::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
const int index = indexAtPosition( event->localPos() );
|
||||
|
||||
if( index < 0 || index >= count() || !m_data->options[ index ].isEnabled )
|
||||
return;
|
||||
|
||||
m_data->isPressed = true;
|
||||
|
||||
if( ( focusPolicy() & Qt::ClickFocus ) == Qt::ClickFocus )
|
||||
{
|
||||
if( !QGuiApplication::styleHints()->setFocusOnTouchRelease() )
|
||||
{
|
||||
if( index != m_data->currentIndex )
|
||||
setCurrentIndex( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QskSegmentedBar::mouseReleaseEvent( QMouseEvent* event )
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
if( m_data->isPressed )
|
||||
{
|
||||
m_data->isPressed = false;
|
||||
index = indexAtPosition( event->localPos() );
|
||||
}
|
||||
|
||||
if( index < 0 || !m_data->options[ index ].isEnabled )
|
||||
return;
|
||||
|
||||
if( ( focusPolicy() & Qt::ClickFocus ) == Qt::ClickFocus )
|
||||
{
|
||||
if( QGuiApplication::styleHints()->setFocusOnTouchRelease() )
|
||||
{
|
||||
if( index != m_data->currentIndex )
|
||||
setCurrentIndex( index );
|
||||
}
|
||||
}
|
||||
|
||||
setSelectedIndex( index );
|
||||
}
|
||||
|
||||
void QskSegmentedBar::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
switch( event->key() )
|
||||
{
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
bool forwards;
|
||||
|
||||
if ( m_data->orientation == Qt::Vertical )
|
||||
forwards = ( event->key() == Qt::Key_Down );
|
||||
else
|
||||
forwards = ( event->key() == Qt::Key_Right );
|
||||
|
||||
const int index = nextIndex( m_data->selectedIndex, forwards );
|
||||
if ( index != m_data->selectedIndex )
|
||||
{
|
||||
if ( index >= 0 && index < count() )
|
||||
setSelectedIndex( index );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case Qt::Key_Select:
|
||||
case Qt::Key_Space:
|
||||
|
||||
// stop further processing
|
||||
return;
|
||||
|
||||
default:
|
||||
{
|
||||
const int steps = qskFocusChainIncrement( event );
|
||||
|
||||
if( steps != 0 )
|
||||
{
|
||||
const int index = nextIndex( m_data->currentIndex, steps > 0 );
|
||||
|
||||
if( index != m_data->currentIndex )
|
||||
setCurrentIndex( index );
|
||||
|
||||
if( index >= 0 )
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Inherited::keyPressEvent( event );
|
||||
}
|
||||
|
||||
void QskSegmentedBar::keyReleaseEvent( QKeyEvent* event )
|
||||
{
|
||||
if( event->key() == Qt::Key_Select || event->key() == Qt::Key_Space )
|
||||
{
|
||||
if( m_data->currentIndex >= 0 )
|
||||
setSelectedIndex( m_data->currentIndex );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Inherited::keyReleaseEvent( event );
|
||||
}
|
||||
|
||||
void QskSegmentedBar::focusInEvent( QFocusEvent* event )
|
||||
{
|
||||
int index = m_data->currentIndex;
|
||||
|
||||
switch( event->reason() )
|
||||
{
|
||||
case Qt::TabFocusReason:
|
||||
{
|
||||
index = nextIndex( -1, true );
|
||||
break;
|
||||
}
|
||||
|
||||
case Qt::BacktabFocusReason:
|
||||
{
|
||||
index = nextIndex( -1, false );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if( index < 0 || index >= count() )
|
||||
index = nextIndex( -1, true );
|
||||
}
|
||||
}
|
||||
|
||||
if( index != m_data->currentIndex )
|
||||
setCurrentIndex( index );
|
||||
|
||||
Inherited::focusInEvent( event );
|
||||
}
|
||||
|
||||
void QskSegmentedBar::clear()
|
||||
{
|
||||
if( count() == 0 )
|
||||
return;
|
||||
|
||||
m_data->options.clear();
|
||||
Q_EMIT countChanged();
|
||||
|
||||
if( m_data->selectedIndex >= 0 )
|
||||
{
|
||||
m_data->selectedIndex = -1;
|
||||
Q_EMIT selectedIndexChanged( m_data->selectedIndex );
|
||||
}
|
||||
|
||||
if( m_data->currentIndex >= 0 )
|
||||
{
|
||||
m_data->currentIndex = -1;
|
||||
Q_EMIT currentIndexChanged( m_data->currentIndex );
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QskSegmentedBar::setCurrentIndex( int index )
|
||||
{
|
||||
const auto& options = m_data->options;
|
||||
|
||||
if( ( index < 0 ) || ( index >= options.count() )
|
||||
|| !options[ index ].isEnabled )
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
if( index != m_data->currentIndex )
|
||||
{
|
||||
m_data->currentIndex = index;
|
||||
Q_EMIT currentIndexChanged( index );
|
||||
}
|
||||
}
|
||||
|
||||
int QskSegmentedBar::currentIndex() const
|
||||
{
|
||||
return m_data->currentIndex;
|
||||
}
|
||||
|
||||
void QskSegmentedBar::setSelectedIndex( int index )
|
||||
{
|
||||
if( index < 0 || index >= m_data->options.count() )
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
else if ( !m_data->options[ index ].isEnabled )
|
||||
{
|
||||
index = -1; // ???
|
||||
}
|
||||
|
||||
if( index != m_data->selectedIndex )
|
||||
{
|
||||
m_data->selectedIndex = index;
|
||||
|
||||
movePositionHint( Cursor, index );
|
||||
update();
|
||||
|
||||
Q_EMIT selectedIndexChanged( index );
|
||||
}
|
||||
}
|
||||
|
||||
int QskSegmentedBar::selectedIndex() const
|
||||
{
|
||||
return m_data->selectedIndex;
|
||||
}
|
||||
|
||||
int QskSegmentedBar::nextIndex( int index, bool forwards ) const
|
||||
{
|
||||
const auto& options = m_data->options;
|
||||
const int count = options.count();
|
||||
|
||||
if( forwards )
|
||||
{
|
||||
if( index < 0 || index >= count )
|
||||
index = -1;
|
||||
|
||||
while( ++index < count )
|
||||
{
|
||||
if( options[ index ].isEnabled )
|
||||
return index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( index < 0 || index >= count )
|
||||
index = count;
|
||||
|
||||
while( --index >= 0 )
|
||||
{
|
||||
if( options[ index ].isEnabled )
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int QskSegmentedBar::count() const
|
||||
{
|
||||
return m_data->options.count();
|
||||
}
|
||||
|
||||
void QskSegmentedBar::setSegmentEnabled( int index, bool enabled )
|
||||
{
|
||||
auto& options = m_data->options;
|
||||
|
||||
if( ( index < 0 ) || ( index >= options.count() )
|
||||
|| ( options[ index ].isEnabled == enabled ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
options[ index ].isEnabled = enabled;
|
||||
|
||||
if( !enabled )
|
||||
{
|
||||
if( m_data->currentIndex == index )
|
||||
setCurrentIndex( -1 );
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
bool QskSegmentedBar::isSegmentEnabled( int index ) const
|
||||
{
|
||||
const auto& options = m_data->options;
|
||||
|
||||
if( index < 0 || index >= options.count() )
|
||||
return false;
|
||||
|
||||
return options[ index ].isEnabled;
|
||||
}
|
||||
|
||||
int QskSegmentedBar::indexAtPosition( const QPointF& pos ) const
|
||||
{
|
||||
return effectiveSkinlet()->sampleIndexAt( this,
|
||||
contentsRect(), QskSegmentedBar::Segment, pos );
|
||||
}
|
||||
|
||||
QRectF QskSegmentedBar::focusIndicatorRect() const
|
||||
{
|
||||
if( m_data->currentIndex >= 0 )
|
||||
{
|
||||
return effectiveSkinlet()->sampleRect( this,
|
||||
contentsRect(), QskSegmentedBar::Segment, m_data->currentIndex );
|
||||
}
|
||||
|
||||
return Inherited::focusIndicatorRect();
|
||||
}
|
||||
|
||||
#include "moc_QskSegmentedBar.cpp"
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_SEGMENTED_BAR_H
|
||||
#define QSK_SEGMENTED_BAR_H
|
||||
|
||||
#include "QskControl.h"
|
||||
|
||||
#include <qurl.h>
|
||||
#include <qstring.h>
|
||||
|
||||
class QskTextOptions;
|
||||
class QskGraphic;
|
||||
|
||||
class QSK_EXPORT QskSegmentedBar : public QskControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( Qt::Orientation orientation READ orientation
|
||||
WRITE setOrientation NOTIFY orientationChanged )
|
||||
|
||||
Q_PROPERTY( int selectedIndex READ selectedIndex
|
||||
WRITE setSelectedIndex NOTIFY selectedIndexChanged USER true )
|
||||
|
||||
Q_PROPERTY( int currentIndex READ currentIndex
|
||||
WRITE setCurrentIndex NOTIFY currentIndexChanged )
|
||||
|
||||
Q_PROPERTY( int count READ count NOTIFY countChanged )
|
||||
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
QSK_SUBCONTROLS( Panel, Segment, Cursor, Text, Graphic )
|
||||
QSK_STATES( Selected )
|
||||
|
||||
QskSegmentedBar( QQuickItem* parent = nullptr );
|
||||
QskSegmentedBar( Qt::Orientation, QQuickItem* parent = nullptr );
|
||||
|
||||
~QskSegmentedBar() override;
|
||||
|
||||
void setOrientation( Qt::Orientation );
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
void setTextOptions( const QskTextOptions& );
|
||||
QskTextOptions textOptions() const;
|
||||
|
||||
int addText( const QString& );
|
||||
int addGraphic( const QUrl& );
|
||||
|
||||
void clear();
|
||||
|
||||
int selectedIndex() const;
|
||||
int currentIndex() const;
|
||||
|
||||
int count() const;
|
||||
|
||||
QVariant optionAt( int ) const;
|
||||
|
||||
void setSegmentEnabled( int, bool );
|
||||
bool isSegmentEnabled( int ) const;
|
||||
|
||||
int indexAtPosition( const QPointF& ) const;
|
||||
|
||||
QRectF focusIndicatorRect() const override final;
|
||||
QskAspect::Placement effectivePlacement() const override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setSelectedIndex( int index );
|
||||
void setCurrentIndex( int index );
|
||||
|
||||
Q_SIGNALS:
|
||||
void selectedIndexChanged( int );
|
||||
void currentIndexChanged( int );
|
||||
void countChanged();
|
||||
void orientationChanged();
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent( QMouseEvent* ) override;
|
||||
void mousePressEvent( QMouseEvent* ) override;
|
||||
|
||||
void keyPressEvent( QKeyEvent* ) override;
|
||||
void keyReleaseEvent( QKeyEvent* ) override;
|
||||
|
||||
void focusInEvent( QFocusEvent* ) override;
|
||||
|
||||
private:
|
||||
int nextIndex( int index, bool forward ) const;
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskSegmentedBarSkinlet.h"
|
||||
#include "QskSegmentedBar.h"
|
||||
|
||||
#include "QskGraphicNode.h"
|
||||
#include "QskGraphic.h"
|
||||
#include "QskColorFilter.h"
|
||||
#include "QskTextNode.h"
|
||||
#include "QskTextOptions.h"
|
||||
#include "QskSGNode.h"
|
||||
#include "QskFunctions.h"
|
||||
|
||||
#include <qfontmetrics.h>
|
||||
#include <qmath.h>
|
||||
|
||||
QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin )
|
||||
: Inherited( skin )
|
||||
{
|
||||
setNodeRoles( { PanelRole, SegmentRole, CursorRole, TextRole, GraphicRole } );
|
||||
}
|
||||
|
||||
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
|
||||
|
||||
QRectF QskSegmentedBarSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, const QRectF& contentsRect,
|
||||
QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
|
||||
if( subControl == Q::Panel )
|
||||
return contentsRect;
|
||||
|
||||
if( subControl == Q::Cursor )
|
||||
return cursorRect( bar, contentsRect );
|
||||
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QRectF QskSegmentedBarSkinlet::cursorRect(
|
||||
const QskSegmentedBar* bar, const QRectF& contentsRect ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
if( bar->selectedIndex() < 0 || bar->count() <= 0 )
|
||||
return QRectF();
|
||||
|
||||
auto rect = subControlRect( bar, contentsRect, Q::Panel );
|
||||
rect = bar->innerBox( Q::Panel, rect );
|
||||
|
||||
if( rect.isEmpty() )
|
||||
return QRectF();
|
||||
|
||||
// position is related to the index: 2.5 means
|
||||
// the cursor is between segment[2] and segment[3]
|
||||
|
||||
const qreal position = bar->positionHint( Q::Cursor );
|
||||
|
||||
const int index1 = qFloor( position );
|
||||
const int index2 = qCeil( position );
|
||||
|
||||
auto cursorRect = segmentRect( bar, contentsRect, index1 );
|
||||
if ( index1 != index2 )
|
||||
{
|
||||
const auto targetRect = segmentRect( bar, contentsRect, index2 );
|
||||
cursorRect = qskInterpolatedRect( cursorRect, targetRect, position - index1 );
|
||||
}
|
||||
|
||||
return cursorRect;
|
||||
}
|
||||
|
||||
QRectF QskSegmentedBarSkinlet::segmentRect(
|
||||
const QskSegmentedBar* bar, const QRectF& contentsRect, int index ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
const auto spacing = bar->spacingHint( Q::Panel );
|
||||
const auto count = bar->count();
|
||||
|
||||
auto rect = subControlRect( bar, contentsRect, Q::Panel );
|
||||
rect = bar->innerBox( Q::Panel, rect );
|
||||
|
||||
if( bar->orientation() == Qt::Horizontal )
|
||||
{
|
||||
const qreal w = ( rect.width() - ( count - 1 ) * spacing ) / count;
|
||||
|
||||
rect.setLeft( index * ( w + spacing ) );
|
||||
rect.setWidth( w );
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal h = ( rect.height() - ( count - 1 ) * spacing ) / count;
|
||||
|
||||
rect.setTop( index * ( h + spacing ) );
|
||||
rect.setHeight( h );
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
QSGNode* QskSegmentedBarSkinlet::updateSubNode(
|
||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
switch( nodeRole )
|
||||
{
|
||||
case PanelRole:
|
||||
return updateBoxNode( skinnable, node, Q::Panel );
|
||||
|
||||
case CursorRole:
|
||||
return updateBoxNode( skinnable, node, Q::Cursor );
|
||||
|
||||
case SegmentRole:
|
||||
return updateSeriesNode( skinnable, Q::Segment, node );
|
||||
|
||||
case TextRole:
|
||||
return updateSeriesNode( skinnable, Q::Text, node );
|
||||
|
||||
case GraphicRole:
|
||||
return updateSeriesNode( skinnable, Q::Graphic, node );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QSizeF QskSegmentedBarSkinlet::segmentSizeHint( const QskSegmentedBar* bar ) const
|
||||
{
|
||||
qreal widthMax = 0;
|
||||
qreal graphicRatioMax = 0;
|
||||
|
||||
const QFontMetricsF fm( bar->effectiveFont( QskSegmentedBar::Text ) );
|
||||
|
||||
for ( int i = 0; i < bar->count(); i++ )
|
||||
{
|
||||
const auto value = bar->optionAt( i );
|
||||
|
||||
if ( value.canConvert< QskGraphic >() )
|
||||
{
|
||||
const auto graphic = value.value< QskGraphic >();
|
||||
|
||||
if ( !graphic.isNull() )
|
||||
{
|
||||
const auto sz = graphic.defaultSize();
|
||||
|
||||
if( sz.isValid() )
|
||||
{
|
||||
const qreal ratio = sz.width() / sz.height();
|
||||
|
||||
if( graphicRatioMax < ratio )
|
||||
graphicRatioMax = ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( value.canConvert< QString >() )
|
||||
{
|
||||
const auto text = value.value< QString >();
|
||||
if ( !text.isEmpty() )
|
||||
{
|
||||
const auto sz = fm.size( Qt::TextShowMnemonic, text );
|
||||
|
||||
if( sz.width() > widthMax )
|
||||
widthMax = sz.width();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( graphicRatioMax > 0 )
|
||||
{
|
||||
const qreal w = fm.height() * graphicRatioMax;
|
||||
|
||||
if( w > widthMax )
|
||||
widthMax = w;
|
||||
}
|
||||
|
||||
return bar->outerBoxSize( QskSegmentedBar::Segment, QSizeF( widthMax, fm.height() ) );
|
||||
}
|
||||
|
||||
QSizeF QskSegmentedBarSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||
Qt::SizeHint which, const QSizeF& ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
if ( which != Qt::PreferredSize )
|
||||
return QSizeF();
|
||||
|
||||
const auto count = sampleCount( skinnable, Q::Segment );
|
||||
if( count == 0 )
|
||||
return QSizeF( 0, 0 );
|
||||
|
||||
qreal w = 0;
|
||||
qreal h = 0;
|
||||
|
||||
if ( count > 0 )
|
||||
{
|
||||
const qreal spacing = skinnable->spacingHint( Q::Panel );
|
||||
|
||||
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
const auto segmentSize = segmentSizeHint( bar );
|
||||
|
||||
if( bar->orientation() == Qt::Horizontal )
|
||||
{
|
||||
w = count * segmentSize.width() + ( count - 1 ) * spacing;
|
||||
h = segmentSize.height();
|
||||
}
|
||||
else
|
||||
{
|
||||
w = segmentSize.width();
|
||||
h = count * segmentSize.height() + ( count - 1 ) * spacing;
|
||||
}
|
||||
}
|
||||
|
||||
const auto hint = skinnable->outerBoxSize( Q::Panel, QSizeF( w, h ) );
|
||||
return hint.expandedTo( skinnable->strutSizeHint( Q::Panel ) );
|
||||
}
|
||||
|
||||
int QskSegmentedBarSkinlet::sampleCount(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol ) const
|
||||
{
|
||||
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
return bar->count();
|
||||
}
|
||||
|
||||
QRectF QskSegmentedBarSkinlet::sampleRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl, int index ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
if ( subControl == Q::Segment )
|
||||
{
|
||||
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
return segmentRect( bar, contentsRect, index );
|
||||
}
|
||||
|
||||
if ( subControl == Q::Text || subControl == Q::Graphic )
|
||||
{
|
||||
const auto rect = sampleRect( skinnable, contentsRect, Q::Segment, index );
|
||||
return skinnable->innerBox( Q::Segment, rect );
|
||||
}
|
||||
|
||||
return Inherited::sampleRect( skinnable, contentsRect, subControl, index );
|
||||
}
|
||||
|
||||
QskAspect::States QskSegmentedBarSkinlet::sampleStates(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl, int index ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
||||
|
||||
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
|
||||
{
|
||||
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
|
||||
if ( bar->isSegmentEnabled( index ) )
|
||||
{
|
||||
if ( bar->selectedIndex() == index )
|
||||
states |= Q::Selected;
|
||||
}
|
||||
else
|
||||
{
|
||||
states |= Q::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
return states;
|
||||
}
|
||||
|
||||
QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable,
|
||||
QskAspect::Subcontrol subControl, int index, QSGNode* node ) const
|
||||
{
|
||||
using Q = QskSegmentedBar;
|
||||
|
||||
auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||
|
||||
const auto rect = sampleRect( bar, bar->contentsRect(), subControl, index );
|
||||
|
||||
if ( subControl == Q::Segment )
|
||||
{
|
||||
return updateBoxNode( skinnable, node, rect, subControl );
|
||||
}
|
||||
|
||||
const auto alignment = bar->alignmentHint( subControl, Qt::AlignCenter );
|
||||
|
||||
if ( subControl == Q::Text )
|
||||
{
|
||||
const auto value = bar->optionAt( index );
|
||||
if ( value.canConvert< QString >() )
|
||||
{
|
||||
const auto text = value.value< QString >();
|
||||
|
||||
return QskSkinlet::updateTextNode( bar, node,
|
||||
rect, alignment, text, bar->textOptions(), Q::Text );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( subControl == Q::Graphic )
|
||||
{
|
||||
const auto value = bar->optionAt( index );
|
||||
if ( value.canConvert< QskGraphic >() )
|
||||
{
|
||||
const auto graphic = value.value< QskGraphic >();
|
||||
const auto filter = bar->effectiveGraphicFilter( subControl );
|
||||
|
||||
return QskSkinlet::updateGraphicNode(
|
||||
bar, node, graphic, filter, rect, alignment );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Inherited::updateSampleNode( skinnable, subControl, index, node );
|
||||
}
|
||||
|
||||
#include "moc_QskSegmentedBarSkinlet.cpp"
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_SEGMENTED_BAR_SKINLET_H
|
||||
#define QSK_SEGMENTED_BAR_SKINLET_H
|
||||
|
||||
#include "QskSkinlet.h"
|
||||
|
||||
class QskSegmentedBar;
|
||||
|
||||
class QSK_EXPORT QskSegmentedBarSkinlet : public QskSkinlet
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
using Inherited = QskSkinlet;
|
||||
|
||||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
SegmentRole,
|
||||
CursorRole,
|
||||
|
||||
TextRole,
|
||||
GraphicRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSegmentedBarSkinlet( QskSkin* = nullptr );
|
||||
~QskSegmentedBarSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*, const QRectF&,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
|
||||
QSizeF sizeHint( const QskSkinnable*,
|
||||
Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
int sampleCount( const QskSkinnable*, QskAspect::Subcontrol ) const override;
|
||||
|
||||
QRectF sampleRect( const QskSkinnable*,
|
||||
const QRectF&, QskAspect::Subcontrol, int index ) const override;
|
||||
|
||||
QskAspect::States sampleStates( const QskSkinnable*,
|
||||
QskAspect::Subcontrol, int index ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
QSGNode* updateSampleNode( const QskSkinnable*,
|
||||
QskAspect::Subcontrol, int index, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QSizeF segmentSizeHint( const QskSegmentedBar* ) const;
|
||||
|
||||
QRectF segmentRect( const QskSegmentedBar*, const QRectF&, int index ) const;
|
||||
QRectF cursorRect( const QskSegmentedBar*, const QRectF& ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -20,6 +20,7 @@ class QSK_EXPORT QskSeparatorSkinlet : public QskSkinlet
|
|||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSeparatorSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -44,18 +44,39 @@ QSK_QT_PRIVATE_END
|
|||
#include "QskMenu.h"
|
||||
#include "QskMenuSkinlet.h"
|
||||
|
||||
#include "QskPageIndicator.h"
|
||||
#include "QskPageIndicatorSkinlet.h"
|
||||
|
||||
#include "QskPopup.h"
|
||||
#include "QskPopupSkinlet.h"
|
||||
|
||||
#include "QskProgressBar.h"
|
||||
#include "QskProgressBarSkinlet.h"
|
||||
|
||||
#include "QskPushButton.h"
|
||||
#include "QskPushButtonSkinlet.h"
|
||||
|
||||
#include "QskScrollView.h"
|
||||
#include "QskScrollViewSkinlet.h"
|
||||
|
||||
#include "QskSegmentedBar.h"
|
||||
#include "QskSegmentedBarSkinlet.h"
|
||||
|
||||
#include "QskSeparator.h"
|
||||
#include "QskSeparatorSkinlet.h"
|
||||
|
||||
#include "QskSlider.h"
|
||||
#include "QskSliderSkinlet.h"
|
||||
|
||||
#include "QskSubWindow.h"
|
||||
#include "QskSubWindowSkinlet.h"
|
||||
|
||||
#include "QskSubWindowArea.h"
|
||||
#include "QskSubWindowAreaSkinlet.h"
|
||||
|
||||
#include "QskSwitchButton.h"
|
||||
#include "QskSwitchButtonSkinlet.h"
|
||||
|
||||
#include "QskTabButton.h"
|
||||
#include "QskTabButtonSkinlet.h"
|
||||
|
||||
|
|
@ -68,24 +89,6 @@ QSK_QT_PRIVATE_END
|
|||
#include "QskTextInput.h"
|
||||
#include "QskTextInputSkinlet.h"
|
||||
|
||||
#include "QskSeparator.h"
|
||||
#include "QskSeparatorSkinlet.h"
|
||||
|
||||
#include "QskSubWindow.h"
|
||||
#include "QskSubWindowSkinlet.h"
|
||||
|
||||
#include "QskSubWindowArea.h"
|
||||
#include "QskSubWindowAreaSkinlet.h"
|
||||
|
||||
#include "QskSwitchButton.h"
|
||||
#include "QskSwitchButtonSkinlet.h"
|
||||
|
||||
#include "QskPageIndicator.h"
|
||||
#include "QskPageIndicatorSkinlet.h"
|
||||
|
||||
#include "QskProgressBar.h"
|
||||
#include "QskProgressBarSkinlet.h"
|
||||
|
||||
#include "QskStatusIndicator.h"
|
||||
#include "QskStatusIndicatorSkinlet.h"
|
||||
|
||||
|
|
@ -155,6 +158,7 @@ QskSkin::QskSkin( QObject* parent )
|
|||
declareSkinlet< QskMenu, QskMenuSkinlet >();
|
||||
declareSkinlet< QskPushButton, QskPushButtonSkinlet >();
|
||||
declareSkinlet< QskScrollView, QskScrollViewSkinlet >();
|
||||
declareSkinlet< QskSegmentedBar, QskSegmentedBarSkinlet >();
|
||||
declareSkinlet< QskSeparator, QskSeparatorSkinlet >();
|
||||
declareSkinlet< QskSlider, QskSliderSkinlet >();
|
||||
declareSkinlet< QskStatusIndicator, QskStatusIndicatorSkinlet >();
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@ static inline QStringList qskSplitPath( const QString& s )
|
|||
{
|
||||
const auto separator = QDir::listSeparator();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
|
||||
return s.split( separator, Qt::SkipEmptyParts );
|
||||
#else
|
||||
return s.split( separator, QString::SkipEmptyParts );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ class QSK_EXPORT QskSliderSkinlet : public QskSkinlet
|
|||
PanelRole,
|
||||
GrooveRole,
|
||||
FillRole,
|
||||
HandleRole
|
||||
HandleRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSliderSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class QSK_EXPORT QskStatusIndicatorSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
GraphicRole
|
||||
GraphicRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskStatusIndicatorSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class QSK_EXPORT QskSubWindowAreaSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole
|
||||
PanelRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSubWindowAreaSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ class QSK_EXPORT QskSubWindowSkinlet : public QskPopupSkinlet
|
|||
PanelRole = QskPopupSkinlet::RoleCount,
|
||||
TitleBarRole,
|
||||
SymbolRole,
|
||||
TitleRole
|
||||
TitleRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSubWindowSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class QSK_EXPORT QskSwitchButtonSkinlet : public QskSkinlet
|
|||
GrooveRole,
|
||||
HandleRole,
|
||||
RippleRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskSwitchButtonSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
QSK_SUBCONTROL( QskTabBar, Panel )
|
||||
|
||||
static inline Qt::Orientation qskOrientation( int position )
|
||||
static inline Qt::Orientation qskOrientation( Qt::Edge edge )
|
||||
{
|
||||
if ( ( position == Qsk::Top ) || ( position == Qsk::Bottom ) )
|
||||
if ( ( edge == Qt::TopEdge ) || ( edge == Qt::BottomEdge ) )
|
||||
return Qt::Horizontal;
|
||||
else
|
||||
return Qt::Vertical;
|
||||
|
|
@ -250,8 +250,8 @@ namespace
|
|||
class QskTabBar::PrivateData
|
||||
{
|
||||
public:
|
||||
PrivateData( Qsk::Position position )
|
||||
: position( position )
|
||||
PrivateData( Qt::Edge edge )
|
||||
: edge( edge )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -274,21 +274,21 @@ class QskTabBar::PrivateData
|
|||
int currentIndex = -1;
|
||||
|
||||
QskTextOptions textOptions;
|
||||
uint position : 2;
|
||||
Qt::Edge edge;
|
||||
};
|
||||
|
||||
QskTabBar::QskTabBar( QQuickItem* parent )
|
||||
: QskTabBar( Qsk::Top, parent )
|
||||
: QskTabBar( Qt::TopEdge, parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskTabBar::QskTabBar( Qsk::Position position, QQuickItem* parent )
|
||||
QskTabBar::QskTabBar( Qt::Edge edge, QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData( position ) )
|
||||
, m_data( new PrivateData( edge ) )
|
||||
{
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
const auto orientation = qskOrientation( position );
|
||||
const auto orientation = qskOrientation( edge );
|
||||
|
||||
if ( orientation == Qt::Horizontal )
|
||||
initSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed );
|
||||
|
|
@ -310,14 +310,14 @@ QskTabBar::~QskTabBar()
|
|||
{
|
||||
}
|
||||
|
||||
void QskTabBar::setTabPosition( Qsk::Position position )
|
||||
void QskTabBar::setEdge( Qt::Edge edge )
|
||||
{
|
||||
if ( position == m_data->position )
|
||||
if ( edge == m_data->edge )
|
||||
return;
|
||||
|
||||
m_data->position = position;
|
||||
m_data->edge = edge;
|
||||
|
||||
const auto orientation = qskOrientation( position );
|
||||
const auto orientation = qskOrientation( edge );
|
||||
|
||||
if ( orientation != m_data->buttonBox->orientation() )
|
||||
{
|
||||
|
|
@ -334,17 +334,17 @@ void QskTabBar::setTabPosition( Qsk::Position position )
|
|||
for ( int i = 0; i < count(); i++ )
|
||||
buttonAt( i )->update();
|
||||
|
||||
Q_EMIT tabPositionChanged( position );
|
||||
Q_EMIT edgeChanged( edge );
|
||||
}
|
||||
|
||||
Qsk::Position QskTabBar::tabPosition() const
|
||||
Qt::Edge QskTabBar::edge() const
|
||||
{
|
||||
return static_cast< Qsk::Position >( m_data->position );
|
||||
return m_data->edge;
|
||||
}
|
||||
|
||||
Qt::Orientation QskTabBar::orientation() const
|
||||
{
|
||||
return qskOrientation( m_data->position );
|
||||
return qskOrientation( m_data->edge );
|
||||
}
|
||||
|
||||
void QskTabBar::setAutoScrollFocusedButton( bool on )
|
||||
|
|
@ -363,7 +363,7 @@ bool QskTabBar::autoScrollFocusButton() const
|
|||
|
||||
void QskTabBar::setAutoFitTabs( bool on )
|
||||
{
|
||||
const auto orientation = qskOrientation( m_data->position );
|
||||
const auto orientation = qskOrientation( m_data->edge );
|
||||
int policy = m_data->buttonBox->sizePolicy( orientation );
|
||||
|
||||
if ( ( policy & QskSizePolicy::GrowFlag ) != on )
|
||||
|
|
@ -682,18 +682,18 @@ QskAspect::Subcontrol QskTabBar::substitutedSubcontrol(
|
|||
|
||||
QskAspect::Placement QskTabBar::effectivePlacement() const
|
||||
{
|
||||
switch ( m_data->position )
|
||||
switch ( m_data->edge )
|
||||
{
|
||||
case Qsk::Left:
|
||||
case Qt::LeftEdge:
|
||||
return QskAspect::Left;
|
||||
|
||||
case Qsk::Right:
|
||||
case Qt::RightEdge:
|
||||
return QskAspect::Right;
|
||||
|
||||
case Qsk::Top:
|
||||
case Qt::TopEdge:
|
||||
return QskAspect::Top;
|
||||
|
||||
case Qsk::Bottom:
|
||||
case Qt::BottomEdge:
|
||||
return QskAspect::Bottom;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ class QSK_EXPORT QskTabBar : public QskBox
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( Qsk::Position tabPosition READ tabPosition
|
||||
WRITE setTabPosition NOTIFY tabPositionChanged FINAL )
|
||||
Q_PROPERTY( Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL )
|
||||
|
||||
Q_PROPERTY( Qt::Orientation orientation READ orientation )
|
||||
|
||||
|
|
@ -41,12 +40,12 @@ class QSK_EXPORT QskTabBar : public QskBox
|
|||
QSK_SUBCONTROLS( Panel )
|
||||
|
||||
QskTabBar( QQuickItem* parent = nullptr );
|
||||
QskTabBar( Qsk::Position, QQuickItem* parent = nullptr );
|
||||
QskTabBar( Qt::Edge, QQuickItem* parent = nullptr );
|
||||
|
||||
~QskTabBar() override;
|
||||
|
||||
void setTabPosition( Qsk::Position );
|
||||
Qsk::Position tabPosition() const;
|
||||
void setEdge( Qt::Edge );
|
||||
Qt::Edge edge() const;
|
||||
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
|
|
@ -98,7 +97,7 @@ class QSK_EXPORT QskTabBar : public QskBox
|
|||
void buttonClicked( int index );
|
||||
void countChanged( int );
|
||||
void textOptionsChanged( const QskTextOptions& );
|
||||
void tabPositionChanged( Qsk::Position );
|
||||
void edgeChanged( Qt::Edge );
|
||||
void autoScrollFocusedButtonChanged( bool );
|
||||
void autoFitTabsChanged( bool );
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class QSK_EXPORT QskTabButtonSkinlet : public QskSkinlet
|
|||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
TextRole
|
||||
TextRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskTabButtonSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -29,17 +29,12 @@ class QskTabView::PrivateData
|
|||
};
|
||||
|
||||
QskTabView::QskTabView( QQuickItem* parent )
|
||||
: QskTabView( Qsk::Top, parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskTabView::QskTabView( Qsk::Position tabPosition, QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
setPolishOnResize( true );
|
||||
|
||||
m_data->tabBar = new QskTabBar( tabPosition, this );
|
||||
m_data->tabBar = new QskTabBar( Qt::TopEdge, this );
|
||||
|
||||
m_data->stackBox = new QskStackBox( this );
|
||||
m_data->stackBox->setObjectName( QStringLiteral( "QskTabViewStackBox" ) );
|
||||
|
|
@ -67,8 +62,8 @@ QskTabView::QskTabView( Qsk::Position tabPosition, QQuickItem* parent )
|
|||
connect( m_data->tabBar, &QskTabBar::countChanged,
|
||||
this, &QskTabView::countChanged );
|
||||
|
||||
connect( m_data->tabBar, &QskTabBar::tabPositionChanged,
|
||||
this, &QskTabView::tabPositionChanged );
|
||||
connect( m_data->tabBar, &QskTabBar::edgeChanged,
|
||||
this, &QskTabView::tabBarEdgeChanged );
|
||||
|
||||
connect( m_data->tabBar, &QskTabBar::autoFitTabsChanged,
|
||||
this, &QskTabView::autoFitTabsChanged );
|
||||
|
|
@ -88,20 +83,14 @@ const QskTabBar* QskTabView::tabBar() const
|
|||
return m_data->tabBar;
|
||||
}
|
||||
|
||||
void QskTabView::setTabPosition( Qsk::Position position )
|
||||
void QskTabView::setTabBarEdge( Qt::Edge edge )
|
||||
{
|
||||
if ( position == tabPosition() )
|
||||
return;
|
||||
|
||||
m_data->tabBar->setTabPosition( position );
|
||||
|
||||
polish();
|
||||
update();
|
||||
m_data->tabBar->setEdge( edge );
|
||||
}
|
||||
|
||||
Qsk::Position QskTabView::tabPosition() const
|
||||
Qt::Edge QskTabView::tabBarEdge() const
|
||||
{
|
||||
return m_data->tabBar->tabPosition();
|
||||
return m_data->tabBar->edge();
|
||||
}
|
||||
|
||||
void QskTabView::setAutoFitTabs( bool on )
|
||||
|
|
@ -310,6 +299,7 @@ bool QskTabView::event( QEvent* event )
|
|||
{
|
||||
resetImplicitSize();
|
||||
polish();
|
||||
update();
|
||||
}
|
||||
|
||||
return Inherited::event( event );
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ class QSK_EXPORT QskTabView : public QskControl
|
|||
|
||||
Q_PROPERTY( QskTabBar* tabBar READ tabBar )
|
||||
|
||||
Q_PROPERTY( Qsk::Position tabPosition READ tabPosition
|
||||
WRITE setTabPosition NOTIFY tabPositionChanged FINAL )
|
||||
Q_PROPERTY( Qt::Edge tabBarEdge READ tabBarEdge
|
||||
WRITE setTabBarEdge NOTIFY tabBarEdgeChanged FINAL )
|
||||
|
||||
Q_PROPERTY( bool autoFitTabs READ autoFitTabs
|
||||
WRITE setAutoFitTabs NOTIFY autoFitTabsChanged FINAL )
|
||||
|
|
@ -37,15 +37,13 @@ class QSK_EXPORT QskTabView : public QskControl
|
|||
QSK_SUBCONTROLS( TabBar, Page )
|
||||
|
||||
QskTabView( QQuickItem* parent = nullptr );
|
||||
QskTabView( Qsk::Position tabPosition, QQuickItem* parent = nullptr );
|
||||
|
||||
~QskTabView() override;
|
||||
|
||||
const QskTabBar* tabBar() const;
|
||||
QskTabBar* tabBar();
|
||||
|
||||
void setTabPosition( Qsk::Position );
|
||||
Qsk::Position tabPosition() const;
|
||||
void setTabBarEdge( Qt::Edge );
|
||||
Qt::Edge tabBarEdge() const;
|
||||
|
||||
void setAutoFitTabs( bool );
|
||||
bool autoFitTabs() const;
|
||||
|
|
@ -83,7 +81,7 @@ class QSK_EXPORT QskTabView : public QskControl
|
|||
Q_SIGNALS:
|
||||
void currentIndexChanged( int index );
|
||||
void countChanged( int );
|
||||
void tabPositionChanged( Qsk::Position );
|
||||
void tabBarEdgeChanged( Qt::Edge );
|
||||
void autoFitTabsChanged( bool );
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -51,27 +51,27 @@ QSGNode* QskTabViewSkinlet::updateSubNode(
|
|||
QRectF QskTabViewSkinlet::pageRect(
|
||||
const QskTabView* tabView, const QRectF& rect ) const
|
||||
{
|
||||
const QRectF barRect = subControlRect( tabView, rect, QskTabView::TabBar );
|
||||
const auto barRect = subControlRect( tabView, rect, QskTabView::TabBar );
|
||||
|
||||
#if 1
|
||||
QRectF r = tabView->layoutRect();
|
||||
auto r = tabView->layoutRect();
|
||||
#endif
|
||||
|
||||
switch( tabView->tabPosition() )
|
||||
switch( tabView->tabBarEdge() )
|
||||
{
|
||||
case Qsk::Top:
|
||||
case Qt::TopEdge:
|
||||
r.setTop( barRect.bottom() );
|
||||
break;
|
||||
|
||||
case Qsk::Bottom:
|
||||
case Qt::BottomEdge:
|
||||
r.setBottom( barRect.top() );
|
||||
break;
|
||||
|
||||
case Qsk::Left:
|
||||
case Qt::LeftEdge:
|
||||
r.setLeft( barRect.right() );
|
||||
break;
|
||||
|
||||
case Qsk::Right:
|
||||
case Qt::RightEdge:
|
||||
r.setRight( barRect.left() );
|
||||
break;
|
||||
}
|
||||
|
|
@ -90,21 +90,21 @@ QRectF QskTabViewSkinlet::tabBarRect(
|
|||
QRectF r = tabView->layoutRect();
|
||||
#endif
|
||||
|
||||
switch( tabView->tabPosition() )
|
||||
switch( tabView->tabBarEdge() )
|
||||
{
|
||||
case Qsk::Top:
|
||||
case Qt::TopEdge:
|
||||
r.setHeight( barSize.height() );
|
||||
break;
|
||||
|
||||
case Qsk::Bottom:
|
||||
case Qt::BottomEdge:
|
||||
r.setTop( r.bottom() - barSize.height() );
|
||||
break;
|
||||
|
||||
case Qsk::Left:
|
||||
case Qt::LeftEdge:
|
||||
r.setWidth( barSize.width() );
|
||||
break;
|
||||
|
||||
case Qsk::Right:
|
||||
case Qt::RightEdge:
|
||||
r.setLeft( r.right() - barSize.width() );
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class QSK_EXPORT QskTabViewSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PageRole
|
||||
PageRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskTabViewSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class QSK_EXPORT QskTextInputSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole
|
||||
PanelRole,
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskTextInputSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ class QSK_EXPORT QskTextLabelSkinlet : public QskSkinlet
|
|||
public:
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole, TextRole
|
||||
PanelRole,
|
||||
TextRole,
|
||||
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskTextLabelSkinlet( QskSkin* = nullptr );
|
||||
|
|
|
|||
|
|
@ -781,8 +781,8 @@ QPixmap QskGraphic::toPixmap( qreal devicePixelRatio ) const
|
|||
|
||||
const QSizeF sz = defaultSize();
|
||||
|
||||
const int w = qCeil( sz.width() );
|
||||
const int h = qCeil( sz.height() );
|
||||
const int w = qCeil( sz.width() * devicePixelRatio );
|
||||
const int h = qCeil( sz.height() * devicePixelRatio );
|
||||
|
||||
QPixmap pixmap( w, h );
|
||||
pixmap.setDevicePixelRatio( devicePixelRatio );
|
||||
|
|
@ -803,7 +803,10 @@ QPixmap QskGraphic::toPixmap( const QSize& size,
|
|||
if ( devicePixelRatio <= 0.0 )
|
||||
devicePixelRatio = qskDevicePixelRatio();
|
||||
|
||||
QPixmap pixmap( size );
|
||||
const int w = qCeil( size.width() * devicePixelRatio );
|
||||
const int h = qCeil( size.height() * devicePixelRatio );
|
||||
|
||||
QPixmap pixmap( w, h );
|
||||
pixmap.setDevicePixelRatio( devicePixelRatio );
|
||||
pixmap.fill( Qt::transparent );
|
||||
|
||||
|
|
@ -822,7 +825,10 @@ QImage QskGraphic::toImage( const QSize& size,
|
|||
if ( devicePixelRatio <= 0.0 )
|
||||
devicePixelRatio = qskDevicePixelRatio();
|
||||
|
||||
QImage image( size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied );
|
||||
const int w = qCeil( size.width() * devicePixelRatio );
|
||||
const int h = qCeil( size.height() * devicePixelRatio );
|
||||
|
||||
QImage image( w, h, QImage::Format_ARGB32_Premultiplied );
|
||||
image.setDevicePixelRatio( devicePixelRatio );
|
||||
image.fill( 0 );
|
||||
|
||||
|
|
@ -845,8 +851,8 @@ QImage QskGraphic::toImage( qreal devicePixelRatio ) const
|
|||
|
||||
const QSizeF sz = defaultSize();
|
||||
|
||||
const int w = qCeil( sz.width() ) * devicePixelRatio;
|
||||
const int h = qCeil( sz.height() ) * devicePixelRatio;
|
||||
const int w = qCeil( sz.width() * devicePixelRatio );
|
||||
const int h = qCeil( sz.height() * devicePixelRatio );
|
||||
|
||||
QImage image( w, h, QImage::Format_ARGB32 );
|
||||
image.setDevicePixelRatio( devicePixelRatio );
|
||||
|
|
|
|||
|
|
@ -140,16 +140,9 @@ QPair< QString, QString > QskHunspellTextPredictor::affAndDicFile(
|
|||
|
||||
void QskHunspellTextPredictor::loadDictionaries()
|
||||
{
|
||||
const auto splitBehavior =
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
Qt::SkipEmptyParts;
|
||||
#else
|
||||
QString::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
const auto userPaths = QString::fromUtf8( qgetenv( "QSK_HUNSPELL_PATH" ) );
|
||||
|
||||
auto paths = userPaths.split( QDir::listSeparator(), splitBehavior );
|
||||
auto paths = userPaths.split( QDir::listSeparator(), Qt::SkipEmptyParts );
|
||||
|
||||
#if !defined( Q_OS_WIN32 )
|
||||
paths += QStringLiteral( "/usr/share/hunspell" );
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ namespace
|
|||
QRect m_grid;
|
||||
bool m_isSpacer;
|
||||
};
|
||||
|
||||
class ElementsVector : public std::vector< Element >
|
||||
{
|
||||
public:
|
||||
// to avoid warnings when assigning size_t to int
|
||||
inline int count() const { return static_cast< int >( size() ); }
|
||||
};
|
||||
}
|
||||
|
||||
Element::Element( QQuickItem* item, const QRect& grid )
|
||||
|
|
@ -304,8 +311,7 @@ class QskGridLayoutEngine::PrivateData
|
|||
public:
|
||||
inline Element* elementAt( int index ) const
|
||||
{
|
||||
const int count = this->elements.size();
|
||||
if ( index < 0 || index >= count )
|
||||
if ( index < 0 || index >= this->elements.count() )
|
||||
return nullptr;
|
||||
|
||||
return const_cast< Element* >( &this->elements[index] );
|
||||
|
|
@ -340,7 +346,7 @@ class QskGridLayoutEngine::PrivateData
|
|||
rowCount = qMax( rowCount, grid.bottom() + 1 );
|
||||
columnCount = qMax( columnCount, grid.right() + 1 );
|
||||
|
||||
return this->elements.size() - 1;
|
||||
return this->elements.count() - 1;
|
||||
}
|
||||
|
||||
QRect effectiveGrid( const Element& element ) const
|
||||
|
|
@ -363,7 +369,7 @@ class QskGridLayoutEngine::PrivateData
|
|||
? that->columnSettings : that->rowSettings;
|
||||
}
|
||||
|
||||
std::vector< Element > elements;
|
||||
ElementsVector elements;
|
||||
|
||||
Settings rowSettings;
|
||||
Settings columnSettings;
|
||||
|
|
@ -383,7 +389,7 @@ QskGridLayoutEngine::~QskGridLayoutEngine()
|
|||
|
||||
int QskGridLayoutEngine::count() const
|
||||
{
|
||||
return m_data->elements.size();
|
||||
return m_data->elements.count();
|
||||
}
|
||||
|
||||
bool QskGridLayoutEngine::setStretchFactor(
|
||||
|
|
@ -626,7 +632,7 @@ void QskGridLayoutEngine::setupChain( Qt::Orientation orientation,
|
|||
before adding those that occupy more than one cell
|
||||
*/
|
||||
QVarLengthArray< const Element* > postponed;
|
||||
postponed.reserve( m_data->elements.size() );
|
||||
postponed.reserve( m_data->elements.count() );
|
||||
|
||||
for ( const auto& element : m_data->elements )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ namespace
|
|||
int m_stretch = -1;
|
||||
bool m_isSpacer;
|
||||
};
|
||||
|
||||
class ElementsVector : public std::vector< Element >
|
||||
{
|
||||
public:
|
||||
// to avoid warnings when assigning size_t to int
|
||||
inline int count() const { return static_cast< int >( size() ); }
|
||||
};
|
||||
}
|
||||
|
||||
Element::Element( QQuickItem* item )
|
||||
|
|
@ -164,14 +171,13 @@ class QskLinearLayoutEngine::PrivateData
|
|||
|
||||
inline Element* elementAt( int index ) const
|
||||
{
|
||||
const int count = this->elements.size();
|
||||
if ( ( index < 0 ) || ( index >= count ) )
|
||||
if ( ( index < 0 ) || ( index >= this->elements.count() ) )
|
||||
return nullptr;
|
||||
|
||||
return const_cast< Element* >( &this->elements[index] );
|
||||
}
|
||||
|
||||
std::vector< Element > elements;
|
||||
ElementsVector elements;
|
||||
|
||||
uint dimension;
|
||||
|
||||
|
|
@ -230,7 +236,7 @@ uint QskLinearLayoutEngine::dimension() const
|
|||
|
||||
int QskLinearLayoutEngine::count() const
|
||||
{
|
||||
return m_data->elements.size();
|
||||
return m_data->elements.count();
|
||||
}
|
||||
|
||||
bool QskLinearLayoutEngine::setStretchFactorAt( int index, int stretchFactor )
|
||||
|
|
@ -266,7 +272,7 @@ int QskLinearLayoutEngine::insertItem( QQuickItem* item, int index )
|
|||
|
||||
if ( index < 0 || index > count() )
|
||||
{
|
||||
index = elements.size();
|
||||
index = elements.count();
|
||||
elements.emplace_back( item );
|
||||
}
|
||||
else
|
||||
|
|
@ -286,7 +292,7 @@ int QskLinearLayoutEngine::insertSpacerAt( int index, qreal spacing )
|
|||
|
||||
if ( index < 0 || index > count() )
|
||||
{
|
||||
index = elements.size();
|
||||
index = elements.count();
|
||||
elements.emplace_back( spacing );
|
||||
}
|
||||
else
|
||||
|
|
@ -416,7 +422,7 @@ int QskLinearLayoutEngine::effectiveCount() const
|
|||
}
|
||||
}
|
||||
|
||||
return m_data->elements.size() - m_data->sumIgnored;
|
||||
return m_data->elements.count() - m_data->sumIgnored;
|
||||
}
|
||||
|
||||
void QskLinearLayoutEngine::invalidateElementCache()
|
||||
|
|
|
|||
|
|
@ -138,8 +138,7 @@ void QskBoxNode::setBoxData( const QRectF& rect,
|
|||
{
|
||||
if ( isFillMonochrome && isBorderMonochrome )
|
||||
{
|
||||
if ( borderColors.gradient( Qsk::Left ).startColor()
|
||||
== fillGradient.startColor() )
|
||||
if ( borderColors.left().startColor() == fillGradient.startColor() )
|
||||
{
|
||||
// we can draw border and background in one
|
||||
hasBorder = false;
|
||||
|
|
@ -193,7 +192,7 @@ void QskBoxNode::setBoxData( const QRectF& rect,
|
|||
}
|
||||
else
|
||||
{
|
||||
flatMaterial->setColor( borderColors.gradient( Qsk::Left ).startColor().rgba() );
|
||||
flatMaterial->setColor( borderColors.left().startColor().rgba() );
|
||||
renderer.renderBorder( d->rect, shape, borderMetrics, *geometry() );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace
|
|||
|
||||
static inline QRgb qskRgbBorder( const QskBoxBorderColors& borderColors )
|
||||
{
|
||||
return qskRgbGradientStart( borderColors.gradient( Qsk::Left ) );
|
||||
return qskRgbGradientStart( borderColors.left() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1015,8 +1015,10 @@ static inline void qskRenderBorder( const QskBoxRenderer::Metrics& metrics,
|
|||
{
|
||||
const int stepCount = metrics.corner[ 0 ].stepCount;
|
||||
|
||||
auto left = c.gradient( Qsk::Left ), top = c.gradient( Qsk::Top ),
|
||||
right = c.gradient( Qsk::Right ), bottom = c.gradient( Qsk::Bottom );
|
||||
const auto& left = c.left();
|
||||
const auto& top = c.top();
|
||||
const auto& right = c.right();
|
||||
const auto& bottom = c.bottom();
|
||||
|
||||
qskRenderBorderLines( metrics, orientation, line,
|
||||
BorderMapGradient( stepCount, qskRgbGradientStart( top ), qskRgbGradientEnd( left ), left ),
|
||||
|
|
@ -1052,7 +1054,7 @@ static inline void qskRenderBoxRandom(
|
|||
|
||||
if ( bc.isMonochrome() )
|
||||
{
|
||||
const BorderMapSolid borderMap( qskRgbBorder( bc.gradient( Qsk::Left ) ) );
|
||||
const BorderMapSolid borderMap( qskRgbBorder( bc.left() ) );
|
||||
|
||||
if ( gradient.isMonochrome() )
|
||||
{
|
||||
|
|
@ -1071,8 +1073,10 @@ static inline void qskRenderBoxRandom(
|
|||
{
|
||||
const int n = metrics.corner[ 0 ].stepCount;
|
||||
|
||||
auto left = bc.gradient( Qsk::Left ), top = bc.gradient( Qsk::Top ),
|
||||
right = bc.gradient( Qsk::Right ), bottom = bc.gradient( Qsk::Bottom );
|
||||
const auto& left = bc.left();
|
||||
const auto& top = bc.top();
|
||||
const auto& right = bc.right();
|
||||
const auto& bottom = bc.bottom();
|
||||
|
||||
const BorderMapGradient tl( n, qskRgbGradientStart( top.startColor() ), qskRgbGradientEnd( left.endColor() ), left );
|
||||
const BorderMapGradient tr( n, qskRgbGradientStart( right ), qskRgbGradientEnd( top ), top );
|
||||
|
|
@ -1369,10 +1373,10 @@ void QskBoxRenderer::renderRectellipse( const QRectF& rect,
|
|||
borderLineCount = 4 * ( stepCount + 1 ) + 1;
|
||||
|
||||
const int additionalLines =
|
||||
additionalGradientStops( borderColors.gradient( Qsk::Left ) )
|
||||
+ additionalGradientStops( borderColors.gradient( Qsk::Top ) )
|
||||
+ additionalGradientStops( borderColors.gradient( Qsk::Right ) )
|
||||
+ additionalGradientStops( borderColors.gradient( Qsk::Bottom ) );
|
||||
additionalGradientStops( borderColors.left() )
|
||||
+ additionalGradientStops( borderColors.top() )
|
||||
+ additionalGradientStops( borderColors.right() )
|
||||
+ additionalGradientStops( borderColors.bottom() );
|
||||
|
||||
borderLineCount += additionalLines;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -422,10 +422,10 @@ static inline void qskCreateBorder(
|
|||
const QskBoxRenderer::Quad& out, const QskBoxRenderer::Quad& in,
|
||||
const QskBoxBorderColors& colors, Line* line )
|
||||
{
|
||||
const auto& gradientLeft = colors.gradient( Qsk::Left );
|
||||
const auto& gradientRight = colors.gradient( Qsk::Right );
|
||||
const auto& gradientTop = colors.gradient( Qsk::Top );
|
||||
const auto& gradientBottom = colors.gradient( Qsk::Bottom );
|
||||
const auto& gradientLeft = colors.left();
|
||||
const auto& gradientRight = colors.right();
|
||||
const auto& gradientTop = colors.top();
|
||||
const auto& gradientBottom = colors.bottom();
|
||||
|
||||
// qdebug
|
||||
|
||||
|
|
@ -571,10 +571,10 @@ void QskBoxRenderer::renderRect(
|
|||
// ### As an optimization we could check orientation and colors
|
||||
// to test whether colors are the same
|
||||
const int additionalLines = -1
|
||||
+ bc.gradient( Qsk::Left ).stops().count() - 1
|
||||
+ bc.gradient( Qsk::Top ).stops().count() - 1
|
||||
+ bc.gradient( Qsk::Right ).stops().count() - 1
|
||||
+ bc.gradient( Qsk::Bottom ).stops().count() - 1;
|
||||
+ bc.left().stops().count() - 1
|
||||
+ bc.top().stops().count() - 1
|
||||
+ bc.right().stops().count() - 1
|
||||
+ bc.bottom().stops().count() - 1;
|
||||
|
||||
borderLineCount += qMax( additionalLines, 0 );
|
||||
}
|
||||
|
|
@ -624,7 +624,7 @@ void QskBoxRenderer::renderRect(
|
|||
|
||||
if ( bc.isMonochrome() )
|
||||
{
|
||||
const auto rgb = bc.gradient( Qsk::Left ).startColor().rgba();
|
||||
const auto rgb = bc.left().startColor().rgba();
|
||||
qskCreateBorderMonochrome( rect, in, rgb, fillLines );
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -165,17 +165,12 @@ QSGTexture* QskTextureRenderer::textureFromId(
|
|||
texture = QNativeInterface::QSGOpenGLTexture::fromNative(
|
||||
textureId, window, size, flags );
|
||||
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
#else
|
||||
|
||||
const int nativeLayout = 0; // VkImageLayout in case of Vulkan
|
||||
|
||||
texture = window->createTextureFromNativeObject(
|
||||
QQuickWindow::NativeObjectTexture, &textureId, nativeLayout, size, flags );
|
||||
|
||||
#else
|
||||
|
||||
texture = window->createTextureFromId( textureId, size, flags );
|
||||
|
||||
#endif
|
||||
|
||||
return texture;
|
||||
|
|
|
|||
|
|
@ -179,6 +179,8 @@ HEADERS += \
|
|||
controls/QskScrollBox.h \
|
||||
controls/QskScrollView.h \
|
||||
controls/QskScrollViewSkinlet.h \
|
||||
controls/QskSegmentedBar.h \
|
||||
controls/QskSegmentedBarSkinlet.h \
|
||||
controls/QskSeparator.h \
|
||||
controls/QskSeparatorSkinlet.h \
|
||||
controls/QskSetup.h \
|
||||
|
|
@ -261,6 +263,8 @@ SOURCES += \
|
|||
controls/QskScrollBox.cpp \
|
||||
controls/QskScrollView.cpp \
|
||||
controls/QskScrollViewSkinlet.cpp \
|
||||
controls/QskSegmentedBar.cpp \
|
||||
controls/QskSegmentedBarSkinlet.cpp \
|
||||
controls/QskSeparator.cpp \
|
||||
controls/QskSeparatorSkinlet.cpp \
|
||||
controls/QskSetup.cpp \
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@
|
|||
|
||||
static void initFonts()
|
||||
{
|
||||
if ( !qobject_cast< QGuiApplication* >( qApp ) )
|
||||
return; // no fonts needed
|
||||
|
||||
#ifdef FONTCONFIG_FILE
|
||||
const char env[] = "FONTCONFIG_FILE";
|
||||
if ( !qEnvironmentVariableIsSet( env ) )
|
||||
|
|
|
|||
Loading…
Reference in New Issue