Announcement

Collapse
No announcement yet.

Qt 5.0 Beta Not Here Due To Difficulties

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by ShadowBane View Post
    You don't have to use javascript... The GUI is done using a markup language and the code can be in C++.
    Not sure what you're talking about. The only way to access the QML stuff is... QML. You can't get to it through C++.

    Look at http://labs.qt.nokia.com/2012/08/08/...-text-in-qml-2 for example:

    Code:
    Text {
        text: "Some text"
        renderType: Text.NativeRendering
    }
    renderType? What is that? How do I set it to "Text.NativeRendering" through C++?

    Comment


    • #22
      Originally posted by RealNC View Post
      Not sure what you're talking about. The only way to access the QML stuff is... QML. You can't get to it through C++.

      Look at http://labs.qt.nokia.com/2012/08/08/...-text-in-qml-2 for example:

      Code:
      Text {
          text: "Some text"
          renderType: Text.NativeRendering
      }
      renderType? What is that? How do I set it to "Text.NativeRendering" through C++?
      http://qt-project.org/doc/qt-4.8/qtb...ing-qml-with-c

      there you go, have a read.

      Comment


      • #23
        Originally posted by GabrielYYZ View Post
        Thanks, but that just for loading QML files. You can't replace the *.qml file with C++ code. How do you write this:

        Code:
         import QtQuick 1.0
        
         Item {
             width: 100; height: 100
        
             Rectangle {
                 anchors.fill: parent
                 objectName: "rect"
             }
         }
        in C++?

        Comment


        • #24
          Originally posted by RealNC View Post
          Thanks, but that just for loading QML files. You can't replace the *.qml file with C++ code. How do you write this:

          Code:
           import QtQuick 1.0
          
           Item {
               width: 100; height: 100
          
               Rectangle {
                   anchors.fill: parent
                   objectName: "rect"
               }
           }
          in C++?
          Code:
          #include <QtGui/QMainWindow>
          #include <QtGui/QWidget>
          
          QMainWindow *window = new QMainWindow;
          window->setMinimumSize(100, 100);
          
          QWidget *rectangle = new QWidget(window);
          item->setObjectName("rect");
          
          window->setCentralWidget(rectangle);
          I guess that would be one way. There are errors in there and i left out a lot of boilerplate (so that won't compile) but it's the same idea, i think.

          ps: that anchors.fill property i think is covered by layout contained in a QMainWindow central widget area. i don't really know much QML, so that's just an educated guess.
          Last edited by GabrielYYZ; 08-17-2012, 05:42 PM.

          Comment


          • #25
            2 things for clarification

            1.) the theme on screenshot is NOT GTK is QT internal Theme plastic which is in every version of QT since 2.x and is selectable using qtconfig

            1.a) Oxygen is part of KDE not QT and since the ABI changed is perfectly normal it doesnt load but it will be ported once KDE5 starts[i think is WIP now]

            1.b) The font issue is probably an antialiasing setting since normally you set it from KDE or the render backend used, i guess we have to wait until KDE5 reach alpha 1

            2.) QML uses scenegraph and yes is JS and it has some feature the C++ codepath miss but you still can write your app 100% in C++ or in mixed mode [QML gui / logic C++], so for now QML is like QtScript was an AddOn that provide some goodies and i very likely due to pressure that scenegraph will become available for C++ API in a subsequent revision but is not like Qt is 100% javascript now or anything like it

            Comment


            • #26
              Originally posted by GabrielYYZ View Post
              Code:
              #include <QtGui/QMainWindow>
              #include <QtGui/QWidget>
              
              QMainWindow *window = new QMainWindow;
              window->setMinimumSize(100, 100);
              
              QWidget *rectangle = new QWidget(window);
              item->setObjectName("rect");
              
              window->setCentralWidget(rectangle);
              I guess that would be one way. There are errors in there and i left out a lot of boilerplate (so that won't compile) but it's the same idea, i think.

              ps: that anchors.fill property i think is covered by layout contained in a QMainWindow central widget area. i don't really know much QML, so that's just an educated guess.
              Qt Quick doesn't use QWidget-derived classes. It's a completely new GUI implementation. And you can't use that new implementation from C++. It's a QML-exclusive. Only QML gets to access it. And I find that sad.

              So the code you posted has nothing to do with the QML code. Not even at the lowest level; different code is used for Qt Quick.

              Comment


              • #27
                Originally posted by RealNC View Post
                Thanks, but that just for loading QML files. You can't replace the *.qml file with C++ code. How do you write this:

                Code:
                 import QtQuick 1.0
                
                 Item {
                     width: 100; height: 100
                
                     Rectangle {
                         anchors.fill: parent
                         objectName: "rect"
                     }
                 }
                in C++?
                You don't. The idea is that you use QML for the same things you would use a Qt Designer form for, except that you have greater control over the QML than you would with the visual designer.

                Comment


                • #28
                  Originally posted by RealNC View Post
                  Qt Quick doesn't use QWidget-derived classes. It's a completely new GUI implementation. And you can't use that new implementation from C++. It's a QML-exclusive. Only QML gets to access it. And I find that sad.

                  So the code you posted has nothing to do with the QML code. Not even at the lowest level; different code is used for Qt Quick.
                  I think it was said in a Blog, they want you to do the UI code in QML and logic in C++.
                  Anyways, QML uses it's own widgets like you said, so Qwidget will still be the preferred way of doing desktop applications as only it uses the native style. The QML desktop components won't make it until Qt 5.1 (from what I have heard, could be wrong here).

                  Comment


                  • #29
                    Originally posted by ShadowBane View Post
                    You don't. The idea is that you use QML for the same things you would use a Qt Designer form for, except that you have greater control over the QML than you would with the visual designer.
                    I don't see how this relates to not being able to do the same in C++.

                    Comment


                    • #30
                      Originally posted by RealNC View Post
                      Qt Quick doesn't use QWidget-derived classes. It's a completely new GUI implementation. And you can't use that new implementation from C++. It's a QML-exclusive. Only QML gets to access it. And I find that sad.

                      So the code you posted has nothing to do with the QML code. Not even at the lowest level; different code is used for Qt Quick.
                      I don't really get what you're saying or what you're sad about...

                      I agree that Qt Quick doesn't use QWidget-derived classes and that it's a completely new way to do GUI but you can use it from C++ (see QDeclarativeEngine). The code i posted is not how you would interface with QML, it's just a way to do that QML thing using C++ widgets. To use QML objects from c++, the link i posted explains how to do it.

                      Comment

                      Working...
                      X