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. Qss and QDockWidget

Qss and QDockWidget

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

    Hello, i found a bug in the QDockWidget in the qss
    Does not want to set background image in the QDockWidget
    I try to write
    thus: url(:/All/SearchBackground.png);
    thus: border-image: url(:/All/SearchBackground.png);
    and thus: background-image: url(:/All/SearchBackground.png);
    And placed either no image or a need picture but whith some scraps
    Thanks in advance, and sorry for bad english!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mazur
      wrote on last edited by
      #2

      Hi Ruzik, have you got Q_OBJECT in your QMainWindow or child of QDockWidget? If yes then you need to rewrite paintEvent. Try documentation, there was an example how to do it.

      delete this->signature;

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ruzik
        wrote on last edited by
        #3

        Class is the child of QDockWidget, please help me with rewrite:
        I write in class:
        protected:
        void paintEvent ( QPaintEvent * event );
        And in cpp file
        void Search::paintEvent ( QPaintEvent * event )
        {
        this->repaint();
        }
        And an error of unhandled exception
        Error on this line-> this->repaint();
        I find information in assist, but i dont foind anythink
        P.S. Thank you very much for your attention

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mazur
          wrote on last edited by
          #4

          Hi Ruzik, I am sorry for long response and here is the code for paintEvent:

          @void Search::paintEvent(QPaintEvent *)
          {
          QStylePainter barPainter(this);
          QStyleOption barOption;
          barOption.initFrom(this);
          barPainter.drawPrimitive(QStyle::PE_Widget, barOption);
          }@

          It should be done with all Widgets that have Q_OBJECT and you want to use stylesheet with them, it was somewhere in the documentation but this stylesheet section is really messy and I can't find it anymore. Hopefully it works.

          delete this->signature;

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Ruzik
            wrote on last edited by
            #5

            Thank you very musc!

            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