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. Hiding parts of QDialog
Qt 6.11 is out! See what's new in the release blog

Hiding parts of QDialog

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.0k 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.
  • M Offline
    M Offline
    Minz
    wrote on last edited by
    #1

    I changed from Qt 4.8.4 to 5.0.2, when I execute my application I get a warning about setGeometry: violating constraints of window,but the code doesnt even use setGeometry. The idea is that when I click a certain button parts of my dialog should hide, and the dialog size should change to suit the needs of the remaining contents. PLEASE HELP

    Here is the code,its actually a custom slot:
    @
    void KeyBoardDialog::showHideKeyboard(){
    if(ui->MainFrame->isVisible()){
    ui->MainFrame->hide();
    this->setFixedHeight(this->height()-320);
    ui->pushButtonHideKeyBoard->setText("Show Keyboard");
    }

    else {
        ui->MainFrame->show();
        this->setFixedHeight(this->height()+320);
        ui->pushButtonHideKeyBoard->setText("Hide Keyboard");
    }
    

    }
    @

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      I have added code tags for increased readability. Please check out the "forum guidelines":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 and use code tags next time.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Minz
        wrote on last edited by
        #3

        ok thanks, first timer

        1 Reply Last reply
        0
        • J Offline
          J Offline
          john_god
          wrote on last edited by
          #4

          Hi Minz
          Can you debug the value of (this->height()-320) ? I wonder if you are inputing a negative value in setFixedHeight(), that would cause that warning ?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Minz
            wrote on last edited by
            #5

            Just debugged it, the original height is 651, which becomes 331 after subtracting 320. The value of height alternates between 651 and 331. Also, it not only gives a warning but makes the background of my text widgets black.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Minz
              wrote on last edited by
              #6

              Before I switched to a 5.0.2 compiler it was working fine, I initially had 4.8.4, but since the project i'm working on will be assessed on a machine with qt 5, i had to change it. Gratitude to whoever can help

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                maybe this may help you:
                @
                this->setFixedSize( QLayout::closestAcceptableSize ( this, this->size()-QSize(0,320) ) );
                @

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Minz
                  wrote on last edited by
                  #8

                  will try it, thanks for ur concern

                  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