SlideShare a Scribd company logo
1 of 9
Download to read offline
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

More Related Content

What's hot

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

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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 to 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 to 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
 
Qt coin3d soqt
Qt coin3d soqtQt coin3d soqt
Qt coin3d soqt
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
 
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
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 

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