SlideShare a Scribd company logo
1 of 84
Download to read offline
Agenda

•  Introduction

•  Styles

•  Style sheets

•  Dialogs

•  Cross platform tips

•  Platform specific tips


                            1
Who am I?

•  Jens Bache-Wiig
  –  Qt developer since 2005

  –  Works on look and feel




                               2
3
Introduction

“Media reviews of your product will be more
  positive…”

                         Apple Interface Guidelines




                                                      4
Introduction

•  Platform guidelines
  –  Windows User Experience Interaction Guidelines

  –  Apple Human Interface Guidelines

  –  KDE User Interface Guidelines

  –  GNOME HIG




                                                      5
QStyle




         6
QStyle

•  Appearance

•  Size and shape

•  Any platform specific behavior




                                    7
QStyle

•  Do not force a specific style

•  Ship all available styles
   –  Make sure to compile with GTK+ headers on X11 and
     the Windows Vista SDK on windows

•  Always use the style when implementing custom
  widgets



                                                          8
9
10
QStyle




         11
QStyle

•  What if I need to modify a style?




                                       12
QStyle

•  Don’t subclass it!

•  Use a proxy style




                        13
QStyle

•  QProxyStyle introduced in 4.6
  –  Makes it easy to customize the platform style

  –  Without breaking it 




                                                     14
QStyle




         15
Agenda

•  Introduction

•  Styles

•  Style sheets

•  Dialogs

•  Cross platform tips

•  Platform specific tips


                            16
Style Sheets

•  Use carefully

•  Tends to break look and feel

•  Try to blend with system palette
   –  Use transparency

   –  Use palette colors




                                      17
Style Sheets




               18
Style Sheets

Avoid hardcoding colors
  QString css = "QLabel { color:palette(highlight); }”;

If you need completely custom colors
  QColor color(255, 0, 0);

  QString css = QString("QLabel { color: %1; }").arg(color.name());




                                                                      19
Style sheets

•  How can I make a segmented button?




                                        20
Style sheets




               21
Style sheets




               22
Style sheets

•  Attach a style sheet to a particular style:
QToolButton[style=QMacStyle] {

    border-image: url(:/button_mac.png);

}

QToolButton[style=QWindowsVistaStyle] {

    border-image: url(:/button_vista.png);

}




                                                 23
Style sheets




               24
Agenda

•  Introduction

•  Styles

•  Style sheets

•  Dialogs

•  Cross platform tips

•  Platform specific tips


                            25
Dialogs



   Windows   Mac




   KDE       GNOME




                     26
Dialogs

QDialogButtonBox

 - Manages order, layout, icon and text

 QDialogButtonBox box(QDialogButtonBox::Save |
                     QDalogButtonBox::Discard |
                     QDialogButtonBox::Cancel);




                                                  27
Dialogs

•  Custom buttons are marked with a role
   –  Determines positioning

   –  Reject, accept, help …
QDialogButtonBox box;

box.addButton(myButton, QDialogButtonBox::AcceptRole);




                                                         28
Dialogs

  Traditional modal dialog


  MyQDialogSubclass dialog;

  // Various bits of initialization

  if (dialog.exec() == QDialog::Accept)    {

      // Set new values or do extra work

      // based on results.

  }




                                               29
Dialogs

•  Windows
  –  Use only for critical or infrequent one-off tasks that
    require completion before continuing

•  KDE
  –  Use only if allowing interaction would cause data loss
    or some other serious problem




                                                              30
Dialogs

•  What happens when you open a modal dialog?




                                                31
Dialogs

•  QDialog::show() - non modal

•  QDialog::exec() - modal

•  QDialog::open() – window modal




                                    32
Dialogs

  Using QDialog::open() :




                            33
Dialogs




          34
Dialogs




          35
Dialogs




          36
Agenda

•  Introduction

•  Styles

•  Style sheets

•  Dialogs

•  Cross platform tips

•  Platform specific tips


                            37
Cross platform tips

  How do you tell the user that the current document was
    modified?




                                                           38
Cross platform tips

•  When showing a file location in the title bar


setWindowModified(true);

setWindowFilePath("untitled.txt");




                                                   39
Cross platform tips




                      40
Cross platform tips

  How can your application ask for attention?




                                                41
Cross platform tips

QApplication::alert(widget, msec = 0);

•  Bouncing dock icon on Mac

•  Flashing taskbar entry on Windows




                                         42
