SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
Plasma Widgets




API and Theming approaches

       Marco Martin
What is a plasma widget?
●   KDE 4.0: everything from scratch
●   4.1/Qt4.4: QGraphicsWidget
●   Preferably a QGraphicsProxyWidget
    –   This means: every Qt widget you can imagine
●    Exception of container widgets, like
    TabWidgets and Frames
    –   We want to contain GraphicsWidgets and
        GraphicsLayouts here
Standard API: why wrap?
●   Normally you would do this:
  QPushButton *nativeButton = new QPushButton();
● QgraphicsProxyWidget *proxy = new QgraphicsProxyWidget(this);
  proxy->setWidget(nativeButton);
●   Very ugly code
●   And in scripting too, where we would want
    something better
●   Very scarce possibilities of theming
●   So every widget has its own subclass with a set
    of standard methods
What to wrap?
●   Most used functions
●   Makes the code simpler
●   In particular for scripted applets
●   Important functions
    –   setText() text() when the underlying widget has it
    –   setImage() getImage() aware of Plasma theme, so
        you can do setImage(“widgets/clock”)
Additional stuff
●   setStyleSheet()/styleSheet(): applet creators
    can easily tweak the widget appearance with
    standard Qt stylesheets
●   nativeWidget()
    –   ...when a basic api is not enough :)
    –   Not available in EcmaScript bindings to keep api
        clean
    –   Available in richer bindings like ruby
Theming
●   3 approaches
    –   Overriding the paint function of the proxywidget
         ●   Better graphics results (no clipping and float arithmetics)
         ●   Used for instance in Plasma::PushButton
    –   Subclass the QWidget and override paintEvent
         ●   When the widget is really complex and we need other
             stuff like a custom sizehint (and notification of its change)
         ●   Used in the tabbar
    –   Using a Kstyle: open possibility for scrollbars, easier
        to apply when they are only available children of
        other widgets (i.e. scrollviews)
What are themes?
●   QWidgets on canvas looks really out of place
●   A color scheme provided by Plasma::Theme
    and many svgs, described in
●   http://techbase.kde.org/Projects/Plasma/Theme
●   Svg element naming format used by the
    PanelSvg class
●   Useful to make more or less rectangular
    elements, so good for buttons, textboxes etc
Why not a single svg?
Example
●   9 element for each prefix, here the “normal”,
    pressed, active and the focus rect

Más contenido relacionado

La actualidad más candente

appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
endian7000
 

La actualidad más candente (12)

The Next Generation Qt Item Views
The Next Generation Qt Item ViewsThe Next Generation Qt Item Views
The Next Generation Qt Item Views
 
JS digest. January 2017
JS digest. January 2017JS digest. January 2017
JS digest. January 2017
 
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
Interactive  3D graphics for web with three.js, Andrey Vedilin, DataArtInteractive  3D graphics for web with three.js, Andrey Vedilin, DataArt
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
 
Lesson 08
Lesson 08Lesson 08
Lesson 08
 
Demistifying the 3D Web - part 2
Demistifying the 3D Web - part 2Demistifying the 3D Web - part 2
Demistifying the 3D Web - part 2
 
Faster Drupal sites using Queue API
Faster Drupal sites using Queue APIFaster Drupal sites using Queue API
Faster Drupal sites using Queue API
 
ngconf2015
ngconf2015ngconf2015
ngconf2015
 
JS digest. February 2017
JS digest. February 2017JS digest. February 2017
JS digest. February 2017
 
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
OpenCms Days 2014 Keynote - Step up to OpenCms 9.5
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
 
Node.js 201: building real-world applications in pure JavaScript
Node.js 201: building real-world applications in pure JavaScriptNode.js 201: building real-world applications in pure JavaScript
Node.js 201: building real-world applications in pure JavaScript
 
Xwt, a cross-desktop UI library
Xwt, a cross-desktop UI libraryXwt, a cross-desktop UI library
Xwt, a cross-desktop UI library
 

Destacado

Letni procházka s Ferdou 1
Letni procházka s Ferdou 1Letni procházka s Ferdou 1
Letni procházka s Ferdou 1
HaKuPa
 
Marketing intelligence assessment
Marketing intelligence assessmentMarketing intelligence assessment
Marketing intelligence assessment
Tag Urit
 
Thiền Triết lý Phật
Thiền Triết lý PhậtThiền Triết lý Phật
Thiền Triết lý Phật
Minh NghC
 
Z pohadkovych krajin
Z pohadkovych krajinZ pohadkovych krajin
Z pohadkovych krajin
HaKuPa
 
Krasne fotky a vtipy
Krasne  fotky  a vtipyKrasne  fotky  a vtipy
Krasne fotky a vtipy
HaKuPa
 
Podzimni prochazka s Ferdou 2
Podzimni prochazka s Ferdou 2Podzimni prochazka s Ferdou 2
Podzimni prochazka s Ferdou 2
HaKuPa
 

Destacado (18)

Letni procházka s Ferdou 1
Letni procházka s Ferdou 1Letni procházka s Ferdou 1
Letni procházka s Ferdou 1
 
Marketing intelligence assessment
Marketing intelligence assessmentMarketing intelligence assessment
Marketing intelligence assessment
 
Thiền Triết lý Phật
Thiền Triết lý PhậtThiền Triết lý Phật
Thiền Triết lý Phật
 
Tokamak2: themes and netbook shell
Tokamak2: themes and netbook shellTokamak2: themes and netbook shell
Tokamak2: themes and netbook shell
 
Tokamak 4: KDE Plasma Netbook
Tokamak 4: KDE Plasma NetbookTokamak 4: KDE Plasma Netbook
Tokamak 4: KDE Plasma Netbook
 
