Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickView resizing using mouse problem
Forum Updated to NodeBB v4.3 + New Features

QQuickView resizing using mouse problem

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 422 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.
  • P Offline
    P Offline
    PonzifexMaximus
    wrote on last edited by PonzifexMaximus
    #1

    Hi there,
    I have problem resizing the window using this example. It works, but unpredictable when it becomes unresponsive. Window minimization and maximization works every time, but resizing with the mouse causes weird behavior. What I do wrong here?
    Thanks!

    #include <QGuiApplication>
    #include <QQuickView>
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
        QQuickView view;
        view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
        view.show();
        return app.exec();
    }
    

    And this is the main QML code:

    import QtQuick 2.10
    Rectangle {
        anchors.fill: parent
        color: "yellow"
    }
    
    raven-worxR 1 Reply Last reply
    0
    • P PonzifexMaximus

      Hi there,
      I have problem resizing the window using this example. It works, but unpredictable when it becomes unresponsive. Window minimization and maximization works every time, but resizing with the mouse causes weird behavior. What I do wrong here?
      Thanks!

      #include <QGuiApplication>
      #include <QQuickView>
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
          QQuickView view;
          view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
          view.show();
          return app.exec();
      }
      

      And this is the main QML code:

      import QtQuick 2.10
      Rectangle {
          anchors.fill: parent
          color: "yellow"
      }
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @PonzifexMaximus

      view.setResizeMode(QQuickView::SizeRootObjectToView);
      

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

      P 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @PonzifexMaximus

        view.setResizeMode(QQuickView::SizeRootObjectToView);
        
        P Offline
        P Offline
        PonzifexMaximus
        wrote on last edited by
        #3

        @raven-worx
        Thanks, I was expecting that the root element will behave like the other elements so it can be anchored to it's parent (window)
        I had to get rid of anchors.fill: parent from the root element otherwise it will cause the window freeze. At least the resizing.

        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