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. set a color-border of the QDockWidget
Forum Updated to NodeBB v4.3 + New Features

set a color-border of the QDockWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.9k 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.
  • O Offline
    O Offline
    opengpu
    wrote on last edited by
    #1

    how to set a color-border of the QDockWidget without influncing all the other widget on th DockWidget.
    and the Dockwidget has no boder by default, eg.there is no line-border between two adjacent DockWidgets.

    jsulmJ 1 Reply Last reply
    0
    • O opengpu

      how to set a color-border of the QDockWidget without influncing all the other widget on th DockWidget.
      and the Dockwidget has no boder by default, eg.there is no line-border between two adjacent DockWidgets.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @opengpu See https://doc.qt.io/qt-5/stylesheet-reference.html and https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qdockwidget

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      2
      • jsulmJ jsulm

        @opengpu See https://doc.qt.io/qt-5/stylesheet-reference.html and https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qdockwidget

        O Offline
        O Offline
        opengpu
        wrote on last edited by
        #3

        @jsulm not work for a custom class.
        eg. class myDock : public QDockWidget

        Pradeep P NP 1 Reply Last reply
        0
        • O opengpu

          @jsulm not work for a custom class.
          eg. class myDock : public QDockWidget

          Pradeep P NP Offline
          Pradeep P NP Offline
          Pradeep P N
          wrote on last edited by
          #4

          @opengpu It should be fine i fell, as you are inheriting your class from QDockWidget and setStyleSheet is a public function.

              customClassObj->setStyleSheet("QDockWidget { "
                                            "border: 1px solid lightgray; "
                                            "titlebar-close-icon: url(close.png); "
                                            "titlebar-normal-icon: url(undock.png); "
                                            "}");
          
          

          All the best.

          Pradeep Nimbalkar.
          Upvote the answer(s) that helped you to solve the issue...
          Keep code clean.

          O 2 Replies Last reply
          2
          • Pradeep P NP Pradeep P N

            @opengpu It should be fine i fell, as you are inheriting your class from QDockWidget and setStyleSheet is a public function.

                customClassObj->setStyleSheet("QDockWidget { "
                                              "border: 1px solid lightgray; "
                                              "titlebar-close-icon: url(close.png); "
                                              "titlebar-normal-icon: url(undock.png); "
                                              "}");
            
            

            All the best.

            O Offline
            O Offline
            opengpu
            wrote on last edited by
            #5

            @Pradeep-P-N
            customClassObj->setStyleSheet("QDockWidget { border: 1px solid lightgray; }");
            i tried this...not work.
            and @constructor, setStyleSheet("QDockWidget { border: 1px solid lightgray; }");
            also not work.
            setStyleSheet("border: 1px solid lightgray;"); this work, but make everything on the DockWidget with the border

            1 Reply Last reply
            0
            • Pradeep P NP Pradeep P N

              @opengpu It should be fine i fell, as you are inheriting your class from QDockWidget and setStyleSheet is a public function.

                  customClassObj->setStyleSheet("QDockWidget { "
                                                "border: 1px solid lightgray; "
                                                "titlebar-close-icon: url(close.png); "
                                                "titlebar-normal-icon: url(undock.png); "
                                                "}");
              
              

              All the best.

              O Offline
              O Offline
              opengpu
              wrote on last edited by
              #6

              @Pradeep-P-N said in set a color-border of the QDockWidget:

              customClassObj->setStyleSheet("QDockWidget { "
                                            "border: 1px solid lightgray; "
                                            "titlebar-close-icon: url(close.png); "
                                            "titlebar-normal-icon: url(undock.png); "
                                            "}");
              

              not work...donot know why...
              myDockWidget->setStyleSheet("QDockWidget { "
              "border: 5px solid red; "
              "}");

              1 Reply Last reply
              0
              • O Offline
                O Offline
                opengpu
                wrote on last edited by opengpu
                #7

                but this work...
                myDockWidget->setStyleSheet("QDockWidget::title {text-align: left; background: red; padding-left: 5px;}");

                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