Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What is difference bwteen UI and QSS file

What is difference bwteen UI and QSS file

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 5.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chcw
    wrote on last edited by
    #1

    Hi,

    I create a new GUI project in Qt Creator and find it will create a .ui file under

    the project folder. I open the .ui file and find it is a xml file describing the

    layout and contents of the Windows. Then I am curious since QSS file is also used

    to describe the look & feel of the controls, what is the difference between the

    two?

    Thanks

    Alan

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      You can have a look at "this":http://doc.qt.digia.com/latest/designer-using-a-ui-file.html documentation that expains alot about .ui files, Other than that QSS is simply Qt Style Sheets its the same CSS.

      Check "Qt Style Sheets Examples":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        You've already answered your own question.

        The .ui file describes the layout and content of the windows, so the widgets, their properties and their arrangement in layouts, the shortcuts, menu items, actions and the signal and slot connections between those elements.

        The .ui file is used by uic, the user interface compiler, to generate C++ code, above all the setupUi() method, which is responsible for creating the neccessary objects, setting their properties and wiring those up.

        The .qss file on the other hand is used to describe the look and feel of specific widgets, so their color, font families and sizes, margins and paddings and other visual properties.

        Although both are usually used in common, they are not neccessarly tied together. One can be used without the other, a .qss can be set for either a single widget, a whole .ui (which is in technical terms nothing more than a widget) or the whole application and thus each and every .ui.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Lukas is right. Noteworthy is also that you can set the QSS also from inside the .ui file. You should understand that there is a difference between the CSS you use for HTML and the QSS styling you can do with Qt. CSS allows for a lot of layout-like tasks. QSS not so much. QSS is more at the level of styling individual widgets (or large numbers of them in one go), but does not describe their relative placement.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved