Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › window size change runtime customize

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16080

    Bas

    hi,

     

    is it posible to change the window size list, so i could add custom sizes?

    gr,

    Bas

    #16082

    Günther
    Felgo Team

    Hi Bas,

    we do not allow to modify the debug menu bar with custom resolutions at the moment.

    But you can implement your own solution with a small workaround:

    import Felgo 3.0
    import QtQuick 2.0
    import QtQuick.Window 2.2
    
    App {
      id: app
    
      // resize window on button click
      AppButton {
        text: "Resize Window"
    
        // properties of new target device (e.g. values that match iPhone 6)
        property real deviceWidth: 750
        property real deviceHeight: 1334
        property int deviceDpi: 326
    
        // set new window size and uiScale on button click
        onClicked: {
          // calculate scale-factor to fit window on screen if width/height too big for screen (for landscape or portrait)
          var targetWidth = app.width < app.height ? deviceWidth : deviceHeight
          var targetHeight = app.width < app.height ? deviceHeight : deviceWidth
          var windowScale = Math.min(Math.round(Screen.desktopAvailableWidth * 0.9) / targetWidth, Math.round(Screen.desktopAvailableHeight * 0.9) / targetHeight, 1.0)
    
          // set new size and uiScale
          app.setScreenSize(Math.round(targetWidth * windowScale), Math.round(targetHeight * windowScale)) // resize window
          app.uiScale = deviceDpi / (Screen.pixelDensity * 25.4) * windowScale // resize UI to match device dpi
        }
      }
    
    }
    

     

    Cheers,
    Günther

     

    #24577

    Cezary

    Is this feature on your Felgo roadmap?

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded