Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Hide title/application bar in python Pyside6
Forum Updated to NodeBB v4.3 + New Features

Hide title/application bar in python Pyside6

Scheduled Pinned Locked Moved Solved Qt for Python
16 Posts 4 Posters 4.5k 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.
  • P poppypelt12
    25 Sept 2023, 06:56

    @jsulm Okay, here it is:

    class LegendBar(QWidget):
        def __init__(self):
            super(LegendBar, self).__init__()
            self.setWindowFlag(Qt.FramelessWindowHint)
            self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)
            self.initUI()
    
        def initUI(self):
            self.setWindowTitle("LegendBar")
            self.setGeometry(1400, 0, 400, 1080)  # Set the dimensions of the LegendBar
            self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint)  # Ensure it's on top
            self.setStyleSheet("background-color:#3C413C;")
    
    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 25 Sept 2023, 07:32 last edited by
    #6

    @poppypelt12 said in Hide title/application bar in python Pyside6:

    self.setWindowFlag(Qt.FramelessWindowHint)
    self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)

    If I change the order of these two lines it works for me

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

    P 2 Replies Last reply 25 Sept 2023, 07:33
    0
    • J jsulm
      25 Sept 2023, 07:32

      @poppypelt12 said in Hide title/application bar in python Pyside6:

      self.setWindowFlag(Qt.FramelessWindowHint)
      self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)

      If I change the order of these two lines it works for me

      P Offline
      P Offline
      poppypelt12
      wrote on 25 Sept 2023, 07:33 last edited by
      #7

      @jsulm I just tried that, it didnt disappear, however it changed the look of it: 592ae310-184d-4e2d-9b89-3f22c41b9d23-image.png

      Live, laugh, love

      1 Reply Last reply
      0
      • J jsulm
        25 Sept 2023, 07:32

        @poppypelt12 said in Hide title/application bar in python Pyside6:

        self.setWindowFlag(Qt.FramelessWindowHint)
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)

        If I change the order of these two lines it works for me

        P Offline
        P Offline
        poppypelt12
        wrote on 25 Sept 2023, 07:34 last edited by
        #8

        @jsulm Nevermind, that only happened on the first run, its the same as before :(

        Live, laugh, love

        1 Reply Last reply
        0
        • P poppypelt12
          25 Sept 2023, 06:56

          @jsulm Okay, here it is:

          class LegendBar(QWidget):
              def __init__(self):
                  super(LegendBar, self).__init__()
                  self.setWindowFlag(Qt.FramelessWindowHint)
                  self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)
                  self.initUI()
          
              def initUI(self):
                  self.setWindowTitle("LegendBar")
                  self.setGeometry(1400, 0, 400, 1080)  # Set the dimensions of the LegendBar
                  self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint)  # Ensure it's on top
                  self.setStyleSheet("background-color:#3C413C;")
          
          M Offline
          M Offline
          mpergand
          wrote on 25 Sept 2023, 08:56 last edited by
          #9

          @poppypelt12 said in Hide title/application bar in python Pyside6:

          self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # Ensure it's on top

          It ruins the first one, use OR operator:
          self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint)

          P 2 Replies Last reply 25 Sept 2023, 09:13
          0
          • M mpergand
            25 Sept 2023, 08:56

            @poppypelt12 said in Hide title/application bar in python Pyside6:

            self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # Ensure it's on top

            It ruins the first one, use OR operator:
            self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint)

            P Offline
            P Offline
            poppypelt12
            wrote on 25 Sept 2023, 09:13 last edited by
            #10

            @mpergand changed it to this, still doesn't work :(

            class LegendBar(QWidget):
                def __init__(self):
                    super(LegendBar, self).__init__()
                    self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)
                    self.setWindowFlag(Qt.FramelessWindowHint)
                    self.initUI()
            
                def initUI(self):
                    self.setWindowTitle("LegendBar")
                    self.setGeometry(1400, 0, 400, 1080)  # Set the dimensions of the LegendBar
                    self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint)  # Ensure it's on top
                    self.setStyleSheet("background-color:#3C413C;")
            

            Live, laugh, love

            J 1 Reply Last reply 25 Sept 2023, 09:24
            0
            • M mpergand
              25 Sept 2023, 08:56

              @poppypelt12 said in Hide title/application bar in python Pyside6:

              self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # Ensure it's on top

              It ruins the first one, use OR operator:
              self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint)

              P Offline
              P Offline
              poppypelt12
              wrote on 25 Sept 2023, 09:16 last edited by
              #11

              @mpergand Alright, so, I changed it to this:

                      self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint)
              
              

              However, it isnt 'clickable' anymore and the button inside it has completely disappeared...

              Live, laugh, love

              1 Reply Last reply
              0
              • P poppypelt12
                25 Sept 2023, 09:13

                @mpergand changed it to this, still doesn't work :(

                class LegendBar(QWidget):
                    def __init__(self):
                        super(LegendBar, self).__init__()
                        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Tool)
                        self.setWindowFlag(Qt.FramelessWindowHint)
                        self.initUI()
                
                    def initUI(self):
                        self.setWindowTitle("LegendBar")
                        self.setGeometry(1400, 0, 400, 1080)  # Set the dimensions of the LegendBar
                        self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint)  # Ensure it's on top
                        self.setStyleSheet("background-color:#3C413C;")
                
                J Offline
                J Offline
                JonB
                wrote on 25 Sept 2023, 09:24 last edited by JonB
                #12

                @poppypelt12 said in Hide title/application bar in python Pyside6:

                self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint) # Ensure it's on top

                You realize this undoes the work (Qt.Tool) in __init__(), right? Don't know if it makes a difference, but at least get something consistent.

                P.S.
                For now and the future, if you download https://doc.qt.io/qtforpython-6/overviews/qtwidgets-widgets-windowflags-example.html you can play with all the window flags to see all the effects you can get.

                P 1 Reply Last reply 25 Sept 2023, 10:09
                1
                • J JonB
                  25 Sept 2023, 09:24

                  @poppypelt12 said in Hide title/application bar in python Pyside6:

                  self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint or Qt.FramelessWindowHint) # Ensure it's on top

                  You realize this undoes the work (Qt.Tool) in __init__(), right? Don't know if it makes a difference, but at least get something consistent.

                  P.S.
                  For now and the future, if you download https://doc.qt.io/qtforpython-6/overviews/qtwidgets-widgets-windowflags-example.html you can play with all the window flags to see all the effects you can get.

                  P Offline
                  P Offline
                  poppypelt12
                  wrote on 25 Sept 2023, 10:09 last edited by
                  #13

                  @JonB Yes, well, i removed that and now I'm getting this for some reason: 6253018b-24a4-4260-9985-25ca519574da-image.png

                  instead of this: 833284df-4ebf-4631-986f-0d81b36789dd-image.png

                  I just want the window frame to be hidden!

                  Live, laugh, love

                  P 1 Reply Last reply 25 Sept 2023, 10:35
                  0
                  • P poppypelt12
                    25 Sept 2023, 10:09

                    @JonB Yes, well, i removed that and now I'm getting this for some reason: 6253018b-24a4-4260-9985-25ca519574da-image.png

                    instead of this: 833284df-4ebf-4631-986f-0d81b36789dd-image.png

                    I just want the window frame to be hidden!

                    P Offline
                    P Offline
                    poppypelt12
                    wrote on 25 Sept 2023, 10:35 last edited by
                    #14

                    @poppypelt12 Alright so. I changed the width of the pop-up to 880 instead of 1080 and it works now so, i guess its solved!

                    Live, laugh, love

                    J 1 Reply Last reply 25 Sept 2023, 10:37
                    0
                    • P poppypelt12 has marked this topic as solved on 25 Sept 2023, 10:35
                    • P poppypelt12
                      25 Sept 2023, 10:35

                      @poppypelt12 Alright so. I changed the width of the pop-up to 880 instead of 1080 and it works now so, i guess its solved!

                      J Offline
                      J Offline
                      JonB
                      wrote on 25 Sept 2023, 10:37 last edited by JonB
                      #15

                      @poppypelt12
                      In your code you show nothing about adding any widgets onto the LegendBar. Did you put some layout on it? Maybe you just want left-aligned regardless of width?

                      P.S.
                      Can I buy toilet paper from your app? ;-)

                      P 1 Reply Last reply 25 Sept 2023, 16:05
                      0
                      • J JonB
                        25 Sept 2023, 10:37

                        @poppypelt12
                        In your code you show nothing about adding any widgets onto the LegendBar. Did you put some layout on it? Maybe you just want left-aligned regardless of width?

                        P.S.
                        Can I buy toilet paper from your app? ;-)

                        P Offline
                        P Offline
                        poppypelt12
                        wrote on 25 Sept 2023, 16:05 last edited by
                        #16

                        @JonB Lol!! :-)) its an app for nursing homes

                        Live, laugh, love

                        1 Reply Last reply
                        1

                        15/16

                        25 Sept 2023, 10:37

                        • Login

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