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. How fix a window on screen(not draggable)
Forum Updated to NodeBB v4.3 + New Features

How fix a window on screen(not draggable)

Scheduled Pinned Locked Moved General and Desktop
10 Posts 6 Posters 2.7k 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.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello experts,

    I am opening a small window on my main window.
    For these I am using below code :-

    @ objCheckLicense = new CheckLicense(this);
    objCheckLicense->setModal(true);
    objCheckLicense->show();
    //for diasble size change
    objCheckLicense->setFixedSize(objCheckLicense->size());@

    Currently I can drag/move these small window on my main window using mouse.

    I want to fix these window, I mean not draggable.

    Is these possible in QT?

    Thanks in advance.
    Zain

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi Zain,

      first of all: What widget type does CheckLicense have?
      Is it a dialog?
      This has some impact on this question...

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zain
        wrote on last edited by
        #3

        Hello Gerolf,

        Thanks for your quick reply and sorry for late response.

        Yes, objCheckLicense is a object of QDialog.

        Please let me know if you want any other information.

        Thanks
        Zain

        ManiRonM 1 Reply Last reply
        0
        • Z Zain

          Hello Gerolf,

          Thanks for your quick reply and sorry for late response.

          Yes, objCheckLicense is a object of QDialog.

          Please let me know if you want any other information.

          Thanks
          Zain

          ManiRonM Offline
          ManiRonM Offline
          ManiRon
          wrote on last edited by ManiRon
          #4

          @jsulm @JonB @J.Hilk yes i face the same issue in the QDialog how to make it not draggable by the mouse ?

          jsulmJ J.HilkJ 2 Replies Last reply
          0
          • ManiRonM ManiRon

            @jsulm @JonB @J.Hilk yes i face the same issue in the QDialog how to make it not draggable by the mouse ?

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

            @ManiRon First: do not post in a 6 years old thread - open your own instead.
            Second: do not contact people directly like you did here-

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

            1 Reply Last reply
            2
            • ManiRonM ManiRon

              @jsulm @JonB @J.Hilk yes i face the same issue in the QDialog how to make it not draggable by the mouse ?

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

              @ManiRon first of, what @jsulm said is true, keep than in mind for the future.

              secondly, if it's enough for you, you can simply set the window flag to frameless:

              QDialog *dlg = new QDialog();
                  dlg->setWindowFlag(Qt::FramelessWindowHint);
                  dlg->exec();
              

              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.

              ManiRonM 1 Reply Last reply
              2
              • J.HilkJ J.Hilk

                @ManiRon first of, what @jsulm said is true, keep than in mind for the future.

                secondly, if it's enough for you, you can simply set the window flag to frameless:

                QDialog *dlg = new QDialog();
                    dlg->setWindowFlag(Qt::FramelessWindowHint);
                    dlg->exec();
                
                ManiRonM Offline
                ManiRonM Offline
                ManiRon
                wrote on last edited by
                #7

                @J.Hilk sorry to both of you guys i didnt knew that

                And if i want to the frame of the window and i want to make it not draggable , can we do it?

                mrjjM 1 Reply Last reply
                0
                • ManiRonM ManiRon

                  @J.Hilk sorry to both of you guys i didnt knew that

                  And if i want to the frame of the window and i want to make it not draggable , can we do it?

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

                  @ManiRon
                  Hi
                  Its the OS that does the "dragging" so if it has caption, its draggable on most platforms.

                  Can i ask why you want such window ?

                  ManiRonM 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    @ManiRon
                    Hi
                    Its the OS that does the "dragging" so if it has caption, its draggable on most platforms.

                    Can i ask why you want such window ?

                    ManiRonM Offline
                    ManiRonM Offline
                    ManiRon
                    wrote on last edited by
                    #9

                    @mrjj making an application in which i want the Qdialog not to be draggable

                    mrjjM 1 Reply Last reply
                    0
                    • ManiRonM ManiRon

                      @mrjj making an application in which i want the Qdialog not to be draggable

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

                      @ManiRon
                      ok but its the os that controls it so if Dialog has caption, user are allowed to drag it.
                      Also on some platforms, one can hold ctrl down and drag the window anyway so
                      hiding caption does not even work on all platforms.

                      1 Reply Last reply
                      3

                      • Login

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