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. "Unable to set geometry" after removing "Qt::FramelessWindowHint"

"Unable to set geometry" after removing "Qt::FramelessWindowHint"

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 983 Views
  • 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.
  • PrahlhansP Offline
    PrahlhansP Offline
    Prahlhans
    wrote on last edited by Prahlhans
    #1

    Hi,
    i have a Window with some subwidgets.
    on buttonpress F10 i am toggeling the WindowFlag Qt::FramelessWindowHint.
    But every time the flag is removed the window is not resized properly and the bottom half of the text is cut away.
    also, everytime i call a function to resize the font and redraw the window i get an "unable to set geometry" error

    Has somebody encountered a similar problem or knows how to solve this?

    before
    after

    some code:

    if(e->key() == Qt::Key_F10){
                framelessToggle = !framelessToggle;
                if(framelessToggle){
                    this->setWindowFlags(this->windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
    
                } else {
                    Qt::WindowFlags flags = this->windowFlags();
                    flags ^=  Qt::FramelessWindowHint;
                    this->setWindowFlags(flags);
                }
                doLayout();
            return;
        }
    
    void Comp_Messwertanzeige::doLayout(){
        // do some layouting
        for(int i = 0; i<widgetlist->length();i++){
             widgetlist->at(i)->doLayout();
        }
    
        this->show();
        this->adjustSize();
    }
    

    the widgets in the widgetlist also use adjustSize()
    on changing the fontsize the function doLayout() is called

    raven-worxR 1 Reply Last reply
    0
    • PrahlhansP Prahlhans

      Hi,
      i have a Window with some subwidgets.
      on buttonpress F10 i am toggeling the WindowFlag Qt::FramelessWindowHint.
      But every time the flag is removed the window is not resized properly and the bottom half of the text is cut away.
      also, everytime i call a function to resize the font and redraw the window i get an "unable to set geometry" error

      Has somebody encountered a similar problem or knows how to solve this?

      before
      after

      some code:

      if(e->key() == Qt::Key_F10){
                  framelessToggle = !framelessToggle;
                  if(framelessToggle){
                      this->setWindowFlags(this->windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
      
                  } else {
                      Qt::WindowFlags flags = this->windowFlags();
                      flags ^=  Qt::FramelessWindowHint;
                      this->setWindowFlags(flags);
                  }
                  doLayout();
              return;
          }
      
      void Comp_Messwertanzeige::doLayout(){
          // do some layouting
          for(int i = 0; i<widgetlist->length();i++){
               widgetlist->at(i)->doLayout();
          }
      
          this->show();
          this->adjustSize();
      }
      

      the widgets in the widgetlist also use adjustSize()
      on changing the fontsize the function doLayout() is called

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Prahlhans

      1. i suggest you reset the window flags on every toggle. Meaning don't operate on the current window flags but completely reset them accordingly to your needs
      2. why don't you simply resize the window to it's sizeHint()? This should already include all the layout metrics (assuming you used QLayouts in your widgets)

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

      • Login

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