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. QT widget design - square under main window
Forum Updated to NodeBB v4.3 + New Features

QT widget design - square under main window

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 531 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.
  • S Offline
    S Offline
    StenGay
    wrote on 1 Jun 2023, 22:34 last edited by
    #1

    My setup is like this:

    main.cpp:

    //Window customization
    w.setWindowFlags(w.windowFlags() | Qt::FramelessWindowHint);
    w.setAttribute(Qt::WA_TranslucentBackground);
    

    Stylesheet:

    #centralwidget  {
    	border-radius:20px;
    }
    

    And the widget then looks like this:

    Capture.PNG

    As you can see there's a rectangle att the bottom. How can I identify what element this is, remove it or if I cant, atleast cover it with the rounded widget by moving it up/moving main widget down?

    P 1 Reply Last reply 2 Jun 2023, 03:44
    0
    • S StenGay
      1 Jun 2023, 22:34

      My setup is like this:

      main.cpp:

      //Window customization
      w.setWindowFlags(w.windowFlags() | Qt::FramelessWindowHint);
      w.setAttribute(Qt::WA_TranslucentBackground);
      

      Stylesheet:

      #centralwidget  {
      	border-radius:20px;
      }
      

      And the widget then looks like this:

      Capture.PNG

      As you can see there's a rectangle att the bottom. How can I identify what element this is, remove it or if I cant, atleast cover it with the rounded widget by moving it up/moving main widget down?

      P Offline
      P Offline
      Pl45m4
      wrote on 2 Jun 2023, 03:44 last edited by Pl45m4 6 Feb 2023, 04:30
      #2

      @StenGay said in QT widget design - square under main window:

      As you can see there's a rectangle att the bottom. How can I identify what element this is, remove it or if I cant, atleast cover it with the rounded widget by moving it up/moving main widget down?

      There is no "square" under your mainWindow... It's a part of it ;-)
      Took me minutes of looking at the image to see what you are talking about. Better point to it directly in the image or something :)
      Your the color scheme of your desktop background also doesn't help :)

      #centralwidget {
      border-radius:20px;
      }

      You only set rounded corners to your centralWidget and not the whole window.
      The area below is exactly what is not part of your centralWidget.

      See:

      • https://doc.qt.io/qt-6/qmainwindow.html#qt-main-window-framework

      If you dont need the QMainWindow related stuff (menuBars, statusBars, etc) you could replace it with your inner widget. Then it should look like desired.

      Edit:

      If I'm not mistaken, the part which bothers you, is the QStatusBar.
      Quick and dirty fix:
      (I still would consider moving to a plain QWidget and start from there)

       w.statusBar()->hide();
      

      You can even remove it from your UI file, if you design your base MainWindow in QtDesigner. Go to Design Mode, right-click on your MainWindow or on "MainWindow" in the object list at the top right and select "Remove StatusBar" or find the QStatusBar in the object list directly and delete it.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      S 1 Reply Last reply 2 Jun 2023, 12:48
      0
      • P Pl45m4
        2 Jun 2023, 03:44

        @StenGay said in QT widget design - square under main window:

        As you can see there's a rectangle att the bottom. How can I identify what element this is, remove it or if I cant, atleast cover it with the rounded widget by moving it up/moving main widget down?

        There is no "square" under your mainWindow... It's a part of it ;-)
        Took me minutes of looking at the image to see what you are talking about. Better point to it directly in the image or something :)
        Your the color scheme of your desktop background also doesn't help :)

        #centralwidget {
        border-radius:20px;
        }

        You only set rounded corners to your centralWidget and not the whole window.
        The area below is exactly what is not part of your centralWidget.

        See:

        • https://doc.qt.io/qt-6/qmainwindow.html#qt-main-window-framework

        If you dont need the QMainWindow related stuff (menuBars, statusBars, etc) you could replace it with your inner widget. Then it should look like desired.

        Edit:

        If I'm not mistaken, the part which bothers you, is the QStatusBar.
        Quick and dirty fix:
        (I still would consider moving to a plain QWidget and start from there)

         w.statusBar()->hide();
        

        You can even remove it from your UI file, if you design your base MainWindow in QtDesigner. Go to Design Mode, right-click on your MainWindow or on "MainWindow" in the object list at the top right and select "Remove StatusBar" or find the QStatusBar in the object list directly and delete it.

        S Offline
        S Offline
        StenGay
        wrote on 2 Jun 2023, 12:48 last edited by
        #3

        @Pl45m4 said in QT widget design - square under main window:

        Took me minutes of looking at the image to see what you are talking about. Better point to it directly in the image or something :)
        Your the color scheme of your desktop background also doesn't help :)

        Sorry about that 😄

        Thanks for the reply, I'll try that once I get home to my computer!

        1 Reply Last reply
        0

        1/3

        1 Jun 2023, 22:34

        • Login

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