[SOLVED] Qt Quick/Qt Creator grid element question



  • Hello...

    I'm starting a Qt Quick UI project from scratch. In Qt Creator (3.1.2), in the designer, I dragged a grid element onto the canvas. Then I tried to drag some label elements onto the grid, which I was able to do. But, once the label elements were on the grid, they were cast in stone. I couldn't move or resize them via the GUI. I could do so changing in the Geometry in the Properties, but that wasn't the idea.

    Is this expected behavior? Or am I missing something (again?)

    I'm running under Mac OS 10.9.5, Qt 5.3.1

    Thanks!



  • IMHO,The best way to create QML files is create them by hands, without Designer



  • Thanks Ildar... That has occurred to me, but I'm stubbornly trying to use the supplied GUI Designer :/ It seems like what I want to do should be something typical, that designer would be able to handle.

    I'll probably end up using a combination of by hand and the Designer.


  • Lifetime Qt Champion

    Hi,

    Can you try again with the latest version of Qt Creator ? That behavior sounds a bit fishy to me



  • Which would be "latest?" I'm using 3.1.2 which I built from sources I pulled down two nights ago. My git-knowledge is limited, but I think the branch I got it from is 3.1 34d8971 Fix the build: add missing #includes

    Is that the most recent?

    Thanks!


  • Lifetime Qt Champion

    Nope, 3.2.2 is the latest officially released (some days ago if my memory serves well)



  • Hmmmm... I could have sworn a posted a reply here, but it seems to have gone poof!

    So I pulled down the 3.2 build, but I'm having trouble building the source. In case anything obvious jumps out at you as the issue, the errors are:

    @
    /Projects/Qt5.3/bin/moc -DWITH_TESTS -DIDE_LIBRARY_BASENAME="lib" -DQT_CREATOR -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DQMAKE_AS_LIBRARY -DPROPARSER_THREAD_SAFE -DPROEVALUATOR_THREAD_SAFE -DPROEVALUATOR_CUMULATIVE -DPROEVALUATOR_SETENV -DREMOTELINUX_LIBRARY -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_CONCURRENT_LIB -DQT_TESTLIB_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="/Volumes/Projects/myQt_Creator/src/plugins/remotelinux" -D__APPLE__ -D__GNUC__=4 -I/Projects/Qt5.3/mkspecs/macx-clang -I/Volumes/Projects/myQt_Creator/src/plugins/remotelinux -I/Volumes/Projects/myQt_Creator/src -I/Volumes/Projects/myQt_Creator/src/libs -I/Volumes/Projects/myQt_Creator/tools -I/Volumes/Projects/myQt_Creator/src/plugins -I/Volumes/Projects/myQt_Creator/src/shared -I/Volumes/Projects/myQt_Creator/src/libs/3rdparty -I/Projects/Qt5.3/lib/QtWidgets.framework/Headers -I/Projects/Qt5.3/lib/QtConcurrent.framework/Headers -I/Projects/Qt5.3/lib/QtTest.framework/Headers -I/Projects/Qt5.3/lib/QtNetwork.framework/Headers -I/Projects/Qt5.3/lib/QtGui.framework/Headers -I/Projects/Qt5.3/lib/QtCore.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -F/Projects/Qt5.3/lib remotelinuxcheckforfreediskspacestep.h -o .moc/debug-shared/moc_remotelinuxcheckforfreediskspacestep.cpp
    qbsproject.cpp:267:43: error: no member named 'addFiles' in 'qbs::Project'
    qbs::ErrorInfo err = m_qbsProject.addFiles(productData, groupData, QStringList() << path);
    ~~~~~~~~~~~~ ^
    qbsproject.cpp:294:32: error: no member named 'removeFiles' in 'qbs::Project'
    = m_qbsProject.removeFiles(productData, groupData, QStringList() << path);
    ~~~~~~~~~~~~ ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -fPIC -DWITH_TESTS -DIDE_LIBRARY_BASENAME="lib" -DQT_CREATOR -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DQMAKE_AS_LIBRARY -DPROPARSER_THREAD_SAFE -DPROEVALUATOR_THREAD_SAFE -DPROEVALUATOR_CUMULATIVE -DPROEVALUATOR_SETENV -DQMLJSEDITOR_LIBRARY -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_SCRIPT_LIB -DQT_NETWORK_LIB -DQT_CONCURRENT_LIB -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="/Volumes/Projects/myQt_Creator/src/plugins/qmljseditor" -I/Volumes/Projects/Qt5.3/mkspecs/macx-clang -I. -I../../../src -I../../libs -I/Volumes/Projects/myQt_Creator/tools -I../../plugins -I../../shared -I../../libs/3rdparty -I/Volumes/Projects/Qt5.3/lib/QtWidgets.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtScript.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtNetwork.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtConcurrent.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtTest.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtGui.framework/Versions/5/Headers -I/Volumes/Projects/Qt5.3/lib/QtCore.framework/Versions/5/Headers -I.moc/debug-shared -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers -I.uic -F/Projects/Qt5.3/lib -o .obj/debug-shared/qmljshoverhandler.o qmljshoverhandler.cpp
    2 errors generated.
    make[3]: *** [.obj/debug-shared/qbsproject.o] Error 1
    make[2]: *** [sub-qbsprojectmanager-make_first] Error 2
    make[2]: *** Waiting for unfinished jobs....
    @

    I've cleaned and rebuilt a few times, all with the same results. I'll have a look at the source code, but it looks like a relatively straightforward C++ error (Ha! Famous last words!)


  • Lifetime Qt Champion

    Forgot that qbs is a separated git repo, you have to update that one also



  • Once an item is child of a layout/positioner you cannot move/resize the item in the form editor anymore.
    The position inside the layout can still be changed in the navigator.



  • That seems like a major usability issue to me. If you don't get it right as soon as the child object lands in the layout, you can't use the GUI to reposition it. Even worse, in my experience, you'd have to drag and drop an object outside the layout, resize it, and then drag it into the layout and hope you get the positioning right first time.

    Are there any plans for an enhancement to improve this? Or is there a different way to approach it so it doesn't seem as difficult and error-prone?

    Thanks Thomas!



  • The problem is that the position (and for layouts also the size) is defined by the layout. This means that any code/tool that is capable of direct manipulating the items inside the layout has to understand the semantics of the layout to work correctly. Also getting the ui right for manipulating/positioning items inside e.g. a grid is not trivial.

    While this is something nice to have, we did not have the resources to implement this. So instead of having something that only works "sometimes" and has unexpected behavior we locked the items.

    You can still "move" them around by changing the order in the navigator (tree view).
    So there is no need to get the position right. The position is determined by the order of the items and can be changed any time.



  • Thanks for the detailed explanation. It makes it a lot easier to understand the situation.

    I might still campaign to at least be able to resize an object in a layout. Maybe someday...

    Thanks again!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.