Cross platform tips

 •  QSystemTrayIcon
   -use b/w icon on mac




                          43
Cross platform tips

  Where do you store your documents?




                                       44
Cross platform tips

•  QDesktopServices::storageLocation()
  –  gives you default system directories such as
    Desktop, Music, Pictures, Applications, Temp and
    Cache




                                                       45
Cross platform tips

  How can you open an e-mail using your standard e-mail
    application?




                                                          46
Cross platform tips

•  QDesktopServices::openUrl(const QUrl &url)
  –  Launches the provided URL using the default system
    application



  openUrl(“mailto:myself@gmail.com”);

  openUrl(“http://qt.nokia.com”);

  openUrl(QUrl::fromLocalFile(…));



                                                          47
Cross platform tips


  Which shortcut do I use for “find” in a document?




                                                      48
Cross platform tips

•  Depends on your platform!

•  Use standard shortcuts whenever possible

•  Test for conflicts on all platforms


  QAction action;

  action.setShortcuts(QKeySequence::Find);




                                              49
Cross platform tips

// Get a list of all keys for a StandardKey.
  QList<QKeySequence> keys      =
  QKeySequence::keyBindings(QKeySequence::NextChild);
  foreach (QKeySequence key, keys) {

      printOut(key.toString(QKeySequence::PortableText));

} …




                                                            50
Cross platform tips

•  Use a consistent icon theme

•  Lots of free themes available online
    –  Oxygen, Tango to mention a few




http://www.oxygen-icons.org             http://tango.freedesktop.org



                                                                       51
Cross platform tips

•  Icon theme support in 4.6
  QIcon::fromTheme(“document-edit”);

  QIcon::fromTheme(“document-edit”,
    QIcon(“document.png”));




         For previous versions of Qt: http://code.google.com/p/qticonloader/



                                                                               52
Cross platform tips




                      53
Cross platform tips




                      54
Cross platform tips

•  Give your QAction priority
   –  Introduced in 4.6

   –  low, normal and high priority



   QAction::setPriority(QAction::Priority)




                                             55
Cross platform tips




                      56
Cross platform tips




                      57
Cross platform tips

•  Icons in menus
   –  Not visible on Mac

   –  Visible on Windows and KDE

   –  Depends on the system setting in GNOME

•  Override with
   –  QAction::setIconVisibleInMenu(bool)

   –  QApplication::setAttribute(Qt::AA_DontShowIconsInMenus)



                                                                58
Cross platform tips - Dialogs

•  Preferences on GNOME/Mac
  –  Applies immediately

•  Preferences on Windows/KDE
  –  Apply/Cancel




                                59
Cross platform tips

•  MDI interfaces
  –  Mac does not support it

  –  GTK+ does not support it

  –  Microsoft:
     •  SDI is appropriate for most productivity applications. MDI is
       still in use, but does not fit as well with today's users and
       operating systems




                                                                        60
Go native!

•  Ifdef is evil but sometimes useful…
  –  Q_WS_WIN

  –  Q_WS_MAC

  –  Q_WS_X11




                                         61
The window id

  –  QWidget::winId()

  –  Returns a native window handle
     •  HWND on Windows

     •  NSView* on Cocoa

     •  X11 handle

  –  Allows using native API
     •  Windows Vista or Windows 7 specific features




                                                       62
Agenda

•  Introduction

•  Styles

•  Style sheets

•  Dialogs

•  Cross platform tips

•  Platform specific tips


                            63
Platform specific tips




                         64
Mac

 –  MacMainWindow demo




                         65
Mac

•  Icons
   –  Use a high-resolution application icon

   –  Use a b/w system tray icon




                                               66
Mac

•  QMenuBar can stand on it’s own!
  –  Create it without a parent

  –  The first menu bar created will be the default menu bar




                                                               67
Mac

      QMainWindow::setUnifiedTitleAndToolBarOnMac()




                                                      68
Mac

•  Why not allways set it?
   –  Not movable

   –  No breaks are respected

   –  Custom widgets hidden when small

   –  Toolbar hidden in fullscreen




                                         69
Mac

•  Unified toolbar breakage….




                                70
Mac – Doc menu




QMenu*menu = new QMenu;
// Add actions to the menu
// Connect them to slots
    ...
extern void qt_mac_set_dock_menu(QMenu *);
qt_mac_set_dock_menu(menu);



                                             71
Mac

•  Qt automatically rearranges menu entries
  –  Based on name: about, settings, preferences, quit, exit

  –  Override with QAction::menuRole
      •  AboutRole, PreferencesRole, QuitRole, NoRole (do not move)

•  Example
      •  A QMenu entry called “settings” goes to
        Application::preferences on mac




                                                                      72
X11




      73
X11

•  Follow freedesktop.org standards if possible
  –  Menu specs

  –  Icon themes

  –  Autostart

  –  Bookmarks

  –  .desktop file




                                                  74
X11

•  Make a desktop file
  –  standards.freedesktop.org/desktop-entry-spec/

  –  Simple configuration file containing
      •  Application Icon

      •  Menu Entry

      •  Registered mime types

      •  …




                                                     75
X11

•  How do you know if you are running KDE or
  GNOME?
  –  No 100% reliable way of doing it

  –  You can try the “DESKTOP_SESSION” env. variable
      •  “kde”, “gnome”




                                                       76
X11

•  Test on both KDE and GNOME
  –  Different shortcuts

  –  Different themes

  –  Window behavior




                                77
78
Windows tips

•  QSettings uses the windows registry
  –  you can also use QSettings to read system settings

  QSettings settings("HKEY_CURRENT_USER … ExplorerAdvanced”, QSettings::NativeFormat);
  bool result = settings.value("EnableBalloonTips”, true).toBool();




                                                                                             79
Windows tips

•  Try explorer style



 http://labs.trolltech.com/blogs/2007/06/08/explorer-style-toolbars/




                                                                       80
Windows tips

•  QtDotNetStyle
  –  Free solution




                     81
Windows tips

•  Enable blur behind on Vista or windows 7
  –  No API in Qt for this yet

  –  However you can use the windows API directly if you
    set WA_TranslucentBackground and
    WA_NoSystemBackground on the widget!




                                                           82
Windows




          83
Conclusion




             84

More Related Content

What's hot

10 things i learned building nomad-packs
10 things i learned building nomad-packs10 things i learned building nomad-packs
10 things i learned building nomad-packsBram Vogelaar
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsAhmed El-Arabawy
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IICS
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKMarian Marinov
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHubNishan Bose
 
containerd the universal container runtime
containerd the universal container runtimecontainerd the universal container runtime
containerd the universal container runtimeDocker, Inc.
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
Lec 01_Linux System Administration (1).pptx
Lec 01_Linux System Administration (1).pptxLec 01_Linux System Administration (1).pptx
Lec 01_Linux System Administration (1).pptxShabanaShafi3
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Pasi Kellokoski
 
Deep dive into Kubernetes Networking
Deep dive into Kubernetes NetworkingDeep dive into Kubernetes Networking
Deep dive into Kubernetes NetworkingSreenivas Makam
 
Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azuretombuildsstuff
 
The Zen of High Performance Messaging with NATS (Strange Loop 2016)
The Zen of High Performance Messaging with NATS (Strange Loop 2016)The Zen of High Performance Messaging with NATS (Strange Loop 2016)
The Zen of High Performance Messaging with NATS (Strange Loop 2016)wallyqs
 

What's hot (20)

Qt programming-using-cpp
Qt programming-using-cppQt programming-using-cpp
Qt programming-using-cpp
 
10 things i learned building nomad-packs
10 things i learned building nomad-packs10 things i learned building nomad-packs
10 things i learned building nomad-packs
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
PowerShell-1
PowerShell-1PowerShell-1
PowerShell-1
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part I
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
DoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDKDoS and DDoS mitigations with eBPF, XDP and DPDK
DoS and DDoS mitigations with eBPF, XDP and DPDK
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
 
Java 8 Workshop
Java 8 WorkshopJava 8 Workshop
Java 8 Workshop
 
containerd the universal container runtime
containerd the universal container runtimecontainerd the universal container runtime
containerd the universal container runtime
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
Lec 01_Linux System Administration (1).pptx
Lec 01_Linux System Administration (1).pptxLec 01_Linux System Administration (1).pptx
Lec 01_Linux System Administration (1).pptx
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
 
Deep dive into Kubernetes Networking
Deep dive into Kubernetes NetworkingDeep dive into Kubernetes Networking
Deep dive into Kubernetes Networking
 
Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azure
 
Linux
LinuxLinux
Linux
 
The Zen of High Performance Messaging with NATS (Strange Loop 2016)
The Zen of High Performance Messaging with NATS (Strange Loop 2016)The Zen of High Performance Messaging with NATS (Strange Loop 2016)
The Zen of High Performance Messaging with NATS (Strange Loop 2016)
 
Linux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platformLinux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platform
 

Viewers also liked

Creating Slick User Interfaces With Qt
Creating Slick User Interfaces With QtCreating Slick User Interfaces With Qt
Creating Slick User Interfaces With QtEspen Riskedal
 
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Software
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization SoftwareCase Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Software
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Softwareaccount inactive
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with QtAriya Hidayat
 
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key conceptsICS
 
Special Effects with Qt Graphics View
Special Effects with Qt Graphics ViewSpecial Effects with Qt Graphics View
Special Effects with Qt Graphics Viewaccount inactive
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applicationsaccount inactive
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgetsICS
 
Qt for beginners part 5 ask the experts
Qt for beginners part 5   ask the expertsQt for beginners part 5   ask the experts
Qt for beginners part 5 ask the expertsICS
 
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 moreICS
 
Qt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickQt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickICS
 
Qt Application Development on Harmattan
Qt Application Development on HarmattanQt Application Development on Harmattan
Qt Application Development on HarmattanVille Lavonius
 
Cross platform solutions for Mobile App Development
Cross platform solutions for Mobile App Development Cross platform solutions for Mobile App Development
Cross platform solutions for Mobile App Development USAID CEED II Project Moldova
 
Cross platform development
Cross platform developmentCross platform development
Cross platform developmentdftaiwo
 
The Mobile Market and Qt
The Mobile Market and QtThe Mobile Market and Qt
The Mobile Market and QtEspen Riskedal
 
Building Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoBuilding Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoJeff Alstadt
 
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIICS
 
[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project
[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project
[Webinar] 10 Keys to Ensuring Success for Your Next Qt ProjectICS
 
Targeting Android with Qt
Targeting Android with QtTargeting Android with Qt
Targeting Android with QtEspen Riskedal
 
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVBest Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVICS
 

Viewers also liked (20)

Creating Slick User Interfaces With Qt
Creating Slick User Interfaces With QtCreating Slick User Interfaces With Qt
Creating Slick User Interfaces With Qt
 
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Software
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization SoftwareCase Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Software
Case Study: Using Qt to Develop Advanced GUIs & Advanced Visualization Software
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with Qt
 
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key concepts
 
Special Effects with Qt Graphics View
Special Effects with Qt Graphics ViewSpecial Effects with Qt Graphics View
Special Effects with Qt Graphics View
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applications
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgets
 
Qt for beginners part 5 ask the experts
Qt for beginners part 5   ask the expertsQt for beginners part 5   ask the experts
Qt for beginners part 5 ask the experts
 
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 for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickQt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt Quick
 
Qt Application Development on Harmattan
Qt Application Development on HarmattanQt Application Development on Harmattan
Qt Application Development on Harmattan
 
Cross platform solutions for Mobile App Development
Cross platform solutions for Mobile App Development Cross platform solutions for Mobile App Development
Cross platform solutions for Mobile App Development
 
Cross platform development
Cross platform developmentCross platform development
Cross platform development
 
The Mobile Market and Qt
The Mobile Market and QtThe Mobile Market and Qt
The Mobile Market and Qt
 
Building Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoBuilding Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and Qyoto
 
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
 
[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project
[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project
[Webinar] 10 Keys to Ensuring Success for Your Next Qt Project
 
Targeting Android with Qt
Targeting Android with QtTargeting Android with Qt
Targeting Android with Qt
 
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVBest Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IV
 

Similar to How to Make Your Qt App Look Native

CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"Ciklum Ukraine
 
Development with Qt for Windows CE
Development with Qt for Windows CEDevelopment with Qt for Windows CE
Development with Qt for Windows CEaccount inactive
 
CMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessCMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessMarcus Hanwell
 
90 CADWorx Tips in 90 Minutes - mworland
90 CADWorx Tips in 90 Minutes - mworland 90 CADWorx Tips in 90 Minutes - mworland
90 CADWorx Tips in 90 Minutes - mworland Matt Worland
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийVitebsk Miniq
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computingaccount inactive
 
A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0ESUG
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studypeter_ibuildings
 
Free GitOps Workshop
Free GitOps WorkshopFree GitOps Workshop
Free GitOps WorkshopWeaveworks
 
60_AutoCAD_Tips_in_60_Minutes_final.ppt
60_AutoCAD_Tips_in_60_Minutes_final.ppt60_AutoCAD_Tips_in_60_Minutes_final.ppt
60_AutoCAD_Tips_in_60_Minutes_final.pptManojKumar375818
 
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Updatejamieayre
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_finalSE3D
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_finalSE3D
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_finalNavdeepSingh413
 
Swt eye for the swing guy
Swt eye for the swing guySwt eye for the swing guy
Swt eye for the swing guyIoan Bogdan
 

Similar to How to Make Your Qt App Look Native (20)

CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
 
Development with Qt for Windows CE
Development with Qt for Windows CEDevelopment with Qt for Windows CE
Development with Qt for Windows CE
 
Cmake kitware
Cmake kitwareCmake kitware
Cmake kitware
 
CMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessCMake: Improving Software Quality and Process
CMake: Improving Software Quality and Process
 
90 CADWorx Tips in 90 Minutes - mworland
90 CADWorx Tips in 90 Minutes - mworland 90 CADWorx Tips in 90 Minutes - mworland
90 CADWorx Tips in 90 Minutes - mworland
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложений
 
QtQuick Day 1
QtQuick Day 1QtQuick Day 1
QtQuick Day 1
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computing
 
A Taste of Pharo 7.0
A Taste of Pharo 7.0A Taste of Pharo 7.0
A Taste of Pharo 7.0
 
Qt Application Programming with C++ - Part 1
Qt Application Programming with C++ - Part 1Qt Application Programming with C++ - Part 1
Qt Application Programming with C++ - Part 1
 
Cross Platform Qt
Cross Platform QtCross Platform Qt
Cross Platform Qt
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-study
 
Free GitOps Workshop
Free GitOps WorkshopFree GitOps Workshop
Free GitOps Workshop
 
60_AutoCAD_Tips_in_60_Minutes_final.ppt
60_AutoCAD_Tips_in_60_Minutes_final.ppt60_AutoCAD_Tips_in_60_Minutes_final.ppt
60_AutoCAD_Tips_in_60_Minutes_final.ppt
 
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final
 
60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final60 auto cad_tips_in_60_minutes_final
60 auto cad_tips_in_60_minutes_final
 
Swt eye for the swing guy
Swt eye for the swing guySwt eye for the swing guy
Swt eye for the swing guy
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 

More from account inactive

KDE Plasma for Mobile Phones
KDE Plasma for Mobile PhonesKDE Plasma for Mobile Phones
KDE Plasma for Mobile Phonesaccount inactive
 
Shipping Mobile Applications Using Qt for Symbian
Shipping Mobile Applications Using Qt for SymbianShipping Mobile Applications Using Qt for Symbian
Shipping Mobile Applications Using Qt for Symbianaccount inactive
 
Scripting Your Qt Application
Scripting Your Qt ApplicationScripting Your Qt Application
Scripting Your Qt Applicationaccount inactive
 
Developments in The Qt WebKit Integration
Developments in The Qt WebKit IntegrationDevelopments in The Qt WebKit Integration
Developments in The Qt WebKit Integrationaccount inactive
 
Qt on Real Time Operating Systems
Qt on Real Time Operating SystemsQt on Real Time Operating Systems
Qt on Real Time Operating Systemsaccount inactive
 
Translating Qt Applications
Translating Qt ApplicationsTranslating Qt Applications
Translating Qt Applicationsaccount inactive
 
Qt State Machine Framework
Qt State Machine FrameworkQt State Machine Framework
Qt State Machine Frameworkaccount inactive
 
Mobile Development with Qt for Symbian
Mobile Development with Qt for SymbianMobile Development with Qt for Symbian
Mobile Development with Qt for Symbianaccount inactive
 
Animation Framework: A Step Towards Modern UIs
Animation Framework: A Step Towards Modern UIsAnimation Framework: A Step Towards Modern UIs
Animation Framework: A Step Towards Modern UIsaccount inactive
 
Using Multi-Touch and Gestures with Qt
Using Multi-Touch and Gestures with QtUsing Multi-Touch and Gestures with Qt
Using Multi-Touch and Gestures with Qtaccount inactive
 
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)account inactive
 
Copy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with QtCopy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with Qtaccount inactive
 
The Next Generation Qt Item Views
The Next Generation Qt Item ViewsThe Next Generation Qt Item Views
The Next Generation Qt Item Viewsaccount inactive
 
Case Study: Porting Qt for Embedded Linux on Embedded Processors
Case Study: Porting Qt for Embedded Linux on Embedded ProcessorsCase Study: Porting Qt for Embedded Linux on Embedded Processors
Case Study: Porting Qt for Embedded Linux on Embedded Processorsaccount inactive
 

More from account inactive (20)

Meet Qt
Meet QtMeet Qt
Meet Qt
 
KDE Plasma for Mobile Phones
KDE Plasma for Mobile PhonesKDE Plasma for Mobile Phones
KDE Plasma for Mobile Phones
 
Shipping Mobile Applications Using Qt for Symbian
Shipping Mobile Applications Using Qt for SymbianShipping Mobile Applications Using Qt for Symbian
Shipping Mobile Applications Using Qt for Symbian
 
The Future of Qt Widgets
The Future of Qt WidgetsThe Future of Qt Widgets
The Future of Qt Widgets
 
Scripting Your Qt Application
Scripting Your Qt ApplicationScripting Your Qt Application
Scripting Your Qt Application
 
Developments in The Qt WebKit Integration
Developments in The Qt WebKit IntegrationDevelopments in The Qt WebKit Integration
Developments in The Qt WebKit Integration
 
Qt Kwan-Do
Qt Kwan-DoQt Kwan-Do
Qt Kwan-Do
 
Qt on Real Time Operating Systems
Qt on Real Time Operating SystemsQt on Real Time Operating Systems
Qt on Real Time Operating Systems
 
Translating Qt Applications
Translating Qt ApplicationsTranslating Qt Applications
Translating Qt Applications
 
Qt Creator Bootcamp
Qt Creator BootcampQt Creator Bootcamp
Qt Creator Bootcamp
 
Qt State Machine Framework
Qt State Machine FrameworkQt State Machine Framework
Qt State Machine Framework
 
Mobile Development with Qt for Symbian
Mobile Development with Qt for SymbianMobile Development with Qt for Symbian
Mobile Development with Qt for Symbian
 
Animation Framework: A Step Towards Modern UIs
Animation Framework: A Step Towards Modern UIsAnimation Framework: A Step Towards Modern UIs
Animation Framework: A Step Towards Modern UIs
 
Using Multi-Touch and Gestures with Qt
Using Multi-Touch and Gestures with QtUsing Multi-Touch and Gestures with Qt
Using Multi-Touch and Gestures with Qt
 
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)
Debugging Qt, Fixing and Contributing a Bug Report (Using Gitorious)
 
The Mobility Project
The Mobility ProjectThe Mobility Project
The Mobility Project
 
Copy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with QtCopy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with Qt
 
The Next Generation Qt Item Views
The Next Generation Qt Item ViewsThe Next Generation Qt Item Views
The Next Generation Qt Item Views
 
Qt Licensing Explained
Qt Licensing ExplainedQt Licensing Explained
Qt Licensing Explained
 
Case Study: Porting Qt for Embedded Linux on Embedded Processors
Case Study: Porting Qt for Embedded Linux on Embedded ProcessorsCase Study: Porting Qt for Embedded Linux on Embedded Processors
Case Study: Porting Qt for Embedded Linux on Embedded Processors
 

Recently uploaded

Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
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 FMESafe Software
 
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.pdfOrbitshub
 
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 WoodJuan lago vázquez
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformWSO2
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Recently uploaded (20)

Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
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
 
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
 
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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

How to Make Your Qt App Look Native

  • 1. Agenda •  Introduction •  Styles •  Style sheets •  Dialogs •  Cross platform tips •  Platform specific tips 1
  • 2. Who am I? •  Jens Bache-Wiig –  Qt developer since 2005 –  Works on look and feel 2
  • 3. 3
  • 4. Introduction “Media reviews of your product will be more positive…” Apple Interface Guidelines 4
  • 5. Introduction •  Platform guidelines –  Windows User Experience Interaction Guidelines –  Apple Human Interface Guidelines –  KDE User Interface Guidelines –  GNOME HIG 5
  • 6. QStyle 6
  • 7. QStyle •  Appearance •  Size and shape •  Any platform specific behavior 7
  • 8. QStyle •  Do not force a specific style •  Ship all available styles –  Make sure to compile with GTK+ headers on X11 and the Windows Vista SDK on windows •  Always use the style when implementing custom widgets 8
  • 9. 9
  • 10. 10
  • 11. QStyle 11
  • 12. QStyle •  What if I need to modify a style? 12
  • 13. QStyle •  Don’t subclass it! •  Use a proxy style 13
  • 14. QStyle •  QProxyStyle introduced in 4.6 –  Makes it easy to customize the platform style –  Without breaking it  14
  • 15. QStyle 15
  • 16. Agenda •  Introduction •  Styles •  Style sheets •  Dialogs •  Cross platform tips •  Platform specific tips 16
  • 17. Style Sheets •  Use carefully •  Tends to break look and feel •  Try to blend with system palette –  Use transparency –  Use palette colors 17
  • 19. Style Sheets Avoid hardcoding colors QString css = "QLabel { color:palette(highlight); }”; If you need completely custom colors QColor color(255, 0, 0); QString css = QString("QLabel { color: %1; }").arg(color.name()); 19
  • 20. Style sheets •  How can I make a segmented button? 20
  • 23. Style sheets •  Attach a style sheet to a particular style: QToolButton[style=QMacStyle] { border-image: url(:/button_mac.png); } QToolButton[style=QWindowsVistaStyle] { border-image: url(:/button_vista.png); } 23
  • 25. Agenda •  Introduction •  Styles •  Style sheets •  Dialogs •  Cross platform tips •  Platform specific tips 25
  • 26. Dialogs Windows Mac KDE GNOME 26
  • 27. Dialogs QDialogButtonBox - Manages order, layout, icon and text QDialogButtonBox box(QDialogButtonBox::Save | QDalogButtonBox::Discard | QDialogButtonBox::Cancel); 27
  • 28. Dialogs •  Custom buttons are marked with a role –  Determines positioning –  Reject, accept, help … QDialogButtonBox box; box.addButton(myButton, QDialogButtonBox::AcceptRole); 28
  • 29. Dialogs Traditional modal dialog MyQDialogSubclass dialog; // Various bits of initialization if (dialog.exec() == QDialog::Accept) { // Set new values or do extra work // based on results. } 29
  • 30. Dialogs •  Windows –  Use only for critical or infrequent one-off tasks that require completion before continuing •  KDE –  Use only if allowing interaction would cause data loss or some other serious problem 30
  • 31. Dialogs •  What happens when you open a modal dialog? 31
  • 32. Dialogs •  QDialog::show() - non modal •  QDialog::exec() - modal •  QDialog::open() – window modal 32
  • 33. Dialogs Using QDialog::open() : 33
  • 34. Dialogs 34
  • 35. Dialogs 35
  • 36. Dialogs 36
  • 37. Agenda •  Introduction •  Styles •  Style sheets •  Dialogs •  Cross platform tips •  Platform specific tips 37
  • 38. Cross platform tips How do you tell the user that the current document was modified? 38
  • 39. Cross platform tips •  When showing a file location in the title bar setWindowModified(true); setWindowFilePath("untitled.txt"); 39
  • 41. Cross platform tips How can your application ask for attention? 41
  • 42. Cross platform tips QApplication::alert(widget, msec = 0); •  Bouncing dock icon on Mac •  Flashing taskbar entry on Windows 42
  • 43. Cross platform tips •  QSystemTrayIcon -use b/w icon on mac 43
  • 44. Cross platform tips Where do you store your documents? 44
  • 45. Cross platform tips •  QDesktopServices::storageLocation() –  gives you default system directories such as Desktop, Music, Pictures, Applications, Temp and Cache 45
  • 46. Cross platform tips How can you open an e-mail using your standard e-mail application? 46
  • 47. Cross platform tips •  QDesktopServices::openUrl(const QUrl &url) –  Launches the provided URL using the default system application openUrl(“mailto:myself@gmail.com”); openUrl(“http://qt.nokia.com”); openUrl(QUrl::fromLocalFile(…)); 47
  • 48. Cross platform tips Which shortcut do I use for “find” in a document? 48
  • 49. Cross platform tips •  Depends on your platform! •  Use standard shortcuts whenever possible •  Test for conflicts on all platforms QAction action; action.setShortcuts(QKeySequence::Find); 49
  • 50. Cross platform tips // Get a list of all keys for a StandardKey. QList<QKeySequence> keys = QKeySequence::keyBindings(QKeySequence::NextChild); foreach (QKeySequence key, keys) { printOut(key.toString(QKeySequence::PortableText)); } … 50
  • 51. Cross platform tips •  Use a consistent icon theme •  Lots of free themes available online –  Oxygen, Tango to mention a few http://www.oxygen-icons.org http://tango.freedesktop.org 51
  • 52. Cross platform tips •  Icon theme support in 4.6 QIcon::fromTheme(“document-edit”); QIcon::fromTheme(“document-edit”, QIcon(“document.png”)); For previous versions of Qt: http://code.google.com/p/qticonloader/ 52
  • 55. Cross platform tips •  Give your QAction priority –  Introduced in 4.6 –  low, normal and high priority QAction::setPriority(QAction::Priority) 55
  • 58. Cross platform tips •  Icons in menus –  Not visible on Mac –  Visible on Windows and KDE –  Depends on the system setting in GNOME •  Override with –  QAction::setIconVisibleInMenu(bool) –  QApplication::setAttribute(Qt::AA_DontShowIconsInMenus) 58
  • 59. Cross platform tips - Dialogs •  Preferences on GNOME/Mac –  Applies immediately •  Preferences on Windows/KDE –  Apply/Cancel 59
  • 60. Cross platform tips •  MDI interfaces –  Mac does not support it –  GTK+ does not support it –  Microsoft: •  SDI is appropriate for most productivity applications. MDI is still in use, but does not fit as well with today's users and operating systems 60
  • 61. Go native! •  Ifdef is evil but sometimes useful… –  Q_WS_WIN –  Q_WS_MAC –  Q_WS_X11 61
  • 62. The window id –  QWidget::winId() –  Returns a native window handle •  HWND on Windows •  NSView* on Cocoa •  X11 handle –  Allows using native API •  Windows Vista or Windows 7 specific features 62
  • 63. Agenda •  Introduction •  Styles •  Style sheets •  Dialogs •  Cross platform tips •  Platform specific tips 63
  • 66. Mac •  Icons –  Use a high-resolution application icon –  Use a b/w system tray icon 66
  • 67. Mac •  QMenuBar can stand on it’s own! –  Create it without a parent –  The first menu bar created will be the default menu bar 67
  • 68. Mac QMainWindow::setUnifiedTitleAndToolBarOnMac() 68
  • 69. Mac •  Why not allways set it? –  Not movable –  No breaks are respected –  Custom widgets hidden when small –  Toolbar hidden in fullscreen 69
  • 70. Mac •  Unified toolbar breakage…. 70
  • 71. Mac – Doc menu QMenu*menu = new QMenu; // Add actions to the menu // Connect them to slots ... extern void qt_mac_set_dock_menu(QMenu *); qt_mac_set_dock_menu(menu); 71
  • 72. Mac •  Qt automatically rearranges menu entries –  Based on name: about, settings, preferences, quit, exit –  Override with QAction::menuRole •  AboutRole, PreferencesRole, QuitRole, NoRole (do not move) •  Example •  A QMenu entry called “settings” goes to Application::preferences on mac 72
  • 73. X11 73
  • 74. X11 •  Follow freedesktop.org standards if possible –  Menu specs –  Icon themes –  Autostart –  Bookmarks –  .desktop file 74
  • 75. X11 •  Make a desktop file –  standards.freedesktop.org/desktop-entry-spec/ –  Simple configuration file containing •  Application Icon •  Menu Entry •  Registered mime types •  … 75
  • 76. X11 •  How do you know if you are running KDE or GNOME? –  No 100% reliable way of doing it –  You can try the “DESKTOP_SESSION” env. variable •  “kde”, “gnome” 76
  • 77. X11 •  Test on both KDE and GNOME –  Different shortcuts –  Different themes –  Window behavior 77
  • 78. 78
  • 79. Windows tips •  QSettings uses the windows registry –  you can also use QSettings to read system settings QSettings settings("HKEY_CURRENT_USER … ExplorerAdvanced”, QSettings::NativeFormat); bool result = settings.value("EnableBalloonTips”, true).toBool(); 79
  • 80. Windows tips •  Try explorer style http://labs.trolltech.com/blogs/2007/06/08/explorer-style-toolbars/ 80
  • 81. Windows tips •  QtDotNetStyle –  Free solution 81
  • 82. Windows tips •  Enable blur behind on Vista or windows 7 –  No API in Qt for this yet –  However you can use the windows API directly if you set WA_TranslucentBackground and WA_NoSystemBackground on the widget! 82
  • 83. Windows 83