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. Problem with Qtextedit?
Forum Update on Monday, May 27th 2025

Problem with Qtextedit?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 2.7k Views
  • 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.
  • P Offline
    P Offline
    pratik041
    wrote on 7 Dec 2011, 07:25 last edited by
    #1

    While i am setting a background image in parent window why the same image is coming in the textedit widget also. How i can avoid that?

    Pratik Agrawal

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on 7 Dec 2011, 08:12 last edited by
      #2

      How do you set background image?
      If with styleShet then do:
      @QDialog{background-image: url(:/img/1.JPG);}@
      Instead QDialog, put your parent window.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on 7 Dec 2011, 08:24 last edited by
        #3

        This is NOT a problem of QTextEdit. Styles are inherited automatically. To avoid this, you can use "selectors":http://doc.qt.nokia.com/4.7/stylesheet-syntax.html#selector-types


        Declaration of (Platform) independence.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pratik041
          wrote on 7 Dec 2011, 09:04 last edited by
          #4

          In my case which selector i should use
          @
          QMainWindow w;
          w.setStyleSheet ("background-image: url(:/Sunset.jpg)");
          @

          Pratik Agrawal

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qxoz
            wrote on 7 Dec 2011, 09:18 last edited by
            #5

            i guess
            @QMainWindow w;
            w.setStyleSheet ("QMainWindow{background-image: url(:/Sunset.jpg)}");@

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pratik041
              wrote on 7 Dec 2011, 09:21 last edited by
              #6

              [quote author="qxoz" date="1323249534"]i guess
              @QMainWindow w;
              w.setStyleSheet ("QMainWindow{background-image: url(:/Sunset.jpg)}");@

              [/quote]
              thanks

              Pratik Agrawal

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fguimaraes
                wrote on 7 Dec 2011, 10:09 last edited by
                #7

                Notice that,
                @
                QMainWindow w;
                w.setStyleSheet("QPushButton { background:#F0F;}");
                @
                will affect all the push buttons from main window.

                For instance:
                @QMainWindow w;
                w.setStyleSheet("QWidget #menuBar QPushButton{ background:#F0F;}");@
                will affect only push buttons from the QWidget named as menuBar.

                You should use "selectors":http://doc.qt.nokia.com/4.7/stylesheet-syntax.html#selector-types as Rahul said. Its very important in UI creation.

                Birth, death, rebirth, though, and constantly progress, that is the law.

                1 Reply Last reply
                0

                1/7

                7 Dec 2011, 07:25

                • Login

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