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 3.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.
  • poppypelt12P poppypelt12

    Hello, as the title suggests I am having trouble hiding the application(?) bar of a pop-up: d7d88f13-a08e-4516-8974-24b338f1e586-image.png
    I tried using

    self.setWindowFlag(Qt.FramelessWindowHint)
    

    but it didn't work. Please help!!

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

    @poppypelt12 Please show your code, for me it works

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

    poppypelt12P 1 Reply Last reply
    0
    • jsulmJ jsulm

      @poppypelt12 Please show your code, for me it works

      poppypelt12P Offline
      poppypelt12P Offline
      poppypelt12
      wrote on last edited by
      #3

      @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;")
      

      Live, laugh, love

      jsulmJ M 3 Replies Last reply
      0
      • poppypelt12P poppypelt12

        @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;")
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @poppypelt12 Is LegendBar your main window (top level window)?

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

        poppypelt12P 1 Reply Last reply
        0
        • jsulmJ jsulm

          @poppypelt12 Is LegendBar your main window (top level window)?

          poppypelt12P Offline
          poppypelt12P Offline
          poppypelt12
          wrote on last edited by
          #5

          @jsulm no, its a pop up window, i have another main window

          Live, laugh, love

          1 Reply Last reply
          0
          • poppypelt12P poppypelt12

            @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;")
            
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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

            poppypelt12P 2 Replies Last reply
            0
            • jsulmJ jsulm

              @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

              poppypelt12P Offline
              poppypelt12P Offline
              poppypelt12
              wrote on 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
              • jsulmJ jsulm

                @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

                poppypelt12P Offline
                poppypelt12P Offline
                poppypelt12
                wrote on 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
                • poppypelt12P poppypelt12

                  @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 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)

                  poppypelt12P 2 Replies Last reply
                  0
                  • M mpergand

                    @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)

                    poppypelt12P Offline
                    poppypelt12P Offline
                    poppypelt12
                    wrote on 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

                    JonBJ 1 Reply Last reply
                    0
                    • M mpergand

                      @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)

                      poppypelt12P Offline
                      poppypelt12P Offline
                      poppypelt12
                      wrote on 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
                      • poppypelt12P poppypelt12

                        @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;")
                        
                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on 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.

                        poppypelt12P 1 Reply Last reply
                        1
                        • JonBJ JonB

                          @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.

                          poppypelt12P Offline
                          poppypelt12P Offline
                          poppypelt12
                          wrote on 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

                          poppypelt12P 1 Reply Last reply
                          0
                          • poppypelt12P poppypelt12

                            @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!

                            poppypelt12P Offline
                            poppypelt12P Offline
                            poppypelt12
                            wrote on 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

                            JonBJ 1 Reply Last reply
                            0
                            • poppypelt12P poppypelt12 has marked this topic as solved on
                            • poppypelt12P poppypelt12

                              @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!

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on 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? ;-)

                              poppypelt12P 1 Reply Last reply
                              0
                              • JonBJ JonB

                                @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? ;-)

                                poppypelt12P Offline
                                poppypelt12P Offline
                                poppypelt12
                                wrote on last edited by
                                #16

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

                                Live, laugh, love

                                1 Reply Last reply
                                1

                                • Login

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