Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Problem with Qtextedit?

    General and Desktop
    4
    7
    2387
    Loading More Posts
    • 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
      pratik041 last edited by

      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 Reply Quote 0
      • Q
        qxoz last edited by

        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 Reply Quote 0
        • R
          Rahul Das last edited by

          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


            Rahul Das
          

          1 Reply Last reply Reply Quote 0
          • P
            pratik041 last edited by

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

            Pratik Agrawal

            1 Reply Last reply Reply Quote 0
            • Q
              qxoz last edited by

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

              1 Reply Last reply Reply Quote 0
              • P
                pratik041 last edited by

                [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 Reply Quote 0
                • F
                  fguimaraes last edited by

                  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 Reply Quote 0
                  • First post
                    Last post