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. Layouting in QT Designer

Layouting in QT Designer

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 965 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.
  • B Offline
    B Offline
    Boris1980
    wrote on last edited by
    #1

    Hello guys,

    i have installed the Qt4.8.7 sdk in my VS2008 enviroment. No iam able to develop some Qt code. I have greated a simple QtApplication with QMainWindow. The layout of my gui is pure coded in cpp. I could use the Qt Designer to layout my gui elements but its ugly... an do it in the code too.

    Iam from the .NET WPF world, the its possible to do the layout via XAML. So i have find out, that its possible in Qt via QML to. But no the question. Its it possible to layout (with preview) my gui via QML in the QT Designer, like XAML in WPF?

    Sorry for my bad english

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      My inputs. Qt 4.8.7 is very old Qt version. You can think of using the new Qt. Qt Widgets and QML(QtQuick) are different ways to write the UI.

      You can use the Qt Designer for creating the user interface. Designer is available for QtWIdgets and QML also. Unlike XAML, Qt Designer is not like you write something in XML and it will start the UI. When you do UI in Qt Designer, it creates the XML file only.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Boris1980
        wrote on last edited by
        #3

        Good Morning , thank for replay:)

        Unfortunately i have to use the 4.8.7 Version because of 2008 C++ compatibility.

        My intension is, to create the ui layout via QML in QT Designer , and see the result directly (like XAML Rendering in Visual Studio). After i have do this, QT Diesinger can create me the layout code for my app (Moc compiler). Is this possible? Its very strange an need a lot of time , to layout the ui in code and ervery change need a new build and start the app to see se result

        J.HilkJ 1 Reply Last reply
        0
        • B Boris1980

          Good Morning , thank for replay:)

          Unfortunately i have to use the 4.8.7 Version because of 2008 C++ compatibility.

          My intension is, to create the ui layout via QML in QT Designer , and see the result directly (like XAML Rendering in Visual Studio). After i have do this, QT Diesinger can create me the layout code for my app (Moc compiler). Is this possible? Its very strange an need a lot of time , to layout the ui in code and ervery change need a new build and start the app to see se result

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

          @Boris1980 said in Layouting in QT Designer:

          Good Morning , thank for replay:)
          Its very strange an need a lot of time , to layout the ui in code and ervery change need a new build and start the app to see se result

          no it doesn't QML code is interpreted code no need to recompile your whole application. You just need to reload your QML file

          I have this code inside my main.cpp that I'm calling when I press F5 inside my app. very handy to have:

          void clearAndReload( QQmlApplicationEngine &engine){
              for(QObject *obj : engine.rootObjects()){
                  engine.rootObjects().removeOne(obj);
                  obj->deleteLater();
              }
              engine.clearComponentCache();
              engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          
              for(QObject *obj : engine.rootObjects()){
                  QuickWindow *window = qobject_cast<QuickWindow*>(obj);
                  if(window)QObject::connect(window, &QuickWindow::reloadQML, &engine,[&engine]{clearAndReload(engine);});
              }
          }
          
          {
          .....
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          
          for(QObject *obj : engine.rootObjects()){
                  //I have a custom root element class, normaly this should be QQuickWindow
                  QuickWindow *window = qobject_cast<QuickWindow*>(obj);
                  if(window) QObject::connect(window, &QuickWindow::reloadQML, &engine,[&engine]{clearAndReload(engine);});
              }
          
          ....
          

          My intension is, to create the ui layout via QML in QT Designer , and see the result directly (like XAML Rendering in Visual Studio). After i have do this, QT Diesinger can create me the layout code for my app (Moc compiler). Is this possible?

          The QtCreator allows for a preview of your QML files if you simply click, when you're inside the QML file onto the Design tab and you get that one. It won't show aynthing however if your QML-code does not have default sizes.


          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.

          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