Qt Interface style settings

Source: Internet
Author: User

  • Each widget is set to style
      • SetStyle (Qstyle style)
  • Setting Qstyle for Qapplication is for all
      • Qapplication::setstyle (Qstylefactory::create ("Fusion"));
      • If other widgets have not been set Qstyle, the default is to use Qapplication
  • Qstyle Main Overridable interface
      • Drawing complex controls
        • virtual void Drawcomplexcontrol (Complexcontrol control, const QSTYLEOPTIONCOMPLEX * option, qpainter * painter, const Q Widget * Widget = 0) Const = 0
      • Drawing general Controls
        • virtual void Drawcontrol (controlelement element, const qstyleoption * option, qpainter * painter, const qwidget * Widge t = 0) Const = 0
      • Draw the most basic controls (small arrows or something)
        • virtual void DrawPrimitive (primitiveelement element, const qstyleoption * option, qpainter * painter, const qwidget * W Idget = 0) Const = 0
      • All of these interfaces have similar parameters
        • The first is the enumeration value defined in the Qstyle class, with a specific reference to the QT document that represents the type of control you want to modify
        • A few of the following are the name.
  • Get the original Qstyle supported by the current platform

  • You can also customize the style for each widget
      • Qwidget::setstyle ()
  • Modify the display effect of a custom widget
      • Qwidget has a style () interface to get the current Qstyle

  • Custom Qstyle
      • Can rewrite existing Qstyle slightly modified under
      • can also inherit one, generally inherit from Qproxystyle, or Qcommonstyle.
  • Make a custom style plug-in for other people to use
  • The use of Qt style sheet QSS
      • Using the. qss file
      • If a QT style sheet is activated, it encapsulates the style of the widget
      • This is a CSS-like thing
      • Child widgets are also modified
      • You can apply a style to the entire app, and then assign a style to a control
      • This is a top-priority style configuration that overrides Qstyle, or packaging Qstyle
  • The difference between Qstyle and QSS
      • Qstyle is able to rewrite the drawing controls, you can re-set the brush to draw lines, and of course you can just set the background color. For example, the checkbox, which turns out to be a hook, is now turned into a dark


      • QSS change the relative surface point, modify the background color background image or something
      • One change the bone, one skin.
  • Style sheet can be changed in Qtdesigner


From for notes (Wiz)

Qt Interface style settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.