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. Can we remove Dialog or Mainwindow written on the top of Application output.
Forum Updated to NodeBB v4.3 + New Features

Can we remove Dialog or Mainwindow written on the top of Application output.

Scheduled Pinned Locked Moved Solved General and Desktop
34 Posts 6 Posters 4.0k 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.
  • A Offline
    A Offline
    Ashutosh_Sachdeva
    wrote on last edited by
    #5

    @mrjj
    i'm using QT 5.13.1

    Yes i have taken dialog box without buttons and i want o remove that dialog caption and that black line

    mrjjM 1 Reply Last reply
    0
    • A Ashutosh_Sachdeva

      @mrjj
      i'm using QT 5.13.1

      Yes i have taken dialog box without buttons and i want o remove that dialog caption and that black line

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Ashutosh_Sachdeva

      Ok so you just call
      setWindowFlag(Qt::FramelessWindowHint,true);
      in dialogs constructor and it should show with no decorations ( Caption and borders)

      1 Reply Last reply
      3
      • A Offline
        A Offline
        Ashutosh_Sachdeva
        wrote on last edited by
        #7

        @mrjj
        Sir, Tried but its throwing the below error

        /home/ashutosh/Ashu_QT/Main_Demo/menu.cpp:10: error: 'class QFrame' has no member named 'setWindowFlag'
        ui->frame->setWindowFlag(Qt::FramelessWindowHint ,true);
        ^

        jsulmJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          Hi,

          Might be a silly question but are you sure about the Qt version you are using ? This method was added in Qt 5.9.

          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
          • A Offline
            A Offline
            Ashutosh_Sachdeva
            wrote on last edited by
            #9

            @SGaist yeah sir i.m sure. Its 5.13.1

            1 Reply Last reply
            0
            • A Ashutosh_Sachdeva

              @mrjj
              Sir, Tried but its throwing the below error

              /home/ashutosh/Ashu_QT/Main_Demo/menu.cpp:10: error: 'class QFrame' has no member named 'setWindowFlag'
              ui->frame->setWindowFlag(Qt::FramelessWindowHint ,true);
              ^

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

              @Ashutosh_Sachdeva said in Can we remove Dialog or Mainwindow written on the top of Application output.:

              ui->frame->setWindowFlag(Qt::FramelessWindowHint ,true);

              Please read again what @mrjj suggested: he suggested to call setWindowFlag(Qt::FramelessWindowHint,true); without ui->frame-> in front of it...

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

              A 1 Reply Last reply
              1
              • A Ashutosh_Sachdeva

                Can we remove the dialog/Black menu line written on the top of the output screen

                Screenshot from 2019-11-24 13_26_17.png

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by J.Hilk
                #11

                hi @Ashutosh_Sachdeva

                I think my fellow poster's may lead you in the wrong direction.

                From what I understand, the function setWindowTitle
                https://doc.qt.io/qt-5/qwidget.html#windowTitle-prop
                is what you're looking for.

                By default the Window Title is the name of your app, and for dialogs its the class name (I think).
                Just use the setWindowTitle function to change it to what ever you like, even an empty string, to not show anything.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                JonBJ 1 Reply Last reply
                1
                • J.HilkJ J.Hilk

                  hi @Ashutosh_Sachdeva

                  I think my fellow poster's may lead you in the wrong direction.

                  From what I understand, the function setWindowTitle
                  https://doc.qt.io/qt-5/qwidget.html#windowTitle-prop
                  is what you're looking for.

                  By default the Window Title is the name of your app, and for dialogs its the class name (I think).
                  Just use the setWindowTitle function to change it to what ever you like, even an empty string, to not show anything.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #12

                  @J-Hilk

                  I think my fellow poster's may lead you in the wrong direction.

                  Nah, I don't think so. The OP wrote:

                  Can we remove the dialog/Black menu line written on the top of the output screen
                  Yes i have taken dialog box without buttons and i want o remove that dialog caption and that black line

                  I think the "black line" does mean he wants the whole of the dialog title (including the button furniture at top-left, whether he has realized that or not) removed, not just the title string itself.

                  So he needs to try dialog->setWindowFlag(Qt::FramelessWindowHint, true);, or this->setWindowFlag(Qt::FramelessWindowHint, true); if he is inside QDialog-derived code.

                  J.HilkJ A 2 Replies Last reply
                  1
                  • JonBJ JonB

                    @J-Hilk

                    I think my fellow poster's may lead you in the wrong direction.

                    Nah, I don't think so. The OP wrote:

                    Can we remove the dialog/Black menu line written on the top of the output screen
                    Yes i have taken dialog box without buttons and i want o remove that dialog caption and that black line

                    I think the "black line" does mean he wants the whole of the dialog title (including the button furniture at top-left, whether he has realized that or not) removed, not just the title string itself.

                    So he needs to try dialog->setWindowFlag(Qt::FramelessWindowHint, true);, or this->setWindowFlag(Qt::FramelessWindowHint, true); if he is inside QDialog-derived code.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #13

                    @JonB oh,
                    I only read the title of this thread ...

                    Can we remove Dialog or Mainwindow written on the top of Application output.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    JonBJ 1 Reply Last reply
                    1
                    • J.HilkJ J.Hilk

                      @JonB oh,
                      I only read the title of this thread ...

                      Can we remove Dialog or Mainwindow written on the top of Application output.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #14

                      @J-Hilk Always pays to read the body of threads too ;-)

                      1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @Ashutosh_Sachdeva said in Can we remove Dialog or Mainwindow written on the top of Application output.:

                        ui->frame->setWindowFlag(Qt::FramelessWindowHint ,true);

                        Please read again what @mrjj suggested: he suggested to call setWindowFlag(Qt::FramelessWindowHint,true); without ui->frame-> in front of it...

                        A Offline
                        A Offline
                        Ashutosh_Sachdeva
                        wrote on last edited by
                        #15

                        @jsulm

                        Yeah tried but its throwing below mentioned error

                        /home/ashutosh/Ashu_QT/Main_Demo/menu.cpp:10: error: 'setWindowFlag' was not declared in this scope
                        setWindowFlag(Qt::FramelessWindowHint,true);

                        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                        i have tried with this "setWindowFlags(Qt::FramelessWindowHint);" as well and thus function is closing the whole window.

                        jsulmJ 1 Reply Last reply
                        0
                        • A Ashutosh_Sachdeva

                          @jsulm

                          Yeah tried but its throwing below mentioned error

                          /home/ashutosh/Ashu_QT/Main_Demo/menu.cpp:10: error: 'setWindowFlag' was not declared in this scope
                          setWindowFlag(Qt::FramelessWindowHint,true);

                          //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                          i have tried with this "setWindowFlags(Qt::FramelessWindowHint);" as well and thus function is closing the whole window.

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

                          @Ashutosh_Sachdeva Please show your code, I do not want to guess...

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

                          A 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @J-Hilk

                            I think my fellow poster's may lead you in the wrong direction.

                            Nah, I don't think so. The OP wrote:

                            Can we remove the dialog/Black menu line written on the top of the output screen
                            Yes i have taken dialog box without buttons and i want o remove that dialog caption and that black line

                            I think the "black line" does mean he wants the whole of the dialog title (including the button furniture at top-left, whether he has realized that or not) removed, not just the title string itself.

                            So he needs to try dialog->setWindowFlag(Qt::FramelessWindowHint, true);, or this->setWindowFlag(Qt::FramelessWindowHint, true); if he is inside QDialog-derived code.

                            A Offline
                            A Offline
                            Ashutosh_Sachdeva
                            wrote on last edited by
                            #17

                            @JonB

                            Sorry, may be i'm doing something wrong but i'm not able to find anyfunction named "Setwindoflag" (this can be stupid but i don't know why this is happening) . And i'f i'm using "setwindowflags" this function is closing the complete page.

                            jsulmJ JonBJ 2 Replies Last reply
                            0
                            • jsulmJ jsulm

                              @Ashutosh_Sachdeva Please show your code, I do not want to guess...

                              A Offline
                              A Offline
                              Ashutosh_Sachdeva
                              wrote on last edited by Ashutosh_Sachdeva
                              #18
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • A Ashutosh_Sachdeva

                                @JonB

                                Sorry, may be i'm doing something wrong but i'm not able to find anyfunction named "Setwindoflag" (this can be stupid but i don't know why this is happening) . And i'f i'm using "setwindowflags" this function is closing the complete page.

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

                                @Ashutosh_Sachdeva said in Can we remove Dialog or Mainwindow written on the top of Application output.:

                                And i'f i'm using "setwindowflags" this function is closing the complete page

                                If using setWindowFlags you need to keep all other flags:

                                setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
                                

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

                                1 Reply Last reply
                                2
                                • A Ashutosh_Sachdeva

                                  @JonB

                                  Sorry, may be i'm doing something wrong but i'm not able to find anyfunction named "Setwindoflag" (this can be stupid but i don't know why this is happening) . And i'f i'm using "setwindowflags" this function is closing the complete page.

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on last edited by
                                  #20

                                  @Ashutosh_Sachdeva said in Can we remove Dialog or Mainwindow written on the top of Application output.:

                                  @JonB
                                  Sorry, may be i'm doing something wrong but i'm not able to find anyfunction named "Setwindoflag" (this can be stupid but i don't know why this is happening) . And i'f i'm using "setwindowflags" this function is closing the complete page.

                                  At no point do I see Setwindoflag [sic.] written by any of us, so why do you write that? Did you search in the documentation for setWindowFlag, where you would have come across https://doc.qt.io/qt-5/qwidget.html#setWindowFlag? Not too hard to find. I have no idea what you mean by "And i'f i'm using "setwindowflags" this function is closing the complete page.", but never mind.

                                  In your code I see:

                                  //setWindowFlags(Qt::FramelessWindowHint);
                                  this->setWindowFlags(Qt::FramelessWindowHint,true);

                                  I don't think the second line should even compile.

                                  You have a class named Menu which derives from QDialog. This is not a helpful name, especially since Qt has a QMenu which is what I initially thought your code would be about. You might like to think about renaming that.

                                  You have pasted hundreds of lines of your code when all you are asking is how to suppress the dialog's title bar.

                                  You need to try exactly what we have been saying. In place of your own attempts at the start of Menu::Menu(), have you tried:

                                  setWindowFlag(Qt::FramelessWindowHint, true);
                                  

                                  If you have, and it gives

                                  error: 'setWindowFlag' was not declared in this scope
                                  

                                  then I would guess you are on a Qt version prior to 5.9? In which case (apart from why not a later one?) it would really help if you said so! As you can see from the doc page, setWindowFlag() was introduced in Qt 5.9. If you are earlier try instead:

                                  setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
                                  

                                  Please use copy & paste to ensure you get this as written.

                                  At that point, does it indeed compile and get rid of the dialog's title bar, as I believe you were asking for?

                                  I have had my grump in this reply :) I hope the above does work for you.

                                  1 Reply Last reply
                                  3
                                  • A Offline
                                    A Offline
                                    Ashutosh_Sachdeva
                                    wrote on last edited by
                                    #21

                                    @jsulm
                                    Thanku So much Sir. setWindowFlags(windowFlags() | Qt::FramelessWindowHint); working fine.

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      Ashutosh_Sachdeva
                                      wrote on last edited by Ashutosh_Sachdeva
                                      #22

                                      @mrjj @jsulm Thanku so much guys for spearing your time and helping. You guys are helping a me lot in learning QT.

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        Ashutosh_Sachdeva
                                        wrote on last edited by
                                        #23

                                        @jsulm Hi,

                                        I have one more doubt here as now i have deleted that main-window title and menu bar so if now i want to come back to my previous page then what will be the method to close current page and go back to previous

                                        1 Reply Last reply
                                        0
                                        • JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on last edited by JonB
                                          #24

                                          Ah well, @mrjj & @jsulm get all the thanks, even when quoting the code I typed into my reply for pre-5.9 which is what the OP needed for his solution (edit whoops, bad hair day :) ). Perhaps I shouldn't have typed in all the stuff it took me time to do....

                                          A 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