Z pohadkovych krajin
Z pohadkovych krajinZ pohadkovych krajin
Z pohadkovych krajin
 
Graphics Art 1
Graphics Art 1Graphics Art 1
Graphics Art 1
 
Vocab Unidad 1.1
Vocab Unidad 1.1Vocab Unidad 1.1
Vocab Unidad 1.1
 
Smart Evaluation Considerations
Smart Evaluation ConsiderationsSmart Evaluation Considerations
Smart Evaluation Considerations
 
Campkde 2010: KDE Plasma netbook
Campkde 2010: KDE Plasma netbookCampkde 2010: KDE Plasma netbook
Campkde 2010: KDE Plasma netbook
 
Akademy 2010 presentation
Akademy 2010 presentationAkademy 2010 presentation
Akademy 2010 presentation
 
URSI 2008
URSI 2008URSI 2008
URSI 2008
 
Vocab 1.3
Vocab 1.3Vocab 1.3
Vocab 1.3
 
Krasne fotky a vtipy
Krasne  fotky  a vtipyKrasne  fotky  a vtipy
Krasne fotky a vtipy
 
Podzimni prochazka s Ferdou 2
Podzimni prochazka s Ferdou 2Podzimni prochazka s Ferdou 2
Podzimni prochazka s Ferdou 2
 
farm Animals
farm Animalsfarm Animals
farm Animals
 
10 10 How To Protect Your Bank Card
10 10 How To Protect Your Bank Card10 10 How To Protect Your Bank Card
10 10 How To Protect Your Bank Card
 
Kinder ppp numbers from 50 59
Kinder ppp numbers from 50 59Kinder ppp numbers from 50 59
Kinder ppp numbers from 50 59
 

Similar a KDE 4.1 Plasma widgets

Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
chan20kaur
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13
Daker Fernandes
 

Similar a KDE 4.1 Plasma widgets (20)

Qt for beginners part 4 doing more
Qt for beginners part 4   doing moreQt for beginners part 4   doing more
Qt for beginners part 4 doing more
 
Qt
QtQt
Qt
 
Qt Programming on TI Processors
Qt Programming on TI ProcessorsQt Programming on TI Processors
Qt Programming on TI Processors
 
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfDeveloping and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
 
Qt coin3d soqt
Qt coin3d soqtQt coin3d soqt
Qt coin3d soqt
 
Qt for S60
Qt for S60Qt for S60
Qt for S60
 
PraveenKumar A T AWS
PraveenKumar A T AWSPraveenKumar A T AWS
PraveenKumar A T AWS
 
KDE Plasma Mobile workspaces at Cybercom Developer Day 2010 by Marco Martin 7...
KDE Plasma Mobile workspaces at Cybercom Developer Day 2010 by Marco Martin 7...KDE Plasma Mobile workspaces at Cybercom Developer Day 2010 by Marco Martin 7...
KDE Plasma Mobile workspaces at Cybercom Developer Day 2010 by Marco Martin 7...
 
Qt 5 - C++ and Widgets
Qt 5 - C++ and WidgetsQt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
 
Cross Platform Qt
Cross Platform QtCross Platform Qt
Cross Platform Qt
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13
 
Robust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time ChecksRobust C++ Task Systems Through Compile-time Checks
Robust C++ Task Systems Through Compile-time Checks
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
 
Drupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersDrupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developers
 
Qt5 on ti processors
Qt5 on ti processorsQt5 on ti processors
Qt5 on ti processors
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

KDE 4.1 Plasma widgets

  • 1. Plasma Widgets API and Theming approaches Marco Martin
  • 2. What is a plasma widget? ● KDE 4.0: everything from scratch ● 4.1/Qt4.4: QGraphicsWidget ● Preferably a QGraphicsProxyWidget – This means: every Qt widget you can imagine ● Exception of container widgets, like TabWidgets and Frames – We want to contain GraphicsWidgets and GraphicsLayouts here
  • 3. Standard API: why wrap? ● Normally you would do this: QPushButton *nativeButton = new QPushButton(); ● QgraphicsProxyWidget *proxy = new QgraphicsProxyWidget(this); proxy->setWidget(nativeButton); ● Very ugly code ● And in scripting too, where we would want something better ● Very scarce possibilities of theming ● So every widget has its own subclass with a set of standard methods
  • 4. What to wrap? ● Most used functions ● Makes the code simpler ● In particular for scripted applets ● Important functions – setText() text() when the underlying widget has it – setImage() getImage() aware of Plasma theme, so you can do setImage(“widgets/clock”)
  • 5. Additional stuff ● setStyleSheet()/styleSheet(): applet creators can easily tweak the widget appearance with standard Qt stylesheets ● nativeWidget() – ...when a basic api is not enough :) – Not available in EcmaScript bindings to keep api clean – Available in richer bindings like ruby
  • 6. Theming ● 3 approaches – Overriding the paint function of the proxywidget ● Better graphics results (no clipping and float arithmetics) ● Used for instance in Plasma::PushButton – Subclass the QWidget and override paintEvent ● When the widget is really complex and we need other stuff like a custom sizehint (and notification of its change) ● Used in the tabbar – Using a Kstyle: open possibility for scrollbars, easier to apply when they are only available children of other widgets (i.e. scrollviews)
  • 7. What are themes? ● QWidgets on canvas looks really out of place ● A color scheme provided by Plasma::Theme and many svgs, described in ● http://techbase.kde.org/Projects/Plasma/Theme ● Svg element naming format used by the PanelSvg class ● Useful to make more or less rectangular elements, so good for buttons, textboxes etc
  • 8. Why not a single svg?
  • 9. Example ● 9 element for each prefix, here the “normal”, pressed, active and the focus rect