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. Problem With frameless windows Qdark Style
Qt 6.11 is out! See what's new in the release blog

Problem With frameless windows Qdark Style

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 728 Views 2 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.
  • faduF Offline
    faduF Offline
    fadu
    wrote on last edited by fadu
    #1

    hi i have 2 forms
    and i want to add frameless to the 2 forms when i start first form from main it's 100%
    but when start the second form the application force close
    code in the first form

        FramelessWindow framelessWindow;
        MainWindow *mainWindow = new MainWindow ;
        framelessWindow.setFixedSize(1223,660);
        framelessWindow.setContent(mainWindow);
        framelessWindow.show();
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #9

      Hi
      is it this one ?
      https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle

      Its sample shows

      FramelessWindow framelessWindow;
      as its in main.cpp and it never runs out of scope due to the app.exec()

      However, if you place this in a function
      then
      FramelessWindow framelessWindow;
      must be
      FramelessWindow *framelessWindow = new FramelessWindow ;

      as else it will be deleted as soon as function ends as pr normal c++ scope rules.
      (as @mpergand tries to point you to )

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mpergand
        wrote on last edited by
        #2

        @fadu said in Problem With frameless windows Qdark Style:

        FramelessWindow framelessWindow;
        MainWindow *mainWindow = new MainWindow ;
        framelessWindow.setFixedSize(1223,660);
        framelessWindow.setContent(mainWindow);
        framelessWindow.show();

        Most common newbee mistake posted in this forum !!
        One hint for you: local variable

        1 Reply Last reply
        1
        • faduF Offline
          faduF Offline
          fadu
          wrote on last edited by fadu
          #3

          @mpergand
          why you don't say all solution
          yes i'm new in qt aand if is Forbidden to post here
          i''m sorry for that i don't know

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mpergand
            wrote on last edited by mpergand
            #4

            @fadu said in Problem With frameless windows Qdark Style:

            why you don't say all solution

            Because it's basic C/C++ programming and i think it's essential you find by yourself what's wrong.

            1 Reply Last reply
            0
            • faduF Offline
              faduF Offline
              fadu
              wrote on last edited by
              #5

              @mpergand ok thank you maybe another person help me

              M 1 Reply Last reply
              0
              • faduF fadu

                @mpergand ok thank you maybe another person help me

                M Offline
                M Offline
                mpergand
                wrote on last edited by mpergand
                #6

                @fadu
                I have allready given you the clue: local variable.
                If you don't understand what i'm saying, i think you better have to learn C/C++ in a first place.

                1 Reply Last reply
                1
                • faduF Offline
                  faduF Offline
                  fadu
                  wrote on last edited by fadu
                  #7

                  @mpergand
                  my friend i'm new in qt but i have a good experince in c++ which local varible i need to do that

                  M 1 Reply Last reply
                  0
                  • faduF fadu

                    @mpergand
                    my friend i'm new in qt but i have a good experince in c++ which local varible i need to do that

                    M Offline
                    M Offline
                    mpergand
                    wrote on last edited by
                    #8

                    @fadu
                    All right, in fact i don't understand what you are trying to do ...
                    The all code you posted look utterly bizar to me.

                    Please post the all method where this code is in.
                    What framelessWindow.setContent(mainWindow); is supposed to do ?

                    1 Reply Last reply
                    0
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #9

                      Hi
                      is it this one ?
                      https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle

                      Its sample shows

                      FramelessWindow framelessWindow;
                      as its in main.cpp and it never runs out of scope due to the app.exec()

                      However, if you place this in a function
                      then
                      FramelessWindow framelessWindow;
                      must be
                      FramelessWindow *framelessWindow = new FramelessWindow ;

                      as else it will be deleted as soon as function ends as pr normal c++ scope rules.
                      (as @mpergand tries to point you to )

                      1 Reply Last reply
                      1
                      • faduF Offline
                        faduF Offline
                        fadu
                        wrote on last edited by
                        #10

                        @mrjj said in Problem With frameless windows Qdark Style:

                        FramelessWindow *framelessWindow = new FramelessWindow ;

                        @mrjj yes it is
                        Thank you very much for your wonderful explanation. The problem has been solved as you explained

                        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