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. [solved]UI Set
Forum Updated to NodeBB v4.3 + New Features

[solved]UI Set

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 2.7k 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.
  • L Offline
    L Offline
    Lalita
    wrote on last edited by
    #1

    I have set some of property for Tab such as the
    @
    QGroupBox{border-image:url(:/image.png)} @

    in the file of qss, but when I add the code
    @
    "Tab->setStyleSheet("background-image:url(:/images/back.png)");"@

    , the background image has been set successfully, but the background of QLabel and QLineEdit in the QGroupBox has been changed.
    How do I do to set the background image but not influence the other component?
    Thank you.

    [edit, @ code tags added, please do so in the future to make your post easier to read, Eddy]

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Hi,

      Have a look at "this page in the docs":http://developer.qt.nokia.com/doc/qt-4.8/stylesheet-syntax.html. It explains how to use stylesheets on specific widgets.

      Qt Certified Specialist
      www.edalsolutions.be

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

        Thank you.
        I also want to know relationship about the .qss file and the code in program, whether they have the Priority?

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          [quote author="Lalita" date="1324974526"]Thank you.
          I also want to know relationship about the .qss file and the code in program, whether they have the Priority? [/quote]

          The general purpose of stylesheets is that you get a general look and feel of all the widgets in your app. Normally you set it in your main function on your QApplication.

          Setting a stylesheet in Qt Creator is nice for testing things out though.
          Anyway you could test it yourself : eg. use a red color in Qt Creator and a blue one in the qss... ;)

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lalita
            wrote on last edited by
            #5

            Thank you. I think it will be conflicting problem.I wil do research that.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lalita
              wrote on last edited by
              #6

              Now I found the problem by modified above code:Tab->setStyleSheet("QTabWidget{background-image:url(:/images/back.png)}");

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #7

                Great!
                Well done.

                If you consider this post as solved, please edit your first post and add [solved] in front of it.

                Qt Certified Specialist
                www.edalsolutions.be

                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