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. Borders for the QDockWidget 4.8
QtWS25 Last Chance

Borders for the QDockWidget 4.8

Scheduled Pinned Locked Moved Solved General and Desktop
qdockwidgetborders
6 Posts 4 Posters 5.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.
  • N Offline
    N Offline
    N.Sumi
    wrote on 14 Jan 2016, 14:32 last edited by N.Sumi
    #1

    Hello all,

    Can someone suggest me, how to set the " Real borders " for the QDockwidget. Usually Dock comes with no border and only with tittle bar. I want to set the "real border" with color, for the Dock I made some search on google , it does not help me.
    I am using Qt 4.8.5 on Win10.

    check the Image

    thanks and regards,
    Sumi.

    N 1 Reply Last reply 14 Jan 2016, 15:03
    0
    • N N.Sumi
      14 Jan 2016, 14:32

      Hello all,

      Can someone suggest me, how to set the " Real borders " for the QDockwidget. Usually Dock comes with no border and only with tittle bar. I want to set the "real border" with color, for the Dock I made some search on google , it does not help me.
      I am using Qt 4.8.5 on Win10.

      check the Image

      thanks and regards,
      Sumi.

      N Offline
      N Offline
      Nouriemm
      wrote on 14 Jan 2016, 15:03 last edited by
      #2

      @N.Sumi
      Try to google Customizing QDockWidget or
      check this link:
      http://doc.qt.io/qt-4.8/stylesheet-examples.html#customizing-qdockwidget

      cheers

      1 Reply Last reply
      0
      • N Offline
        N Offline
        N.Sumi
        wrote on 15 Jan 2016, 13:31 last edited by
        #3

        Hi @Nouriemm ,

        Thank you.
        I tested those Style Sheets.They gave me border inside the Dock. But I am looking for Real Borders for the Dock.

        thanks,
        Sumi.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Jan 2016, 23:44 last edited by
          #4

          Hi,

          The windows decoration themselves are not handle by Qt but by the current Window Manager you are using. Which is it ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 16 Jan 2016, 00:24 last edited by Chris Kawa
            #5

            @N.Sumi said:

            Usually Dock comes with no border and only with tittle bar.

            When dock is detached it is displayed as Tool window (has Qt::Tool window flag). Whether it has a visible border or not depends on the window manager. In Windows 10 tool windows have no visible border except for a shadow you can grab to resize. That's not the case in previous versions of Windows though, which provided a thinner border for tool windows.

            I want to set the "real border"

            If by "real border" you mean a border used for normal windows (not tool windows), which in Windows 10 is a thin colored line, then you'll have to change windows flags of the dock manually when it is detached from main window. Below is a proof-of-concept quality example of a QDockWidget that does that:

            class MyDockWidget : public QDockWidget
            {
            public:
                MyDockWidget(const QString& title, QWidget* parent = nullptr)
                    : QDockWidget(title, parent), detached(false)
                {
                    connect(this, &MyDockWidget::topLevelChanged, [&](bool topLevel)
                    {
                        detached = topLevel; //can't change flags while window is still dragged so just mark as detached
                    });
                }
            
                bool event(QEvent* evt) override
                {
                    if(evt->type() == QEvent::WindowActivate && detached)
                    {
                        detached = false;
                        setWindowFlags(Qt::Window); //adjust flags to add whatever you need e.g. Qt::WindowCloseButtonHint
                        show(); //changing flags hides the window so show it again
                    }
                    return QDockWidget::event(evt);
                }
            
            private:
                bool detached;
            };
            
            
            1 Reply Last reply
            3
            • N Offline
              N Offline
              N.Sumi
              wrote on 18 Jan 2016, 10:10 last edited by
              #6

              @ Chris Kawa

              Yes, It solved the issue . Thanks

              1 Reply Last reply
              0

              6/6

              18 Jan 2016, 10:10

              • Login

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